Contract 0xe019a12c38debf424818871e24dd43bce57fa74b

 
 
Txn Hash
Method
Block
From
To
Value [Txn Fee]
0xd06dbbf46deda7f0b9e01966ea8bdf4dc5e278bc09e71bea5101a17815049e3bSafe Transfer Fr...366743052022-12-10 21:44:17109 days 17 hrs ago0xad868dea7e8bd1d97c1b3a8d4cca2e361049d3ca IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.002622231702 30.002307777
0xe5546512a09d1aefed807d2baa4ad63318fa801c19d0c412535ec9f7d1e6ae9eUpdate Token Uri365480502022-12-07 19:03:31112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003760858919 67.059999999
0xcb33ddfa1897ec73cca7c463e3dfabc83a54240658fb32190a8a7dc72808fe4dUpdate Token Uri365480482022-12-07 19:03:27112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003760858919 67.059999999
0x0a704e300e20598416bfa69a722505a3f66aa94610a23ea1263fc1e462be8058Update Token Uri365480472022-12-07 19:03:25112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003760858919 67.059999999
0xb1c172ad54eac6d1472dee287ac0900c3ed9d8c41e3d6554e0e32b2395f5ac15Update Token Uri365480462022-12-07 19:03:23112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003760858919 67.059999999
0x1d4c2dcfb83f2d2e6f840a699434ab203362b125e7aa0db71a9d14e9c2e59730Update Token Uri365480442022-12-07 19:03:19112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003760858919 67.059999999
0x503fcfa2a0a01aedc52407cfa720e63384e960abeed3a97f0fa45a8c17688ed8Update Token Uri365480422022-12-07 19:03:15112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003760858919 67.059999999
0x61765a77d4975557bd507734982f4c81cd69fc40e2dcb7d46db4f4252df27f94Update Token Uri365480402022-12-07 19:03:11112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003760858919 67.059999999
0x5777f6f44157e7700e0e87f299a9fc499027ac4abad349dacca95a6712ee39b3Update Token Uri365480402022-12-07 19:03:11112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003760858919 67.059999999
0xa23f7106d8665aab54693c8cd0945a8b8b75916340587810cde0570649a57522Update Token Uri365480392022-12-07 19:03:09112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003760858919 67.059999999
0x71f343bad2715b8d94e7d15fc881be63ad9c083bda31583cd7451786b8d9de5aUpdate Token Uri365480372022-12-07 19:03:05112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003760858919 67.059999999
0xe4974d31de8f8e339583c7392f29ea5b64ea02b1867911e9c6ba71e5cc650f6aUpdate Token Uri365480352022-12-07 19:03:01112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003760858919 67.059999999
0x8c0505b0f0a3f00874c4f3b77042b989ea02b9da6ab46b7abc9352579c878eacUpdate Token Uri365480342022-12-07 19:02:59112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003760858919 67.059999999
0xf54167b7c8d7748226ba55038b46aa79ec914b1ab9d911df4a95ad24efac454bUpdate Token Uri365480322022-12-07 19:02:55112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003760858919 67.059999999
0x8e2467dc0d219cb86d1fc37a042365cecc9b05f8133ef03599ae7130ebfe7ed4Update Token Uri365480322022-12-07 19:02:55112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003682344119 65.659999999
0x3279dfffb49ff5fb88b6903bb7cacb27973b440483b144456e881df530b7030bUpdate Token Uri365480322022-12-07 19:02:55112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003682344119 65.659999999
0x1e13a6e8e1de79e734d7a002502ea1d63aba01b2d04713299c4a5f872f9b4355Update Token Uri365480302022-12-07 19:02:47112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003564571919 63.559999999
0x175e985f91502e27a6576fb79f90b91aac1ae574b9d94ef20673914635c863d0Update Token Uri365480292022-12-07 19:02:45112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003564571919 63.559999999
0x8e0db54f4cff787296be8b43e9db85e5b504764308daf0d61625db1dd6abc670Update Token Uri365480282022-12-07 19:02:43112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003564571919 63.559999999
0x385ec3c074b7a527f467c05e6ac7ecdbbc23224ec1943e1171a91473841e09ceUpdate Token Uri365480272022-12-07 19:02:41112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003564571919 63.559999999
0xf162ce2e6ffe5b15cb24fa784239987ac373f42a20e23a75829170728676fc07Update Token Uri365480262022-12-07 19:02:39112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003564571919 63.559999999
0x03f7a9e6c46c01c813513b12b55d6c663fac5fe74a1c1c726b0a1743640d4806Update Token Uri365480252022-12-07 19:02:37112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003564571919 63.559999999
0xbeb4a46999923fc5530b7ec17f51f7d9fbc8c1c8b4b5c0b16e9d96702ac1b1b0Update Token Uri365480242022-12-07 19:02:35112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003564571919 63.559999999
0x71162f5e8186a7dfbdb36e0ea063a2b09daf2560bb6dea847d908804360d4d62Update Token Uri365480222022-12-07 19:02:31112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003564571919 63.559999999
0x95e7ff38a9e4e65d56f6828b46ece712b11dc58a974aeb2ffde0510f312ac9b4Update Token Uri365480222022-12-07 19:02:31112 days 20 hrs ago0x79461864297664d1ed0fa994642f3db2e0d75120 IN  0xe019a12c38debf424818871e24dd43bce57fa74b0 MATIC0.003564571919 63.559999999
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0xAB3ED063f9383001099e72BA215263DFeEfFe415

Contract Name:
CustomERC721Roles

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 21 : 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 2 of 21 : 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 3 of 21 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)

pragma solidity ^0.8.0;

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

File 4 of 21 : IERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 *
 * _Available since v4.5._
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be payed in that same unit of exchange.
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount);
}

File 5 of 21 : 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 6 of 21 : 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 7 of 21 : 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 8 of 21 : 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 9 of 21 : ERC721URIStorage.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721URIStorage.sol)

pragma solidity ^0.8.0;

import "../ERC721.sol";

/**
 * @dev ERC721 token with storage based token URI management.
 */
abstract contract ERC721URIStorage is ERC721 {
    using Strings for uint256;

    // Optional mapping for token URIs
    mapping(uint256 => string) private _tokenURIs;

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

        string memory _tokenURI = _tokenURIs[tokenId];
        string memory base = _baseURI();

        // If there is no base URI, return the token URI.
        if (bytes(base).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(base, _tokenURI));
        }

        return super.tokenURI(tokenId);
    }

    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

    /**
     * @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 override {
        super._burn(tokenId);

        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];
        }
    }
}

File 10 of 21 : 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 11 of 21 : 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 12 of 21 : ERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.0;

import "../../interfaces/IERC2981.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
 *
 * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
 * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
 *
 * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
 * fee is specified in basis points by default.
 *
 * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
 * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
 * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
 *
 * _Available since v4.5._
 */
abstract contract ERC2981 is IERC2981, ERC165 {
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

    RoyaltyInfo private _defaultRoyaltyInfo;
    mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;

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

    /**
     * @inheritdoc IERC2981
     */
    function royaltyInfo(uint256 _tokenId, uint256 _salePrice)
        external
        view
        virtual
        override
        returns (address, uint256)
    {
        RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];

        if (royalty.receiver == address(0)) {
            royalty = _defaultRoyaltyInfo;
        }

        uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();

        return (royalty.receiver, royaltyAmount);
    }

    /**
     * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
     * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
     * override.
     */
    function _feeDenominator() internal pure virtual returns (uint96) {
        return 10000;
    }

    /**
     * @dev Sets the royalty information that all ids in this contract will default to.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: invalid receiver");

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Removes default royalty information.
     */
    function _deleteDefaultRoyalty() internal virtual {
        delete _defaultRoyaltyInfo;
    }

    /**
     * @dev Sets the royalty information for a specific token id, overriding the global default.
     *
     * Requirements:
     *
     * - `tokenId` must be already minted.
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setTokenRoyalty(
        uint256 tokenId,
        address receiver,
        uint96 feeNumerator
    ) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: Invalid parameters");

        _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Resets royalty information for the token id back to the global default.
     */
    function _resetTokenRoyalty(uint256 tokenId) internal virtual {
        delete _tokenRoyaltyInfo[tokenId];
    }
}

File 13 of 21 : 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 14 of 21 : 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 15 of 21 : 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 16 of 21 : 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 17 of 21 : 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 18 of 21 : Base64.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @title Base64
/// @notice Provides a function for encoding some bytes in base64
/// @author Brecht Devos <[email protected]>
library Base64 {
    bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /// @notice Encodes some bytes to the base64 representation
    function encode(bytes memory data) internal pure returns (string memory) {
        uint256 len = data.length;
        if (len == 0) return "";

        // multiply by 4/3 rounded up
        uint256 encodedLen = 4 * ((len + 2) / 3);

        // Add some extra buffer at the end
        bytes memory result = new bytes(encodedLen + 32);

        bytes memory table = TABLE;

        // solium-disable-next-line security/no-inline-assembly
        assembly {
            let tablePtr := add(table, 1)
            let resultPtr := add(result, 32)

            for {
                let i := 0
            } lt(i, len) {

            } {
                i := add(i, 3)
                let input := and(mload(add(data, i)), 0xffffff)

                let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))
                out := shl(8, out)
                out := add(
                    out,
                    and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF)
                )
                out := shl(8, out)
                out := add(
                    out,
                    and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF)
                )
                out := shl(8, out)
                out := add(
                    out,
                    and(mload(add(tablePtr, and(input, 0x3F))), 0xFF)
                )
                out := shl(224, out)

                mstore(resultPtr, out)

                resultPtr := add(resultPtr, 4)
            }

            switch mod(len, 3)
            case 1 {
                mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
            }
            case 2 {
                mstore(sub(resultPtr, 1), shl(248, 0x3d))
            }

            mstore(result, encodedLen)
        }

        return string(result);
    }
}

File 19 of 21 : Config.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

library Config {
    /// Fixed at deployment time
    struct Deployment {
        // Name of the NFT contract.
        string name;
        // Symbol of the NFT contract.
        string symbol;
        // The contract owner address. If you wish to own the contract, then set it as your wallet address.
        // This is also the wallet that can manage the contract on NFT marketplaces.
        address owner;
        // If true, tokens may be burned by owner. Cannot be changed later.
        bool tokensBurnable;
    }

    /// Updatable by admins and owner
    struct Runtime {
        // Metadata base URI for tokens, NFTs minted in this contract will have metadata URI of `baseURI` + `tokenID`.
        // Set this to reveal token metadata.
        string baseURI;
        // If true, the base URI of the NFTs minted in the specified contract can be updated after minting (token URIs
        // are not frozen on the contract level). This is useful for revealing NFTs after the drop. If false, all the
        // NFTs minted in this contract are frozen by default which means token URIs are non-updatable.
        bool metadataUpdatable;
        // If true, tokens may be transferred by owner. Default is true. Can be only changed to false.
        bool tokensTransferable;
        // Secondary market royalties in basis points (100 bps = 1%)
        uint256 royaltiesBps;
        // Address for royalties
        address royaltiesAddress;
    }
}

File 20 of 21 : GranularRoles.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

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

abstract contract GranularRoles is AccessControl {
    // Roles list
    // Admin role can have 2 addresses: 
    // one address same as (_owner) which can be changed 
    // one for NFTPort API access which can only be revoked
    bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
    // Following roles can have multiple addresses, can be changed by admin or update contrac role
    bytes32 public constant MINT_ROLE = keccak256("MINT_ROLE");
    bytes32 public constant UPDATE_CONTRACT_ROLE = keccak256("UPDATE_CONTRACT_ROLE");
    bytes32 public constant UPDATE_TOKEN_ROLE = keccak256("UPDATE_TOKEN_ROLE");
    bytes32 public constant BURN_ROLE = keccak256("BURN_ROLE");
    bytes32 public constant TRANSFER_ROLE = keccak256("TRANSFER_ROLE");

    struct RolesAddresses {
        bytes32 role;
        address[] addresses;
        bool frozen;
    }

    address internal _owner;
    address internal _nftPort;

    mapping(bytes32 => address[]) internal _rolesAddressesIndexed; // Used to get roles enumeration
    mapping(bytes32 => bool) internal _rolesFrozen;

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

    function owner() public view returns (address) {
        return _owner;
    }

    function transferOwnership(address newOwner) public {
        require(newOwner != _owner, "Already the owner");
        require(msg.sender == _owner, "Only owner can transfer ownership");
        _revokeRole(ADMIN_ROLE, _owner);
        address previousOwner = _owner;
        _owner = newOwner;
        _grantRole(ADMIN_ROLE, _owner);
        emit OwnershipTransferred(previousOwner, newOwner);
    }

    function revokeNFTPortPermissions() public onlyRole(ADMIN_ROLE) {
        _revokeRole(ADMIN_ROLE, _nftPort);
        _nftPort = address(0);
    }

    // Admin role has all access granted by default 
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return super.hasRole(ADMIN_ROLE, account) || super.hasRole(role, account);
    }

    function _initRoles(address owner, RolesAddresses[] memory rolesAddresses) internal {
        _owner = owner;
        _nftPort = msg.sender;
        _grantRole(ADMIN_ROLE, _owner);
        _grantRole(ADMIN_ROLE, _nftPort);

        for (uint256 roleIndex = 0; roleIndex < rolesAddresses.length; roleIndex++) {
            bytes32 role = rolesAddresses[roleIndex].role;
            require(_regularRoleValid(role), "GranularRoles: Invalid rolesAddresses");
            for(uint256 addressIndex = 0; addressIndex < rolesAddresses[roleIndex].addresses.length; addressIndex++) {
                _grantRole(role, rolesAddresses[roleIndex].addresses[addressIndex]);
                _rolesAddressesIndexed[role].push(rolesAddresses[roleIndex].addresses[addressIndex]);
            }
            if (rolesAddresses[roleIndex].frozen) {
                _rolesFrozen[role] = true;
            }
        }
    }

    function _updateRoles(RolesAddresses[] memory rolesAddresses) internal {
        if (rolesAddresses.length > 0) {
            require(hasRole(ADMIN_ROLE, msg.sender), "Granular roles: only ADMIN_ROLE can change permissions");
            for (uint256 roleIndex = 0; roleIndex < rolesAddresses.length; roleIndex++) {
                bytes32 role = rolesAddresses[roleIndex].role;
                require(_regularRoleValid(role), 
                    string(
                        abi.encodePacked(
                            "GranularRoles: invalid role ",
                            Strings.toHexString(uint256(role), 32)
                        )
                    )
                );
                require(!_rolesFrozen[role], 
                    string(
                        abi.encodePacked(
                            "GranularRoles: role ",
                            Strings.toHexString(uint256(role), 32),
                            " is frozen"
                        )
                    )
                );
                for(uint256 addressIndex = 0; addressIndex < _rolesAddressesIndexed[role].length; addressIndex++) {
                    _revokeRole(role, _rolesAddressesIndexed[role][addressIndex]);
                }
                delete _rolesAddressesIndexed[role];
                for(uint256 addressIndex = 0; addressIndex < rolesAddresses[roleIndex].addresses.length; addressIndex++) {
                    _grantRole(role, rolesAddresses[roleIndex].addresses[addressIndex]);
                    _rolesAddressesIndexed[role].push(rolesAddresses[roleIndex].addresses[addressIndex]);
                }
                if (rolesAddresses[roleIndex].frozen) {
                    _rolesFrozen[role] = true;
                }
            }
        }
    }

    function _regularRoleValid(bytes32 role) internal returns (bool) {
        return 
            role == MINT_ROLE || 
            role == UPDATE_CONTRACT_ROLE ||
            role == UPDATE_TOKEN_ROLE ||
            role == BURN_ROLE ||
            role == TRANSFER_ROLE;
    }
}

File 21 of 21 : 11_custom_erc721_roles.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import {IERC2981} from "@openzeppelin/contracts/token/common/ERC2981.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

import "../lib/GranularRoles.sol";
import "../lib/Base64.sol";
import "../lib/Config.sol";

contract CustomERC721Roles is ERC721URIStorage, GranularRoles {
    using Strings for uint256;
    uint16 constant ROYALTIES_BASIS = 10000;

    bool public metadataUpdatable;
    bool public tokensBurnable;
    bool public tokensTransferable;

    // Mapping of individually frozen tokens
    mapping (uint256 => bool) public freezeTokenUris;

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

    string public baseURI;

    address public royaltiesAddress;
    uint256 public royaltiesBasisPoints;

    event PermanentURI(string _value, uint256 indexed _id); // https://docs.opensea.io/docs/metadata-standards
    event PermanentURIGlobal();

    constructor(
        Config.Deployment memory deploymentConfig,
        Config.Runtime memory runtimeConfig,
        RolesAddresses[] memory rolesAddresses
    ) ERC721(deploymentConfig.name, deploymentConfig.symbol) {
        royaltiesAddress = runtimeConfig.royaltiesAddress;
        royaltiesBasisPoints = runtimeConfig.royaltiesBps;

        metadataUpdatable = runtimeConfig.metadataUpdatable;
        tokensBurnable = deploymentConfig.tokensBurnable;
        tokensTransferable = runtimeConfig.tokensTransferable;

        baseURI = runtimeConfig.baseURI;

        _initRoles(deploymentConfig.owner, rolesAddresses);
    }

    function supportsInterface(bytes4 interfaceId)
    public
    view
    override(ERC721, AccessControl)
    returns (bool)
    {
        return ERC721.supportsInterface(interfaceId) || interfaceId == type(IERC2981).interfaceId;
    }

    function royaltyInfo(uint256 tokenId, uint256 salePrice)
    external
    view
    returns (address, uint256)
    {
        return (royaltiesAddress, royaltiesBasisPoints * salePrice / ROYALTIES_BASIS);
    }

    function contractURI()
    external
    view
    returns (string memory)
    {
        string memory json = Base64.encode(
            bytes(
                string(
                    abi.encodePacked(
                        // solium-disable-next-line quotes
                        '{"seller_fee_basis_points": ', // solhint-disable-line quotes
                        royaltiesBasisPoints.toString(),
                        // solium-disable-next-line quotes
                        ', "fee_recipient": "', // solhint-disable-line quotes
                        uint256(uint160(royaltiesAddress)).toHexString(20),
                        // solium-disable-next-line quotes
                        '"}' // solhint-disable-line quotes
                    )
                )
            )
        );

        string memory output = string(
            abi.encodePacked("data:application/json;base64,", json)
        );

        return output;
    }

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

    function mintToCaller(address caller, uint256 tokenId, string memory tokenURI)
    public
    onlyRole(MINT_ROLE)
    returns (uint256)
    {
        _safeMint(caller, tokenId);
        _setTokenURI(tokenId, tokenURI);
        return tokenId;
    }

    function updateTokenUri(uint256 _tokenId, string memory _tokenUri, bool _isFreezeTokenUri)
    public
    onlyRole(UPDATE_TOKEN_ROLE) {
        require(_exists(_tokenId), "NFT: update URI query for nonexistent token");
        require(metadataUpdatable, "NFT: Token uris are frozen globally");
        require(freezeTokenUris[_tokenId] != true, "NFT: Token is frozen");
        require(_isFreezeTokenUri || (bytes(_tokenUri).length != 0), "NFT: Either _tokenUri or _isFreezeTokenUri=true required");

        if (bytes(_tokenUri).length != 0) {
            require(keccak256(bytes(tokenURI(_tokenId))) != keccak256(bytes(string(abi.encodePacked(_baseURI(), _tokenUri)))), "NFT: New token URI is same as updated");
            _setTokenURI(_tokenId, _tokenUri);
        }
        if (_isFreezeTokenUri) {
            freezeTokenUris[_tokenId] = true;
            emit PermanentURI(tokenURI(_tokenId), _tokenId);
        }
    }

    function transferByOwner(
        address _to,
        uint256 _tokenId
    )
    public
    onlyRole(TRANSFER_ROLE) {
        require(tokensTransferable, "NFT: Transfers by owner are disabled");
        _safeTransfer(_owner, _to, _tokenId, "");
    }

    function burn(uint256 _tokenId)
    public
    onlyRole(BURN_ROLE) {
        require(tokensBurnable, "NFT: tokens burning is disabled");
        require(_exists(_tokenId), "Burn for nonexistent token");
        require(ERC721.ownerOf(_tokenId) == _owner, "NFT: tokens may be burned by owner only");
        _burn(_tokenId);
    }

    function update(
        Config.Runtime calldata newConfig,
        RolesAddresses[] memory rolesAddresses,
        bool isRevokeNFTPortPermissions
    ) public
    onlyRole(UPDATE_CONTRACT_ROLE) {
        // If metadata is frozen, baseURI cannot be updated
        require(
            metadataUpdatable ||
            (keccak256(abi.encodePacked(newConfig.baseURI)) ==
                keccak256(abi.encodePacked(baseURI))),
            "Metadata is frozen"
        );

        baseURI = newConfig.baseURI;
        royaltiesAddress = newConfig.royaltiesAddress;
        royaltiesBasisPoints = newConfig.royaltiesBps;

        if (!newConfig.tokensTransferable) {
            tokensTransferable = false;
        }
        if (!newConfig.metadataUpdatable && metadataUpdatable) {
            metadataUpdatable = false;
            emit PermanentURIGlobal();
        }

        _updateRoles(rolesAddresses);

        if (isRevokeNFTPortPermissions) {
            revokeNFTPortPermissions();
        }
    }

    function totalSupply() public view virtual returns (uint256) {
        return _allTokens.length;
    }

    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual returns (uint256) {
        require(index < balanceOf(owner), "ERC721: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    function tokenByIndex(uint256 index) public view virtual returns (uint256) {
        require(index < totalSupply(), "ERC721: global index out of bounds");
        return _allTokens[index];
    }

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

    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"bool","name":"tokensBurnable","type":"bool"}],"internalType":"struct Config.Deployment","name":"deploymentConfig","type":"tuple"},{"components":[{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"bool","name":"metadataUpdatable","type":"bool"},{"internalType":"bool","name":"tokensTransferable","type":"bool"},{"internalType":"uint256","name":"royaltiesBps","type":"uint256"},{"internalType":"address","name":"royaltiesAddress","type":"address"}],"internalType":"struct Config.Runtime","name":"runtimeConfig","type":"tuple"},{"components":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address[]","name":"addresses","type":"address[]"},{"internalType":"bool","name":"frozen","type":"bool"}],"internalType":"struct GranularRoles.RolesAddresses[]","name":"rolesAddresses","type":"tuple[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"_value","type":"string"},{"indexed":true,"internalType":"uint256","name":"_id","type":"uint256"}],"name":"PermanentURI","type":"event"},{"anonymous":false,"inputs":[],"name":"PermanentURIGlobal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BURN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TRANSFER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPDATE_CONTRACT_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPDATE_TOKEN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"freezeTokenUris","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"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":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metadataUpdatable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"caller","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"tokenURI","type":"string"}],"name":"mintToCaller","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revokeNFTPortPermissions","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":[],"name":"royaltiesAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"royaltiesBasisPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensBurnable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensTransferable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"transferByOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"bool","name":"metadataUpdatable","type":"bool"},{"internalType":"bool","name":"tokensTransferable","type":"bool"},{"internalType":"uint256","name":"royaltiesBps","type":"uint256"},{"internalType":"address","name":"royaltiesAddress","type":"address"}],"internalType":"struct Config.Runtime","name":"newConfig","type":"tuple"},{"components":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address[]","name":"addresses","type":"address[]"},{"internalType":"bool","name":"frozen","type":"bool"}],"internalType":"struct GranularRoles.RolesAddresses[]","name":"rolesAddresses","type":"tuple[]"},{"internalType":"bool","name":"isRevokeNFTPortPermissions","type":"bool"}],"name":"update","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"string","name":"_tokenUri","type":"string"},{"internalType":"bool","name":"_isFreezeTokenUri","type":"bool"}],"name":"updateTokenUri","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506040516200457338038062004573833981016040819052620000349162000996565b825160208085015182519091620000519160009185019062000569565b5080516200006790600190602084019062000569565b5050506080820151601380546001600160a01b0319166001600160a01b03909216919091179055606080830151601455602080840151600c805493870151604087015161ffff1990951692151561ff00191692909217610100921515929092029190911762ff0000191662010000931515939093029290921790915582518051620000f792601292019062000569565b50604083015162000109908262000112565b50505062000b24565b600880546001600160a01b0384166001600160a01b031991821681179092556009805490911633179055620001589060008051602062004553833981519152906200038f565b600954620001809060008051602062004553833981519152906001600160a01b03166200038f565b60005b81518110156200038a576000828281518110620001a457620001a462000aa7565b6020026020010151600001519050620001c3816200041a60201b60201c565b620002225760405162461bcd60e51b815260206004820152602560248201527f4772616e756c6172526f6c65733a20496e76616c696420726f6c657341646472604482015264657373657360d81b606482015260840160405180910390fd5b60005b8383815181106200023a576200023a62000aa7565b6020026020010151602001515181101562000332576200029d8285858151811062000269576200026962000aa7565b602002602001015160200151838151811062000289576200028962000aa7565b60200260200101516200038f60201b60201c565b6000828152600a602052604090208451859085908110620002c257620002c262000aa7565b6020026020010151602001518281518110620002e257620002e262000aa7565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b0390921691909117905580620003298162000abd565b91505062000225565b5082828151811062000348576200034862000aa7565b6020026020010151604001511562000374576000818152600b60205260409020805460ff191660011790555b5080620003818162000abd565b91505062000183565b505050565b6200039b8282620004f1565b620004165760008281526007602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620003d53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b60007f154c00819833dac601ee5ddded6fda79d9d8b506b911b3dbd54cdb95fe6c36868214806200046a57507f9b16859c0d694afa65b1b6551542db11ea12d6208b6a17dc922f10f2d74440f582145b806200049557507f852fd44a27d33057a8c3d90859d4e4c9f54309d4d66d1d968e063befba9198e682145b80620004c057507fe97b137254058bd94f28d2f3eb79e2d34074ffb488d042e3bc958e0a57d2fa2282145b80620004eb57507f8502233096d909befbda0999bb8ea2f3a6be3c138b9fbf003752a4c8bce86f6c82145b92915050565b60006200051960008051602062004553833981519152836200053e60201b620017e01760201c565b806200053757506200053783836200053e60201b620017e01760201c565b9392505050565b60009182526007602090815260408084206001600160a01b0393909316845291905290205460ff1690565b828054620005779062000ae7565b90600052602060002090601f0160209004810192826200059b5760008555620005e6565b82601f10620005b657805160ff1916838001178555620005e6565b82800160010185558215620005e6579182015b82811115620005e6578251825591602001919060010190620005c9565b50620005f4929150620005f8565b5090565b5b80821115620005f45760008155600101620005f9565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b03811182821017156200064a576200064a6200060f565b60405290565b604051608081016001600160401b03811182821017156200064a576200064a6200060f565b604051601f8201601f191681016001600160401b0381118282101715620006a057620006a06200060f565b604052919050565b600082601f830112620006ba57600080fd5b81516001600160401b03811115620006d657620006d66200060f565b6020620006ec601f8301601f1916820162000675565b82815285828487010111156200070157600080fd5b60005b838110156200072157858101830151828201840152820162000704565b83811115620007335760008385840101525b5095945050505050565b80516001600160a01b03811681146200075557600080fd5b919050565b805180151581146200075557600080fd5b600060a082840312156200077e57600080fd5b60405160a081016001600160401b038082118383101715620007a457620007a46200060f565b816040528293508451915080821115620007bd57600080fd5b50620007cc85828601620006a8565b825250620007dd602084016200075a565b6020820152620007f0604084016200075a565b6040820152606083015160608201526200080d608084016200073d565b60808201525092915050565b60006001600160401b038211156200083557620008356200060f565b5060051b60200190565b600082601f8301126200085157600080fd5b815160206200086a620008648362000819565b62000675565b82815260059290921b840181019181810190868411156200088a57600080fd5b8286015b848110156200098b5780516001600160401b0380821115620008b05760008081fd5b908801906060828b03601f1901811315620008cb5760008081fd5b620008d562000625565b87840151815260408085015184811115620008f05760008081fd5b85019350603f84018d13620009055760008081fd5b8884015162000918620008648262000819565b81815260059190911b85018201908a8101908f831115620009395760008081fd5b958301955b82871015620009625762000952876200073d565b8252958b0195908b01906200093e565b848c0152506200097690508584016200075a565b9082015286525050509183019183016200088e565b509695505050505050565b600080600060608486031215620009ac57600080fd5b83516001600160401b0380821115620009c457600080fd5b9085019060808288031215620009d957600080fd5b620009e362000650565b825182811115620009f357600080fd5b62000a0189828601620006a8565b82525060208301518281111562000a1757600080fd5b62000a2589828601620006a8565b60208301525062000a39604084016200073d565b604082015262000a4c606084016200075a565b6060820152602087015190955091508082111562000a6957600080fd5b62000a77878388016200076b565b9350604086015191508082111562000a8e57600080fd5b5062000a9d868287016200083f565b9150509250925092565b634e487b7160e01b600052603260045260246000fd5b600060001982141562000ae057634e487b7160e01b600052601160045260246000fd5b5060010190565b600181811c9082168062000afc57607f821691505b6020821081141562000b1e57634e487b7160e01b600052602260045260246000fd5b50919050565b613a1f8062000b346000396000f3fe608060405234801561001057600080fd5b506004361061027f5760003560e01c806370a082311161015c578063b29c097a116100ce578063e3d5207211610087578063e3d52072146105f7578063e8a3d48514610609578063e985e9c514610611578063e9a9c8501461064d578063f153c2e514610674578063f2fde38b1461067c57600080fd5b8063b29c097a1461055d578063b88d4fde14610584578063b930908f14610597578063c87b56dd146105be578063d547741f146105d1578063de374d9d146105e457600080fd5b806391d148541161012057806391d148541461050b57806395d89b411461051e578063a217fddf14610526578063a22cb4651461052e578063a2f551ec14610541578063a53a84b61461055457600080fd5b806370a082311461049c57806375b238fc146104af5780637afdcdbb146104c45780638d010db3146104d75780638da5cb5b146104fa57600080fd5b80632e628b61116101f557806342842e0e116101b957806342842e0e1461043b57806342966c681461044e5780634e6f9dd6146104615780634f6ccce71461046e5780636352211e146104815780636c0360eb1461049457600080fd5b80632e628b61146103dc5780632f2ff15d146103ef5780632f745c5914610402578063328825351461041557806336568abe1461042857600080fd5b8063206b60f911610247578063206b60f91461031357806321e92d491461033a57806323b872dd1461034d578063248a9ca3146103605780632a55205a146103835780632c23b965146103b557600080fd5b806301ffc9a71461028457806306fdde03146102ac578063081812fc146102c1578063095ea7b3146102ec57806318160ddd14610301575b600080fd5b610297610292366004612e72565b61068f565b60405190151581526020015b60405180910390f35b6102b46106bb565b6040516102a39190612ee7565b6102d46102cf366004612efa565b61074d565b6040516001600160a01b0390911681526020016102a3565b6102ff6102fa366004612f2f565b6107da565b005b6010545b6040519081526020016102a3565b6103057f8502233096d909befbda0999bb8ea2f3a6be3c138b9fbf003752a4c8bce86f6c81565b6102ff610348366004612f2f565b6108f0565b6102ff61035b366004612f59565b6109a8565b61030561036e366004612efa565b60009081526007602052604090206001015490565b610396610391366004612f95565b6109d9565b604080516001600160a01b0390931683526020830191909152016102a3565b6103057f9b16859c0d694afa65b1b6551542db11ea12d6208b6a17dc922f10f2d74440f581565b6102ff6103ea36600461305b565b610a15565b6102ff6103fd36600461320a565b610bcd565b610305610410366004612f2f565b610bf3565b6013546102d4906001600160a01b031681565b6102ff61043636600461320a565b610c7f565b6102ff610449366004612f59565b610cfd565b6102ff61045c366004612efa565b610d18565b600c546102979060ff1681565b61030561047c366004612efa565b610e73565b6102d461048f366004612efa565b610efc565b6102b4610f73565b6103056104aa366004613236565b611001565b6103056000805160206139ca83398151915281565b6103056104d23660046132c9565b611088565b6102976104e5366004612efa565b600d6020526000908152604090205460ff1681565b6008546001600160a01b03166102d4565b61029761051936600461320a565b6110d2565b6102b4611103565b610305600081565b6102ff61053c366004613320565b611112565b6102ff61054f36600461334a565b61111d565b61030560145481565b6103057f852fd44a27d33057a8c3d90859d4e4c9f54309d4d66d1d968e063befba9198e681565b6102ff610592366004613398565b6113fa565b6103057fe97b137254058bd94f28d2f3eb79e2d34074ffb488d042e3bc958e0a57d2fa2281565b6102b46105cc366004612efa565b61142c565b6102ff6105df36600461320a565b611596565b600c546102979062010000900460ff1681565b600c5461029790610100900460ff1681565b6102b46115bc565b61029761061f366004613414565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6103057f154c00819833dac601ee5ddded6fda79d9d8b506b911b3dbd54cdb95fe6c368681565b6102ff611636565b6102ff61068a366004613236565b611687565b600061069a8261180b565b806106b557506001600160e01b0319821663152a902d60e11b145b92915050565b6060600080546106ca9061343e565b80601f01602080910402602001604051908101604052809291908181526020018280546106f69061343e565b80156107435780601f1061071857610100808354040283529160200191610743565b820191906000526020600020905b81548152906001019060200180831161072657829003601f168201915b5050505050905090565b60006107588261185b565b6107be5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006107e582610efc565b9050806001600160a01b0316836001600160a01b031614156108535760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016107b5565b336001600160a01b038216148061086f575061086f813361061f565b6108e15760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016107b5565b6108eb8383611878565b505050565b7f8502233096d909befbda0999bb8ea2f3a6be3c138b9fbf003752a4c8bce86f6c61091b81336118e6565b600c5462010000900460ff1661097f5760405162461bcd60e51b8152602060048201526024808201527f4e46543a205472616e7366657273206279206f776e6572206172652064697361604482015263189b195960e21b60648201526084016107b5565b6008546040805160208101909152600081526108eb916001600160a01b0316908590859061194a565b6109b2338261197d565b6109ce5760405162461bcd60e51b81526004016107b590613479565b6108eb838383611a63565b60135460145460009182916001600160a01b0390911690612710906109ff9086906134e0565b610a099190613515565b915091505b9250929050565b7f9b16859c0d694afa65b1b6551542db11ea12d6208b6a17dc922f10f2d74440f5610a4081336118e6565b600c5460ff1680610aa957506012604051602001610a5e9190613529565b60408051601f198184030181529190528051602090910120610a8085806135c5565b604051602001610a9192919061360c565b60405160208183030381529060405280519060200120145b610aea5760405162461bcd60e51b815260206004820152601260248201527126b2ba30b230ba309034b990333937bd32b760711b60448201526064016107b5565b610af484806135c5565b610b0091601291612cf7565b50610b1160a0850160808601613236565b601380546001600160a01b0319166001600160a01b0392909216919091179055606084018035601455610b47906040860161361c565b610b5857600c805462ff0000191690555b610b68604085016020860161361c565b158015610b775750600c5460ff165b15610bb057600c805460ff191690556040517fb59f45df38ec0d34114b1248c38a29cdbccbf3e745ae3ef310ac66199a4ceccf90600090a15b610bb983611c0a565b8115610bc757610bc7611636565b50505050565b600082815260076020526040902060010154610be981336118e6565b6108eb8383611f40565b6000610bfe83611001565b8210610c565760405162461bcd60e51b815260206004820152602160248201527f4552433732313a206f776e657220696e646578206f7574206f6620626f756e646044820152607360f81b60648201526084016107b5565b506001600160a01b03919091166000908152600e60209081526040808320938352929052205490565b6001600160a01b0381163314610cef5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016107b5565b610cf98282611fc6565b5050565b6108eb838383604051806020016040528060008152506113fa565b7fe97b137254058bd94f28d2f3eb79e2d34074ffb488d042e3bc958e0a57d2fa22610d4381336118e6565b600c54610100900460ff16610d9a5760405162461bcd60e51b815260206004820152601f60248201527f4e46543a20746f6b656e73206275726e696e672069732064697361626c65640060448201526064016107b5565b610da38261185b565b610def5760405162461bcd60e51b815260206004820152601a60248201527f4275726e20666f72206e6f6e6578697374656e7420746f6b656e00000000000060448201526064016107b5565b6008546001600160a01b0316610e0483610efc565b6001600160a01b031614610e6a5760405162461bcd60e51b815260206004820152602760248201527f4e46543a20746f6b656e73206d6179206265206275726e6564206279206f776e6044820152666572206f6e6c7960c81b60648201526084016107b5565b610cf98261202d565b6000610e7e60105490565b8210610ed75760405162461bcd60e51b815260206004820152602260248201527f4552433732313a20676c6f62616c20696e646578206f7574206f6620626f756e604482015261647360f01b60648201526084016107b5565b60108281548110610eea57610eea613637565b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b0316806106b55760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016107b5565b60128054610f809061343e565b80601f0160208091040260200160405190810160405280929190818152602001828054610fac9061343e565b8015610ff95780601f10610fce57610100808354040283529160200191610ff9565b820191906000526020600020905b815481529060010190602001808311610fdc57829003601f168201915b505050505081565b60006001600160a01b03821661106c5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016107b5565b506001600160a01b031660009081526003602052604090205490565b60007f154c00819833dac601ee5ddded6fda79d9d8b506b911b3dbd54cdb95fe6c36866110b581336118e6565b6110bf858561206d565b6110c98484612087565b50919392505050565b60006110ec6000805160206139ca833981519152836117e0565b806110fc57506110fc83836117e0565b9392505050565b6060600180546106ca9061343e565b610cf9338383612112565b7f852fd44a27d33057a8c3d90859d4e4c9f54309d4d66d1d968e063befba9198e661114881336118e6565b6111518461185b565b6111b15760405162461bcd60e51b815260206004820152602b60248201527f4e46543a207570646174652055524920717565727920666f72206e6f6e65786960448201526a39ba32b73a103a37b5b2b760a91b60648201526084016107b5565b600c5460ff1661120f5760405162461bcd60e51b815260206004820152602360248201527f4e46543a20546f6b656e2075726973206172652066726f7a656e20676c6f62616044820152626c6c7960e81b60648201526084016107b5565b6000848152600d602052604090205460ff1615156001141561126a5760405162461bcd60e51b815260206004820152601460248201527327232a1d102a37b5b2b71034b990333937bd32b760611b60448201526064016107b5565b81806112765750825115155b6112e85760405162461bcd60e51b815260206004820152603860248201527f4e46543a20456974686572205f746f6b656e557269206f72205f69734672656560448201527f7a65546f6b656e5572693d74727565207265717569726564000000000000000060648201526084016107b5565b825115611395576112f76121e1565b8360405160200161130992919061364d565b604051602081830303815290604052805190602001206113288561142c565b80519060200120141561138b5760405162461bcd60e51b815260206004820152602560248201527f4e46543a204e657720746f6b656e205552492069732073616d6520617320757060448201526419185d195960da1b60648201526084016107b5565b6113958484612087565b8115610bc7576000848152600d60205260409020805460ff19166001179055837fa109ba539900bf1b633f956d63c96fc89b814c7287f7aa50a9216d0b556572076113df8261142c565b6040516113ec9190612ee7565b60405180910390a250505050565b611404338361197d565b6114205760405162461bcd60e51b81526004016107b590613479565b610bc78484848461194a565b60606114378261185b565b61149d5760405162461bcd60e51b815260206004820152603160248201527f45524337323155524953746f726167653a2055524920717565727920666f72206044820152703737b732bc34b9ba32b73a103a37b5b2b760791b60648201526084016107b5565b600082815260066020526040812080546114b69061343e565b80601f01602080910402602001604051908101604052809291908181526020018280546114e29061343e565b801561152f5780601f106115045761010080835404028352916020019161152f565b820191906000526020600020905b81548152906001019060200180831161151257829003601f168201915b5050505050905060006115406121e1565b9050805160001415611553575092915050565b81511561158557808260405160200161156d92919061364d565b60405160208183030381529060405292505050919050565b61158e846121f0565b949350505050565b6000828152600760205260409020600101546115b281336118e6565b6108eb8383611fc6565b6060600061160a6115ce6014546122ba565b6013546115e5906001600160a01b031660146123b8565b6040516020016115f692919061367c565b604051602081830303815290604052612554565b905060008160405160200161161f9190613703565b60408051601f198184030181529190529392505050565b6000805160206139ca83398151915261164f81336118e6565b600954611674906000805160206139ca833981519152906001600160a01b0316611fc6565b50600980546001600160a01b0319169055565b6008546001600160a01b03828116911614156116d95760405162461bcd60e51b815260206004820152601160248201527020b63932b0b23c903a34329037bbb732b960791b60448201526064016107b5565b6008546001600160a01b0316331461173d5760405162461bcd60e51b815260206004820152602160248201527f4f6e6c79206f776e65722063616e207472616e73666572206f776e65727368696044820152600760fc1b60648201526084016107b5565b600854611762906000805160206139ca833981519152906001600160a01b0316611fc6565b600880546001600160a01b038381166001600160a01b031983168117909355169061179c906000805160206139ca83398151915290611f40565b816001600160a01b0316816001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60009182526007602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60006001600160e01b031982166380ac58cd60e01b148061183c57506001600160e01b03198216635b5e139f60e01b145b806106b557506301ffc9a760e01b6001600160e01b03198316146106b5565b6000908152600260205260409020546001600160a01b0316151590565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906118ad82610efc565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6118f082826110d2565b610cf957611908816001600160a01b031660146123b8565b6119138360206123b8565b604051602001611924929190613748565b60408051601f198184030181529082905262461bcd60e51b82526107b591600401612ee7565b611955848484611a63565b611961848484846126ba565b610bc75760405162461bcd60e51b81526004016107b5906137bd565b60006119888261185b565b6119e95760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016107b5565b60006119f483610efc565b9050806001600160a01b0316846001600160a01b03161480611a2f5750836001600160a01b0316611a248461074d565b6001600160a01b0316145b8061158e57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff1661158e565b826001600160a01b0316611a7682610efc565b6001600160a01b031614611ada5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016107b5565b6001600160a01b038216611b3c5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016107b5565b611b478383836127c7565b611b52600082611878565b6001600160a01b0383166000908152600360205260408120805460019290611b7b90849061380f565b90915550506001600160a01b0382166000908152600360205260408120805460019290611ba9908490613826565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b805115611f3d57611c296000805160206139ca833981519152336110d2565b611c945760405162461bcd60e51b815260206004820152603660248201527f4772616e756c617220726f6c65733a206f6e6c792041444d494e5f524f4c452060448201527563616e206368616e6765207065726d697373696f6e7360501b60648201526084016107b5565b60005b8151811015610cf9576000828281518110611cb457611cb4613637565b6020026020010151600001519050611ccb8161287f565b611cd68260206123b8565b604051602001611ce6919061383e565b60405160208183030381529060405290611d135760405162461bcd60e51b81526004016107b59190612ee7565b506000818152600b602090815260409091205460ff161590611d369083906123b8565b604051602001611d469190613883565b60405160208183030381529060405290611d735760405162461bcd60e51b81526004016107b59190612ee7565b5060005b6000828152600a6020526040902054811015611ddf576000828152600a602052604090208054611dcd91849184908110611db357611db3613637565b6000918252602090912001546001600160a01b0316611fc6565b80611dd7816138d3565b915050611d77565b506000818152600a60205260408120611df791612d7b565b60005b838381518110611e0c57611e0c613637565b60200260200101516020015151811015611eec57611e6082858581518110611e3657611e36613637565b6020026020010151602001518381518110611e5357611e53613637565b6020026020010151611f40565b6000828152600a602052604090208451859085908110611e8257611e82613637565b6020026020010151602001518281518110611e9f57611e9f613637565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b0390921691909117905580611ee4816138d3565b915050611dfa565b50828281518110611eff57611eff613637565b60200260200101516040015115611f2a576000818152600b60205260409020805460ff191660011790555b5080611f35816138d3565b915050611c97565b50565b611f4a82826110d2565b610cf95760008281526007602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611f823390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611fd082826110d2565b15610cf95760008281526007602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6120368161294e565b6000818152600660205260409020805461204f9061343e565b159050611f3d576000818152600660205260408120611f3d91612d99565b610cf98282604051806020016040528060008152506129f5565b6120908261185b565b6120f35760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b60648201526084016107b5565b600082815260066020908152604090912082516108eb92840190612dd3565b816001600160a01b0316836001600160a01b031614156121745760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016107b5565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6060601280546106ca9061343e565b60606121fb8261185b565b61225f5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016107b5565b60006122696121e1565b9050600081511161228957604051806020016040528060008152506110fc565b80612293846122ba565b6040516020016122a492919061364d565b6040516020818303038152906040529392505050565b6060816122de5750506040805180820190915260018152600360fc1b602082015290565b8160005b811561230857806122f2816138d3565b91506123019050600a83613515565b91506122e2565b60008167ffffffffffffffff81111561232357612323612fb7565b6040519080825280601f01601f19166020018201604052801561234d576020820181803683370190505b5090505b841561158e5761236260018361380f565b915061236f600a866138ee565b61237a906030613826565b60f81b81838151811061238f5761238f613637565b60200101906001600160f81b031916908160001a9053506123b1600a86613515565b9450612351565b606060006123c78360026134e0565b6123d2906002613826565b67ffffffffffffffff8111156123ea576123ea612fb7565b6040519080825280601f01601f191660200182016040528015612414576020820181803683370190505b509050600360fc1b8160008151811061242f5761242f613637565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061245e5761245e613637565b60200101906001600160f81b031916908160001a90535060006124828460026134e0565b61248d906001613826565b90505b6001811115612505576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106124c1576124c1613637565b1a60f81b8282815181106124d7576124d7613637565b60200101906001600160f81b031916908160001a90535060049490941c936124fe81613902565b9050612490565b5083156110fc5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016107b5565b805160609080612574575050604080516020810190915260008152919050565b60006003612583836002613826565b61258d9190613515565b6125989060046134e0565b905060006125a7826020613826565b67ffffffffffffffff8111156125bf576125bf612fb7565b6040519080825280601f01601f1916602001820160405280156125e9576020820181803683370190505b509050600060405180606001604052806040815260200161398a604091399050600181016020830160005b86811015612675576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b835260049092019101612614565b50600386066001811461268f57600281146126a0576126ac565b613d3d60f01b6001198301526126ac565b603d60f81b6000198301525b505050918152949350505050565b60006001600160a01b0384163b156127bc57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906126fe903390899088908890600401613919565b602060405180830381600087803b15801561271857600080fd5b505af1925050508015612748575060408051601f3d908101601f1916820190925261274591810190613956565b60015b6127a2573d808015612776576040519150601f19603f3d011682016040523d82523d6000602084013e61277b565b606091505b50805161279a5760405162461bcd60e51b81526004016107b5906137bd565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061158e565b506001949350505050565b6001600160a01b0383166128225761281d81601080546000838152601160205260408120829055600182018355919091527f1b6847dc741a1b0cd08d278845f9d819d87b734759afb55fe2de5cb82a9ae6720155565b612845565b816001600160a01b0316836001600160a01b031614612845576128458382612a28565b6001600160a01b03821661285c576108eb81612ac5565b826001600160a01b0316826001600160a01b0316146108eb576108eb8282612b74565b60007f154c00819833dac601ee5ddded6fda79d9d8b506b911b3dbd54cdb95fe6c36868214806128ce57507f9b16859c0d694afa65b1b6551542db11ea12d6208b6a17dc922f10f2d74440f582145b806128f857507f852fd44a27d33057a8c3d90859d4e4c9f54309d4d66d1d968e063befba9198e682145b8061292257507fe97b137254058bd94f28d2f3eb79e2d34074ffb488d042e3bc958e0a57d2fa2282145b806106b55750507f8502233096d909befbda0999bb8ea2f3a6be3c138b9fbf003752a4c8bce86f6c1490565b600061295982610efc565b9050612967816000846127c7565b612972600083611878565b6001600160a01b038116600090815260036020526040812080546001929061299b90849061380f565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6129ff8383612bb8565b612a0c60008484846126ba565b6108eb5760405162461bcd60e51b81526004016107b5906137bd565b60006001612a3584611001565b612a3f919061380f565b6000838152600f6020526040902054909150808214612a92576001600160a01b0384166000908152600e602090815260408083208584528252808320548484528184208190558352600f90915290208190555b506000918252600f602090815260408084208490556001600160a01b039094168352600e81528383209183525290812055565b601054600090612ad79060019061380f565b60008381526011602052604081205460108054939450909284908110612aff57612aff613637565b906000526020600020015490508060108381548110612b2057612b20613637565b6000918252602080832090910192909255828152601190915260408082208490558582528120556010805480612b5857612b58613973565b6001900381819060005260206000200160009055905550505050565b6000612b7f83611001565b6001600160a01b039093166000908152600e602090815260408083208684528252808320859055938252600f9052919091209190915550565b6001600160a01b038216612c0e5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016107b5565b612c178161185b565b15612c645760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016107b5565b612c70600083836127c7565b6001600160a01b0382166000908152600360205260408120805460019290612c99908490613826565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054612d039061343e565b90600052602060002090601f016020900481019282612d255760008555612d6b565b82601f10612d3e5782800160ff19823516178555612d6b565b82800160010185558215612d6b579182015b82811115612d6b578235825591602001919060010190612d50565b50612d77929150612e47565b5090565b5080546000825590600052602060002090810190611f3d9190612e47565b508054612da59061343e565b6000825580601f10612db5575050565b601f016020900490600052602060002090810190611f3d9190612e47565b828054612ddf9061343e565b90600052602060002090601f016020900481019282612e015760008555612d6b565b82601f10612e1a57805160ff1916838001178555612d6b565b82800160010185558215612d6b579182015b82811115612d6b578251825591602001919060010190612e2c565b5b80821115612d775760008155600101612e48565b6001600160e01b031981168114611f3d57600080fd5b600060208284031215612e8457600080fd5b81356110fc81612e5c565b60005b83811015612eaa578181015183820152602001612e92565b83811115610bc75750506000910152565b60008151808452612ed3816020860160208601612e8f565b601f01601f19169290920160200192915050565b6020815260006110fc6020830184612ebb565b600060208284031215612f0c57600080fd5b5035919050565b80356001600160a01b0381168114612f2a57600080fd5b919050565b60008060408385031215612f4257600080fd5b612f4b83612f13565b946020939093013593505050565b600080600060608486031215612f6e57600080fd5b612f7784612f13565b9250612f8560208501612f13565b9150604084013590509250925092565b60008060408385031215612fa857600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b6040516060810167ffffffffffffffff81118282101715612ff057612ff0612fb7565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561301f5761301f612fb7565b604052919050565b600067ffffffffffffffff82111561304157613041612fb7565b5060051b60200190565b80358015158114612f2a57600080fd5b60008060006060848603121561307057600080fd5b67ffffffffffffffff808535111561308757600080fd5b60a0853586018703121561309a57600080fd5b84358501935080602086013511156130b157600080fd5b6020850135850186601f8201126130c757600080fd5b6130d96130d48235613027565b612ff6565b81358082526020808301929160051b8401018910156130f757600080fd5b602083015b6020843560051b8501018110156131ee57848135111561311b57600080fd5b803584016060818c03601f1901121561313357600080fd5b61313b612fcd565b60208201358152866040830135111561315357600080fd5b604082013582018c603f82011261316957600080fd5b6131796130d46020830135613027565b602082810135808352908201919060051b83016040018f81111561319c57600080fd5b6040840193505b808410156131c5576131b484612f13565b8352602093840193909201916131a3565b506020840152506131da90506060830161304b565b6040820152845250602092830192016130fc565b509450613201925050506040850161304b565b90509250925092565b6000806040838503121561321d57600080fd5b8235915061322d60208401612f13565b90509250929050565b60006020828403121561324857600080fd5b6110fc82612f13565b600067ffffffffffffffff83111561326b5761326b612fb7565b61327e601f8401601f1916602001612ff6565b905082815283838301111561329257600080fd5b828260208301376000602084830101529392505050565b600082601f8301126132ba57600080fd5b6110fc83833560208501613251565b6000806000606084860312156132de57600080fd5b6132e784612f13565b925060208401359150604084013567ffffffffffffffff81111561330a57600080fd5b613316868287016132a9565b9150509250925092565b6000806040838503121561333357600080fd5b61333c83612f13565b915061322d6020840161304b565b60008060006060848603121561335f57600080fd5b83359250602084013567ffffffffffffffff81111561337d57600080fd5b613389868287016132a9565b9250506132016040850161304b565b600080600080608085870312156133ae57600080fd5b6133b785612f13565b93506133c560208601612f13565b925060408501359150606085013567ffffffffffffffff8111156133e857600080fd5b8501601f810187136133f957600080fd5b61340887823560208401613251565b91505092959194509250565b6000806040838503121561342757600080fd5b61343083612f13565b915061322d60208401612f13565b600181811c9082168061345257607f821691505b6020821081141561347357634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156134fa576134fa6134ca565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613524576135246134ff565b500490565b600080835481600182811c91508083168061354557607f831692505b602080841082141561356557634e487b7160e01b86526022600452602486fd5b818015613579576001811461358a576135b7565b60ff198616895284890196506135b7565b60008a81526020902060005b868110156135af5781548b820152908501908301613596565b505084890196505b509498975050505050505050565b6000808335601e198436030181126135dc57600080fd5b83018035915067ffffffffffffffff8211156135f757600080fd5b602001915036819003821315610a0e57600080fd5b8183823760009101908152919050565b60006020828403121561362e57600080fd5b6110fc8261304b565b634e487b7160e01b600052603260045260246000fd5b6000835161365f818460208801612e8f565b835190830190613673818360208801612e8f565b01949350505050565b7f7b2273656c6c65725f6665655f62617369735f706f696e7473223a20000000008152600083516136b481601c850160208801612e8f565b731610113332b2afb932b1b4b834b2b73a111d101160611b601c9184019182015283516136e8816030840160208801612e8f565b61227d60f01b60309290910191820152603201949350505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161373b81601d850160208701612e8f565b91909101601d0192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613780816017850160208801612e8f565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516137b1816028840160208801612e8f565b01602801949350505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600082821015613821576138216134ca565b500390565b60008219821115613839576138396134ca565b500190565b7f4772616e756c6172526f6c65733a20696e76616c696420726f6c65200000000081526000825161387681601c850160208701612e8f565b91909101601c0192915050565b73023b930b73ab630b92937b632b99d103937b632960651b8152600082516138b2816014850160208701612e8f565b691034b990333937bd32b760b11b6014939091019283015250601e01919050565b60006000198214156138e7576138e76134ca565b5060010190565b6000826138fd576138fd6134ff565b500690565b600081613911576139116134ca565b506000190190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061394c90830184612ebb565b9695505050505050565b60006020828403121561396857600080fd5b81516110fc81612e5c565b634e487b7160e01b600052603160045260246000fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a2646970667358221220f9e2c6f492f02bf430c2fe5ab051921630dbc66bef8fb438dd9078ad5572d3a564736f6c63430008090033a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000e7d7696c8f11278124f39fb7cdd39fd9442d50260000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b43525950544f50554e4b530000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e7d7696c8f11278124f39fb7cdd39fd9442d502600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

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.