Contract 0x376f5039df4e9e9c864185d8fabad4f04a7e394a

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x15edb9d28351afcd88332fbd51ba925abde53765c489675a430b9ed8ecbe461dSet Approval For...197473822023-06-10 13:52:508 hrs 51 mins ago0xc9cfe89533b47b373106b7430c7c7b4535ee9311 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00022913
0xf3615cde376d06b75c938978bb52816eff45deb50a63f3511e6eb16fd052fe81Set Approval For...197322082023-06-09 16:48:141 day 5 hrs ago0x141d074299b38f9c7b7c1f094dbd48f1ec366723 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00114565
0xbfc741dff67f3c6db8618282938c8d8892ff49e4674c1e0d59967d21a107502dSet Approval For...197319912023-06-09 16:30:091 day 6 hrs ago0x31dcad30faafb5da1e47f3dff377f61f44806b24 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00114565
0xe6be6b710bb6842a12891903ad073a42922d64c97bae26c6dd47e6f18ff898a0Set Approval For...197316052023-06-09 15:57:591 day 6 hrs ago0x75369dd4b7be1721c8e849819afd036836a09f4c IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00114565
0x6c10304940adcebc8a7593d52c9a4a1627ba7f1f0c06ab34ccd01eb7a9d80970Set Approval For...197314082023-06-09 15:41:341 day 7 hrs ago0x56ba7baedcedf7fa677e1048ab2783aa88c172be IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00114565
0xc8654757f3a9cefa789e1edb34806c3a68f5c1ffbbf9daf8ef5ba6e22d3cbf09Set Approval For...197306402023-06-09 14:37:341 day 8 hrs ago0xfc7857fcadf861ea9bd6915de1eb2b3fafd8d212 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00012006
0x1940a595c10470f0183dbcb492ade2cad05d4a3ba1bf8b2c53a758d0e70e8086Set Approval For...197185042023-06-08 21:46:142 days 57 mins ago0xa928ed6cffe29b8698f0b61919631c1658d2a948 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.0014320625
0xf979a516fdd16b1f4ed51645e2c8e1deb7fa3f8d616d2e0ee19a39d8a4ba929aSet Approval For...197161382023-06-08 18:29:032 days 4 hrs ago0x6862a6893f515b9e9326725d06aa2d22c041a3e2 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00114565
0xd7bbf4d51673a368aefa036f1fea929c1e4f05905d4279033e6b3a15b75c253dSet Approval For...197112292023-06-08 11:39:562 days 11 hrs ago0x4e846e2ab6a8e2565ea073a5ee9839fcbfd927d1 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.0006003
0xe001f3b5aa5e3c193623f9967203abcf2200a0e24a3f614edb7c7f5baae47dccSet Approval For...196883702023-06-07 3:54:593 days 18 hrs ago0x8e1584c17c17560caedec901ea0738819a0933f4 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00114565
0x0206392b63a863816ac8324792927010d373ceafb5f9e682ddec1123b1a497e9Set Approval For...196835292023-06-06 21:11:344 days 1 hr ago0xd7b19e7bae81855038f951e02166f5019bebc56c IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00114535
0x45418e78580643423bf20c5bef29c097a61bb160959b18413f94eac51ab470c6Set Approval For...196456712023-06-04 16:36:406 days 6 hrs ago0xfdb4d92541c1a57a6338521d0d2ee8f3c8186357 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00114535
0xdf6a66720fb1b9e22364a09d483a5e89b6753519a3063b9dd068a91a40580fb4Set Approval For...196389052023-06-04 7:12:506 days 15 hrs ago0xbbfbd3bde85fd1bee8163751fc997cb3a41c2eac IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00114565
0x8b04178644085e1bc7e49bb130e6954b3d490be42445a515ccff640997e5365fSet Approval For...196249592023-06-03 11:50:407 days 10 hrs ago0x1111615a735ac3b3bf3a9ac75b673509500ac8e8 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00114565
0x82f3436789b2ed4a1659f7aac24ee094d1de1a93d0fe136dee484d4c125aa99cSet Approval For...195855252023-06-01 5:04:309 days 17 hrs ago0x41c4cd5b0503aea8a028ea511803ee95ee342088 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00114565
0xa8a8b6bee8cbb2ea4c5eb73c5170572d5aa11e592a1e513a63d85bdf8872bfa3Set Approval For...195735782023-05-31 12:28:5510 days 10 hrs ago0x41477a57a8916237a8ff512ba3d9bf487d9cbb79 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00114565
0x9d907e97329b1c4a1079dbe3d919082b6d383ea4e1d52f2958a5fa62de3c3109Set Approval For...195567342023-05-30 13:05:1211 days 9 hrs ago0xb679ab1272a0e977332f968e80bf2662a33b9be2 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.001259885
0x87c60672ae90bf1fd2c489ebd825684b6cfa1e3784295ae8b5095d2bd9204b4bTransfer From195423342023-05-29 17:05:1212 days 5 hrs ago0xcef933b21064f504f04773c8ac90d4c67fdb63a7 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.0019571
0xd3a77d2e004e462b3e86b0c859e997f171e1ae251063f5786468ad840655ea8dSet Approval For...195391352023-05-29 12:38:3712 days 10 hrs ago0x9fccf507e657ca12108be8edc7c27218cf941a91 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00114565
0x966214791675afd607ad70eef2ebf30d177cda1c82370f6d7105ac97a860f762Safe Transfer Fr...195338522023-05-29 5:18:2112 days 17 hrs ago0xa5c1c0a6f6bf5a1373d7e356e40430bf933dd2a7 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.000458439
0x394eecfcdfb8aac230b8f399adedeb850461e37610cebf78fe12d98b7df7e641Safe Transfer Fr...195338392023-05-29 5:17:1612 days 17 hrs ago0xa5c1c0a6f6bf5a1373d7e356e40430bf933dd2a7 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.0004059396
0x6b30900ea72d5b9ad17d503a0e90e443c192c71ab65e0562332430cc36d53d6eSet Approval For...195263942023-05-28 18:56:5113 days 3 hrs ago0x8ccd9b7b2d13f67fe96744e56d46bcc1b93bef5e IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00114535
0x406c303c5d63a09b26732c81d1e8e996c8bd153f87019e8573a0c8bc431636c9Transfer From195232352023-05-28 14:33:3613 days 8 hrs ago0x20167127dfa1d5e776ecabe7df3f8d0ac4b0ac23 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.0018546
0x084c590d1831d1a1db04dc138c8aed0d8011f438c4d93b39b17bc5139e69d87fSet Approval For...195231272023-05-28 14:24:3613 days 8 hrs ago0xe3d871d389bf78c091e29dece83200e9d6b2b0c2 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00114565
0xfc9f05a1194cfaf66485894f302932f5d3b4d3968d7c43c18a16967e2431b2baSet Approval For...195226252023-05-28 13:42:4613 days 9 hrs ago0x62166ab40e52c88d0b6481a8de1b4aec65478440 IN  0x376f5039df4e9e9c864185d8fabad4f04a7e394a0 CELO0.00114535
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SoulName

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion
File 1 of 26 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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);
        _;
    }

    /**
     * @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 `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " 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.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

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

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

        _revokeRole(role, account);
    }

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

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

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

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

File 2 of 26 : 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 26 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 4 of 26 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

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

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

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

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

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

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

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

        _transfer(from, to, tokenId);
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @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 _ownerOf(tokenId) != address(0);
    }

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

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

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

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

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

        // Check that tokenId was not minted by `_beforeTokenTransfer` hook
        require(!_exists(tokenId), "ERC721: token already minted");

        unchecked {
            // Will not overflow unless all 2**256 token ids are minted to the same owner.
            // Given that tokens are minted one by one, it is impossible in practice that
            // this ever happens. Might change if we allow batch minting.
            // The ERC fails to describe this case.
            _balances[to] += 1;
        }

        _owners[tokenId] = to;

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

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

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId, 1);

        // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
        owner = ERC721.ownerOf(tokenId);

        // Clear approvals
        delete _tokenApprovals[tokenId];

        unchecked {
            // Cannot overflow, as that would require more tokens to be burned/transferred
            // out than the owner initially received through minting and transferring in.
            _balances[owner] -= 1;
        }
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

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

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

        // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");

        // Clear approvals from the previous owner
        delete _tokenApprovals[tokenId];

        unchecked {
            // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
            // `from`'s balance is the number of token held, which is at least one before the current
            // transfer.
            // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
            // all 2**256 token ids to be minted, which in practice is impossible.
            _balances[from] -= 1;
            _balances[to] += 1;
        }
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId, 1);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {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 an {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

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

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

    /**
     * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
     * - When `from` is zero, the tokens will be minted for `to`.
     * - When `to` is zero, ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
     * - When `from` is zero, the tokens were minted for `to`.
     * - When `to` is zero, ``from``'s tokens were burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual {}

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant
     * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such
     * that `ownerOf(tokenId)` is `a`.
     */
    // solhint-disable-next-line func-name-mixedcase
    function __unsafe_increaseBalance(address account, uint256 amount) internal {
        _balances[account] += amount;
    }
}

File 6 of 26 : ERC721Burnable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Burnable.sol)

pragma solidity ^0.8.0;

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

/**
 * @title ERC721 Burnable Token
 * @dev ERC721 Token that can be burned (destroyed).
 */
abstract contract ERC721Burnable is Context, ERC721 {
    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
        _burn(tokenId);
    }
}

File 7 of 26 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (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 See {ERC721-_beforeTokenTransfer}.
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, firstTokenId, batchSize);

        if (batchSize > 1) {
            // Will only trigger during construction. Batch transferring (minting) is not available afterwards.
            revert("ERC721Enumerable: consecutive transfers not supported");
        }

        uint256 tokenId = firstTokenId;

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

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

pragma solidity ^0.8.0;

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

File 12 of 26 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 13 of 26 : 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 14 of 26 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

File 15 of 26 : 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 16 of 26 : 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 17 of 26 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

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

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

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

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

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

File 18 of 26 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 19 of 26 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @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] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

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

File 20 of 26 : ISoulboundIdentity.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "../tokens/SBT/ISBT.sol";

import "./ISoulName.sol";

interface ISoulboundIdentity is ISBT {
    function mint(address to) external returns (uint256);

    function mintIdentityWithName(
        address to,
        string memory name,
        uint256 yearsPeriod,
        string memory _tokenURI
    ) external returns (uint256);

    function getSoulName() external view returns (ISoulName);

    function tokenOfOwner(address owner) external view returns (uint256);
}

File 21 of 26 : ISoulName.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

interface ISoulName {
    function mint(
        address to,
        string memory name,
        uint256 yearsPeriod,
        string memory _tokenURI
    ) external returns (uint256);

    function getExtension() external view returns (string memory);

    function isAvailable(
        string memory name
    ) external view returns (bool available);

    function getTokenData(
        string memory name
    )
        external
        view
        returns (
            string memory sbtName,
            bool linked,
            uint256 identityId,
            uint256 tokenId,
            uint256 expirationDate,
            bool active
        );

    function getTokenId(string memory name) external view returns (uint256);

    function getSoulNames(
        address owner
    ) external view returns (string[] memory sbtNames);

    function getSoulNames(
        uint256 identityId
    ) external view returns (string[] memory sbtNames);
}

File 22 of 26 : Errors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

error AddressDoesNotHaveIdentity(address to);
error AlreadyAdded();
error AuthorityNotExists(address authority);
error CallerNotOwner(address caller);
error CallerNotReader(address caller);
error CreditScoreAlreadyCreated(address to);
error IdentityAlreadyCreated(address to);
error IdentityOwnerIsReader(uint256 readerIdentityId);
error InsufficientEthAmount(uint256 amount);
error IdentityOwnerNotTokenOwner(uint256 tokenId, uint256 ownerIdentityId);
error InvalidPaymentMethod(address paymentMethod);
error InvalidSignature();
error InvalidSignatureDate(uint256 signatureDate);
error InvalidToken(address token);
error InvalidTokenURI(string tokenURI);
error LinkAlreadyExists(
    address token,
    uint256 tokenId,
    uint256 readerIdentityId,
    uint256 signatureDate
);
error LinkAlreadyRevoked();
error LinkDoesNotExist();
error NameAlreadyExists(string name);
error NameNotFound(string name);
error NameRegisteredByOtherAccount(string name, uint256 tokenId);
error NotAuthorized(address signer);
error NonExistingErc20Token(address erc20token);
error NotLinkedToAnIdentitySBT();
error RefundFailed();
error SameValue();
error SBTAlreadyLinked(address token);
error SoulNameContractNotSet();
error TokenNotFound(uint256 tokenId);
error TransferFailed();
error URIAlreadyExists(string tokenURI);
error ValidPeriodExpired(uint256 expirationDate);
error ZeroAddress();
error ZeroLengthName(string name);
error ZeroYearsPeriod(uint256 yearsPeriod);

File 23 of 26 : Utils.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

/// @title Utilities library for Masa Contracts Identity repository
/// @author Masa Finance
/// @notice Library of utilities for Masa Contracts Identity repository
library Utils {
    struct slice {
        uint256 _len;
        uint256 _ptr;
    }

    function toLowerCase(
        string memory _str
    ) internal pure returns (string memory) {
        bytes memory bStr = bytes(_str);
        bytes memory bLower = new bytes(bStr.length);

        for (uint256 i = 0; i < bStr.length; i++) {
            // Uppercase character...
            if ((bStr[i] >= 0x41) && (bStr[i] <= 0x5A)) {
                // So we add 0x20 to make it lowercase
                bLower[i] = bytes1(uint8(bStr[i]) + 0x20);
            } else {
                bLower[i] = bStr[i];
            }
        }
        return string(bLower);
    }

    function toSlice(string memory self) private pure returns (slice memory) {
        uint256 ptr;
        assembly {
            ptr := add(self, 0x20)
        }
        return slice(bytes(self).length, ptr);
    }

    function startsWith(
        string memory str,
        string memory needle
    ) internal pure returns (bool) {
        slice memory s_str = toSlice(str);
        slice memory s_needle = toSlice(needle);

        if (s_str._len < s_needle._len) {
            return false;
        }

        if (s_str._ptr == s_needle._ptr) {
            return true;
        }

        bool equal;
        assembly {
            let length := mload(s_needle)
            let selfptr := mload(add(s_str, 0x20))
            let needleptr := mload(add(s_needle, 0x20))
            equal := eq(
                keccak256(selfptr, length),
                keccak256(needleptr, length)
            )
        }
        return equal;
    }
}

File 24 of 26 : SoulName.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";

import "./libraries/Errors.sol";
import "./libraries/Utils.sol";
import "./interfaces/ISoulboundIdentity.sol";
import "./interfaces/ISoulName.sol";
import "./tokens/MasaNFT.sol";

/// @title SoulName NFT
/// @author Masa Finance
/// @notice SoulName NFT that points to a Soulbound identity token
/// @dev SoulName NFT, that inherits from the NFT contract, and points to a Soulbound identity token.
/// It has an extension, and stores all the information about the identity names.
contract SoulName is MasaNFT, ISoulName, ReentrancyGuard {
    /* ========== STATE VARIABLES ========== */
    using SafeMath for uint256;

    uint256 constant YEAR = 31536000; // 60 seconds * 60 minutes * 24 hours * 365 days

    ISoulboundIdentity public soulboundIdentity;
    string public extension; // suffix of the names (.sol?)

    // contractURI() points to the smart contract metadata
    // see https://docs.opensea.io/docs/contract-level-metadata
    string public contractURI;

    // Optional mapping for token URIs
    mapping(uint256 => string) private _tokenURIs;
    mapping(string => bool) private _URIs; // used to check if a uri is already used

    mapping(uint256 => TokenData) public tokenData; // used to store the data of the token id
    mapping(string => NameData) public nameData; // stores the token id of the current active soul name

    struct TokenData {
        string name; // Name with lowercase and uppercase
        uint256 expirationDate;
    }

    struct NameData {
        bool exists;
        uint256 tokenId;
    }

    /* ========== INITIALIZE ========== */

    /// @notice Creates a new SoulName NFT
    /// @dev Creates a new SoulName NFT, that points to a Soulbound identity, inheriting from the NFT contract.
    /// @param admin Administrator of the smart contract
    /// @param name Name of the token
    /// @param symbol Symbol of the token
    /// @param _soulboundIdentity Address of the Soulbound identity contract
    /// @param _extension Extension of the soul name
    /// @param _contractURI URI of the smart contract metadata
    constructor(
        address admin,
        string memory name,
        string memory symbol,
        ISoulboundIdentity _soulboundIdentity,
        string memory _extension,
        string memory _contractURI
    ) MasaNFT(admin, name, symbol, "") {
        if (address(_soulboundIdentity) == address(0)) revert ZeroAddress();

        soulboundIdentity = _soulboundIdentity;
        extension = _extension;
        contractURI = _contractURI;
    }

    /* ========== RESTRICTED FUNCTIONS ====================================== */

    /// @notice Sets the SoulboundIdentity contract address linked to this soul name
    /// @dev The caller must have the admin role to call this function
    /// @param _soulboundIdentity Address of the SoulboundIdentity contract
    function setSoulboundIdentity(
        ISoulboundIdentity _soulboundIdentity
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        if (address(_soulboundIdentity) == address(0)) revert ZeroAddress();
        if (soulboundIdentity == _soulboundIdentity) revert SameValue();
        soulboundIdentity = _soulboundIdentity;
    }

    /// @notice Sets the extension of the soul name
    /// @dev The caller must have the admin role to call this function
    /// @param _extension Extension of the soul name
    function setExtension(
        string memory _extension
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        if (
            keccak256(abi.encodePacked((extension))) ==
            keccak256(abi.encodePacked((_extension)))
        ) revert SameValue();
        extension = _extension;
    }

    /// @notice Sets the URI of the smart contract metadata
    /// @dev The caller must have the admin role to call this function
    /// @param _contractURI URI of the smart contract metadata
    function setContractURI(
        string memory _contractURI
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        if (
            keccak256(abi.encodePacked((contractURI))) ==
            keccak256(abi.encodePacked((_contractURI)))
        ) revert SameValue();
        contractURI = _contractURI;
    }

    /* ========== MUTATIVE FUNCTIONS ========== */

    /// @notice Mints a new soul name
    /// @dev The caller can mint more than one name. The soul name must be unique.
    /// @param to Address of the owner of the new soul name
    /// @param name Name of the new soul name
    /// @param yearsPeriod Years of validity of the name
    /// @param _tokenURI URI of the NFT
    function mint(
        address to,
        string memory name,
        uint256 yearsPeriod,
        string memory _tokenURI
    ) public override nonReentrant returns (uint256) {
        if (!isAvailable(name)) revert NameAlreadyExists(name);
        if (bytes(name).length == 0) revert ZeroLengthName(name);
        if (yearsPeriod == 0) revert ZeroYearsPeriod(yearsPeriod);
        if (soulboundIdentity.balanceOf(to) == 0)
            revert AddressDoesNotHaveIdentity(to);
        if (
            !Utils.startsWith(_tokenURI, "ar://") &&
            !Utils.startsWith(_tokenURI, "https://arweave.net/") &&
            !Utils.startsWith(_tokenURI, "ipfs://")
        ) revert InvalidTokenURI(_tokenURI);

        uint256 tokenId = _mintWithCounter(to);
        _setTokenURI(tokenId, _tokenURI);

        tokenData[tokenId].name = name;
        tokenData[tokenId].expirationDate = block.timestamp.add(
            YEAR.mul(yearsPeriod)
        );

        string memory lowercaseName = Utils.toLowerCase(name);
        nameData[lowercaseName].tokenId = tokenId;
        nameData[lowercaseName].exists = true;

        return tokenId;
    }

    /// @notice Update the expiration date of a soul name
    /// @dev The caller must be the owner or an approved address of the soul name.
    /// @param tokenId TokenId of the soul name
    /// @param yearsPeriod Years of validity of the name
    function renewYearsPeriod(uint256 tokenId, uint256 yearsPeriod) external {
        // ERC721: caller is not token owner nor approved
        if (!_isApprovedOrOwner(_msgSender(), tokenId))
            revert CallerNotOwner(_msgSender());
        if (yearsPeriod == 0) revert ZeroYearsPeriod(yearsPeriod);

        // check that the last registered tokenId for that name is the current token
        string memory lowercaseName = Utils.toLowerCase(
            tokenData[tokenId].name
        );
        if (nameData[lowercaseName].tokenId != tokenId)
            revert NameRegisteredByOtherAccount(lowercaseName, tokenId);

        // check if the name is expired
        if (tokenData[tokenId].expirationDate < block.timestamp) {
            tokenData[tokenId].expirationDate = block.timestamp.add(
                YEAR.mul(yearsPeriod)
            );
        } else {
            tokenData[tokenId].expirationDate = tokenData[tokenId]
                .expirationDate
                .add(YEAR.mul(yearsPeriod));
        }

        emit YearsPeriodRenewed(
            tokenId,
            yearsPeriod,
            tokenData[tokenId].expirationDate
        );
    }

    /// @notice Burn a soul name
    /// @dev The caller must be the owner or an approved address of the soul name.
    /// @param tokenId TokenId of the soul name to burn
    function burn(uint256 tokenId) public override {
        if (!_exists(tokenId)) revert TokenNotFound(tokenId);

        string memory lowercaseName = Utils.toLowerCase(
            tokenData[tokenId].name
        );

        // remove info from tokenIdName and tokenData
        delete tokenData[tokenId];

        // if the last owner of the name is burning it, remove the name from nameData
        if (nameData[lowercaseName].tokenId == tokenId) {
            delete nameData[lowercaseName];
        }

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

        super.burn(tokenId);
    }

    /* ========== VIEWS ========== */

    /// @notice Returns the extension of the soul name
    /// @dev This function is used to get the extension of the soul name
    /// @return Extension of the soul name
    function getExtension() external view override returns (string memory) {
        return extension;
    }

    /// @notice Checks if a soul name is available
    /// @dev This function queries if a soul name already exists and is in the available state
    /// @param name Name of the soul name
    /// @return available `true` if the soul name is available, `false` otherwise
    function isAvailable(
        string memory name
    ) public view override returns (bool available) {
        string memory lowercaseName = Utils.toLowerCase(name);
        if (nameData[lowercaseName].exists) {
            uint256 tokenId = nameData[lowercaseName].tokenId;
            return tokenData[tokenId].expirationDate < block.timestamp;
        } else {
            return true;
        }
    }

    /// @notice Returns the information of a soul name
    /// @dev This function queries the information of a soul name
    /// @param name Name of the soul name
    /// @return sbtName Soul name, in upper/lower case and extension
    /// @return linked `true` if the soul name is linked, `false` otherwise
    /// @return identityId Identity id of the soul name
    /// @return tokenId SoulName id of the soul name
    /// @return expirationDate Expiration date of the soul name
    /// @return active `true` if the soul name is active, `false` otherwise
    function getTokenData(
        string memory name
    )
        external
        view
        override
        returns (
            string memory sbtName,
            bool linked,
            uint256 identityId,
            uint256 tokenId,
            uint256 expirationDate,
            bool active
        )
    {
        tokenId = _getTokenId(name);
        address _owner = ownerOf(tokenId);
        bool _linked = soulboundIdentity.balanceOf(_owner) > 0;
        uint256 _identityId = 0;
        if (_linked) {
            _identityId = soulboundIdentity.tokenOfOwner(_owner);
        }

        TokenData memory _tokenData = tokenData[tokenId];

        return (
            _getName(_tokenData.name),
            _linked,
            _identityId,
            tokenId,
            _tokenData.expirationDate,
            _tokenData.expirationDate >= block.timestamp
        );
    }

    /// @notice Returns the token id of a soul name
    /// @dev This function queries the token id of a soul name
    /// @param name Name of the soul name
    /// @return SoulName id of the soul name
    function getTokenId(
        string memory name
    ) external view override returns (uint256) {
        return _getTokenId(name);
    }

    /// @notice Returns all the active soul names of an account
    /// @dev This function queries all the identity names of the specified identity Id
    /// @param identityId TokenId of the identity
    /// @return sbtNames Array of soul names associated to the identity Id
    function getSoulNames(
        uint256 identityId
    ) external view override returns (string[] memory sbtNames) {
        // return owner if exists
        address _owner = soulboundIdentity.ownerOf(identityId);

        return getSoulNames(_owner);
    }

    /// @notice Returns all the active soul names of an account
    /// @dev This function queries all the identity names of the specified account
    /// @param owner Address of the owner of the identities
    /// @return sbtNames Array of soul names associated to the account
    function getSoulNames(
        address owner
    ) public view override returns (string[] memory sbtNames) {
        uint256 results = 0;
        uint256 balance = balanceOf(owner);

        for (uint256 i = 0; i < balance; i++) {
            uint256 tokenId = tokenOfOwnerByIndex(owner, i);
            if (tokenData[tokenId].expirationDate >= block.timestamp) {
                results = results.add(1);
            }
        }

        string[] memory _sbtNames = new string[](results);
        uint256 index = 0;

        for (uint256 i = 0; i < balance; i++) {
            uint256 tokenId = tokenOfOwnerByIndex(owner, i);
            if (tokenData[tokenId].expirationDate >= block.timestamp) {
                _sbtNames[index] = Utils.toLowerCase(tokenData[tokenId].name);
                index = index.add(1);
            }
        }

        // return identity names if exists and are active
        return _sbtNames;
    }

    /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
    /// @dev This function returns the token URI of the soul name specified by the name
    /// @param name Name of the soul name
    /// @return URI of the soulname associated to a name
    function tokenURI(
        string memory name
    ) external view virtual returns (string memory) {
        uint256 tokenId = _getTokenId(name);
        return tokenURI(tokenId);
    }

    /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
    /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC
    ///  3986. The URI may point to a JSON file that conforms to the "ERC721
    ///  Metadata JSON Schema".
    /// @param tokenId NFT to get the URI of
    /// @return URI of the NFT
    function tokenURI(
        uint256 tokenId
    ) public view virtual override returns (string memory) {
        _requireMinted(tokenId);

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

    /* ========== PRIVATE FUNCTIONS ========== */

    function _getName(string memory name) private view returns (string memory) {
        return string(bytes.concat(bytes(name), bytes(extension)));
    }

    function _getTokenId(string memory name) private view returns (uint256) {
        string memory lowercaseName = Utils.toLowerCase(name);
        if (!nameData[lowercaseName].exists) revert NameNotFound(name);

        return nameData[lowercaseName].tokenId;
    }

    function _setTokenURI(
        uint256 tokenId,
        string memory _tokenURI
    ) internal virtual {
        if (!_exists(tokenId)) revert TokenNotFound(tokenId);
        if (_URIs[_tokenURI]) revert URIAlreadyExists(_tokenURI);

        _tokenURIs[tokenId] = _tokenURI;
        _URIs[_tokenURI] = true;
    }

    /* ========== MODIFIERS ========== */

    /* ========== EVENTS ========== */

    event YearsPeriodRenewed(
        uint256 tokenId,
        uint256 yearsPeriod,
        uint256 newExpirationDate
    );
}

File 25 of 26 : MasaNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

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

/// @title MasaNFT
/// @author Masa Finance
/// @notice Non-fungible token is a token that is not fungible.
/// @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard,
/// that inherits from {ERC721Enumerable}, {Ownable}, {AccessControl} and {ERC721Burnable}.
abstract contract MasaNFT is
    ERC721,
    ERC721Enumerable,
    Ownable,
    AccessControl,
    ERC721Burnable
{
    /* ========== STATE VARIABLES =========================================== */

    using Strings for uint256;
    using Counters for Counters.Counter;

    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    Counters.Counter private _tokenIdCounter;

    string private _baseTokenURI;

    /* ========== INITIALIZE ================================================ */

    /// @notice Creates a new NFT
    /// @dev Creates a new Non-fungible token
    /// @param admin Administrator of the smart contract
    /// @param name Name of the token
    /// @param symbol Symbol of the token
    /// @param baseTokenURI Base URI of the token
    constructor(
        address admin,
        string memory name,
        string memory symbol,
        string memory baseTokenURI
    ) ERC721(name, symbol) {
        Ownable.transferOwnership(admin);
        _grantRole(DEFAULT_ADMIN_ROLE, admin);
        _grantRole(MINTER_ROLE, admin);

        _baseTokenURI = baseTokenURI;
    }

    /* ========== RESTRICTED FUNCTIONS ====================================== */

    function _mintWithCounter(
        address to
    ) internal onlyRole(MINTER_ROLE) returns (uint256) {
        uint256 tokenId = _tokenIdCounter.current();
        _tokenIdCounter.increment();
        _safeMint(to, tokenId);

        return tokenId;
    }

    /* ========== MUTATIVE FUNCTIONS ======================================== */

    /* ========== VIEWS ===================================================== */

    /// @notice Returns true if the token exists
    /// @dev Returns true if the token has been minted
    /// @param tokenId Token to check
    /// @return True if the token exists
    function exists(uint256 tokenId) external view returns (bool) {
        return _exists(tokenId);
    }

    /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
    /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC
    ///  3986. The URI may point to a JSON file that conforms to the "ERC721
    ///  Metadata JSON Schema".
    /// @param tokenId NFT to get the URI of
    /// @return URI of the NFT
    function tokenURI(
        uint256 tokenId
    ) public view virtual override returns (string memory) {
        _requireMinted(tokenId);

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

    /// @notice Query if a contract implements an interface
    /// @dev Interface identification is specified in ERC-165.
    /// @param interfaceId The interface identifier, as specified in ERC-165
    /// @return `true` if the contract implements `interfaceId` and
    ///  `interfaceId` is not 0xffffffff, `false` otherwise
    function supportsInterface(
        bytes4 interfaceId
    )
        public
        view
        virtual
        override(ERC721, ERC721Enumerable, AccessControl)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }

    /* ========== PRIVATE FUNCTIONS ========================================= */

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

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

    /* ========== MODIFIERS ================================================= */

    /* ========== EVENTS ==================================================== */
}

File 26 of 26 : ISBT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

interface ISBT is IERC165 {
    /// @dev This emits when an SBT is newly minted.
    ///  This event emits when SBTs are created
    event Mint(address indexed _owner, uint256 indexed _tokenId);

    /// @dev This emits when an SBT is burned
    ///  This event emits when SBTs are destroyed
    event Burn(address indexed _owner, uint256 indexed _tokenId);

    /// @notice Count all SBTs assigned to an owner
    /// @dev SBTs assigned to the zero address are considered invalid, and this
    ///  function throws for queries about the zero address.
    /// @param _owner An address for whom to query the balance
    /// @return The number of SBTs owned by `_owner`, possibly zero
    function balanceOf(address _owner) external view returns (uint256);

    /// @notice Find the owner of an SBT
    /// @dev SBTs assigned to zero address are considered invalid, and queries
    ///  about them do throw.
    /// @param _tokenId The identifier for an SBT
    /// @return The address of the owner of the SBT
    function ownerOf(uint256 _tokenId) external view returns (address);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1,
    "details": {
      "yul": false
    }
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"contract ISoulboundIdentity","name":"_soulboundIdentity","type":"address"},{"internalType":"string","name":"_extension","type":"string"},{"internalType":"string","name":"_contractURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"AddressDoesNotHaveIdentity","type":"error"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"CallerNotOwner","type":"error"},{"inputs":[{"internalType":"string","name":"tokenURI","type":"string"}],"name":"InvalidTokenURI","type":"error"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"NameAlreadyExists","type":"error"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"NameNotFound","type":"error"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"NameRegisteredByOtherAccount","type":"error"},{"inputs":[],"name":"SameValue","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenNotFound","type":"error"},{"inputs":[{"internalType":"string","name":"tokenURI","type":"string"}],"name":"URIAlreadyExists","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"ZeroLengthName","type":"error"},{"inputs":[{"internalType":"uint256","name":"yearsPeriod","type":"uint256"}],"name":"ZeroYearsPeriod","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"yearsPeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newExpirationDate","type":"uint256"}],"name":"YearsPeriodRenewed","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"extension","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getExtension","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"uint256","name":"identityId","type":"uint256"}],"name":"getSoulNames","outputs":[{"internalType":"string[]","name":"sbtNames","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getSoulNames","outputs":[{"internalType":"string[]","name":"sbtNames","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"getTokenData","outputs":[{"internalType":"string","name":"sbtName","type":"string"},{"internalType":"bool","name":"linked","type":"bool"},{"internalType":"uint256","name":"identityId","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"expirationDate","type":"uint256"},{"internalType":"bool","name":"active","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"getTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"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":[{"internalType":"string","name":"name","type":"string"}],"name":"isAvailable","outputs":[{"internalType":"bool","name":"available","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"yearsPeriod","type":"uint256"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"nameData","outputs":[{"internalType":"bool","name":"exists","type":"bool"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"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":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"yearsPeriod","type":"uint256"}],"name":"renewYearsPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_contractURI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_extension","type":"string"}],"name":"setExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISoulboundIdentity","name":"_soulboundIdentity","type":"address"}],"name":"setSoulboundIdentity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"soulboundIdentity","outputs":[{"internalType":"contract ISoulboundIdentity","name":"","type":"address"}],"stateMutability":"view","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":"uint256","name":"","type":"uint256"}],"name":"tokenData","outputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"expirationDate","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":"string","name":"name","type":"string"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620042ec380380620042ec83398101604081905262000034916200043d565b85858560405180602001604052806000815250828281600090805190602001906200006192919062000304565b5080516200007790600190602084019062000304565b505050620000946200008e6200017d60201b60201c565b62000181565b620000aa84620001d360201b620018441760201c565b620000b76000856200021d565b620000e37f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6856200021d565b8051620000f890600d90602084019062000304565b50506001600e555050506001600160a01b0383166200012a5760405163d92e233d60e01b815260040160405180910390fd5b600f80546001600160a01b0319166001600160a01b03851617905581516200015a90601090602085019062000304565b5080516200017090601190602084019062000304565b5050505050505062000727565b3390565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b620001dd620002a8565b6001600160a01b0381166200020f5760405162461bcd60e51b8152600401620002069062000545565b60405180910390fd5b6200021a8162000181565b50565b620002298282620002d7565b620002a4576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620002633390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600a546001600160a01b03163314620002d55760405162461bcd60e51b8152600401620002069062000590565b565b6000828152600b602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b82805462000312906200066c565b90600052602060002090601f01602090048101928262000336576000855562000381565b82601f106200035157805160ff191683800117855562000381565b8280016001018555821562000381579182015b828111156200038157825182559160200191906001019062000364565b506200038f92915062000393565b5090565b5b808211156200038f576000815560010162000394565b6000620003c1620003bb84620005ea565b620005cb565b905082815260208101848484011115620003de57620003de600080fd5b620003eb84828562000639565b509392505050565b8051620002fe8162000705565b8051620002fe816200071c565b600082601f830112620004235762000423600080fd5b815162000435848260208601620003aa565b949350505050565b60008060008060008060c087890312156200045b576200045b600080fd5b6000620004698989620003f3565b96505060208701516001600160401b038111156200048a576200048a600080fd5b6200049889828a016200040d565b95505060408701516001600160401b03811115620004b957620004b9600080fd5b620004c789828a016200040d565b9450506060620004da89828a0162000400565b93505060808701516001600160401b03811115620004fb57620004fb600080fd5b6200050989828a016200040d565b92505060a08701516001600160401b038111156200052a576200052a600080fd5b6200053889828a016200040d565b9150509295509295509295565b60208082528101620002fe81602681527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160208201526564647265737360d01b604082015260600190565b60208082528181019081527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604083015260608201620002fe565b6000620005d760405190565b9050620005e582826200069d565b919050565b60006001600160401b03821115620006065762000606620006e5565b6200061182620006fb565b60200192915050565b60006001600160a01b038216620002fe565b6000620002fe826200061a565b60005b83811015620006565781810151838201526020016200063c565b8381111562000666576000848401525b50505050565b6002810460018216806200068157607f821691505b60208210811415620006975762000697620006cf565b50919050565b620006a882620006fb565b81018181106001600160401b0382111715620006c857620006c8620006e5565b6040525050565b634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b601f01601f191690565b62000710816200061a565b81146200021a57600080fd5b62000710816200062c565b613bb580620007376000396000f3fe608060405234801561001057600080fd5b506004361061020f5760003560e01c806301ffc9a71461021457806306fdde031461023d578063081812fc14610252578063095ea7b31461027257806318160ddd146102875780631e7663bc1461029857806323b872dd146102ab578063248a9ca3146102be5780632d5537b0146102d15780632f2ff15d146102d95780632f745c59146102ec57806336568abe146102ff5780633ad3033e146103125780633dd904301461032557806342842e0e1461033857806342966c681461034b57806346b2b0871461035e5780634cf12d26146103835780634f558e79146103965780634f6ccce7146103a95780636352211e146103bc57806370a08231146103cf578063715018a6146103e2578063776ce6a1146103ea57806377bed5ed146103f25780637e2285aa146104125780637e669891146104255780638da5cb5b1461044557806391d148541461044d578063938e3d7b1461046057806395d89b4114610473578063965306aa1461047b578063a217fddf1461048e578063a22cb46514610496578063b4b5b48f146104a9578063b79636b6146104ca578063b88d4fde146104dd578063bdf29a85146104f0578063c87b56dd14610536578063d539139314610549578063d547741f1461055e578063e8a3d48514610571578063e985e9c514610579578063ebfcbee11461058c578063f2fde38b1461059f575b600080fd5b610227610222366004612e93565b6105b2565b60405161023491906136c4565b60405180910390f35b6102456105c3565b6040516102349190613709565b610265610260366004612e50565b610655565b6040516102349190613661565b610285610280366004612e1d565b61067c565b005b6008545b60405161023491906136ed565b61028b6102a6366004612ef6565b61070b565b6102856102b9366004612ccc565b610716565b61028b6102cc366004612e50565b610748565b61024561075d565b6102856102e7366004612e71565b6107eb565b61028b6102fa366004612e1d565b610807565b61028561030d366004612e71565b610859565b610285610320366004612ed5565b61088f565b61028b610333366004612dcd565b610913565b610285610346366004612ccc565b610bba565b610285610359366004612e50565b610bd5565b61037161036c366004612ef6565b610d99565b6040516102349695949392919061371a565b610245610391366004612ef6565b610fad565b6102276103a4366004612e50565b610fcc565b61028b6103b7366004612e50565b610fd7565b6102656103ca366004612e50565b611025565b61028b6103dd366004612c4d565b611059565b61028561109d565b6102456110b1565b600f54610405906001600160a01b031681565b60405161023491906136fb565b610285610420366004612ef6565b6110c0565b610438610433366004612e50565b61114c565b60405161023491906136b3565b6102656111dd565b61022761045b366004612e71565b6111ec565b61028561046e366004612ef6565b611217565b6102456112a3565b610227610489366004612ef6565b6112b2565b61028b600081565b6102856104a4366004612d9a565b61133f565b6104bc6104b7366004612e50565b61134a565b604051610234929190613779565b6104386104d8366004612c4d565b6113ee565b6102856104eb366004612d1c565b61153c565b6105286104fe366004612ef6565b80516020818301810180516015825292820191909301209152805460019091015460ff9091169082565b6040516102349291906136d2565b610245610544366004612e50565b611575565b61028b600080516020613b4083398151915281565b61028561056c366004612e71565b611671565b61024561168d565b610227610587366004612c8f565b61169a565b61028561059a366004612f51565b6116c8565b6102856105ad366004612c4d565b611844565b60006105bd8261187e565b92915050565b6060600080546105d290613a1d565b80601f01602080910402602001604051908101604052809291908181526020018280546105fe90613a1d565b801561064b5780601f106106205761010080835404028352916020019161064b565b820191906000526020600020905b81548152906001019060200180831161062e57829003601f168201915b5050505050905090565b6000610660826118a3565b506000908152600460205260409020546001600160a01b031690565b600061068782611025565b9050806001600160a01b0316836001600160a01b031614156106c45760405162461bcd60e51b81526004016106bb90613869565b60405180910390fd5b336001600160a01b03821614806106e057506106e0813361169a565b6106fc5760405162461bcd60e51b81526004016106bb90613879565b61070683836118c8565b505050565b60006105bd82611936565b610721335b826119b0565b61073d5760405162461bcd60e51b81526004016106bb906137a9565b610706838383611a0e565b6000908152600b602052604090206001015490565b6010805461076a90613a1d565b80601f016020809104026020016040519081016040528092919081815260200182805461079690613a1d565b80156107e35780601f106107b8576101008083540402835291602001916107e3565b820191906000526020600020905b8154815290600101906020018083116107c657829003601f168201915b505050505081565b6107f482610748565b6107fd81611b31565b6107068383611b3b565b600061081283611059565b82106108305760405162461bcd60e51b81526004016106bb906137b9565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6001600160a01b03811633146108815760405162461bcd60e51b81526004016106bb906138b9565b61088b8282611bc1565b5050565b600061089a81611b31565b6001600160a01b0382166108c15760405163d92e233d60e01b815260040160405180910390fd5b600f546001600160a01b03838116911614156108f05760405163c23f6ccb60e01b815260040160405180910390fd5b50600f80546001600160a01b0319166001600160a01b0392909216919091179055565b600061091d611c28565b610926846112b2565b61094557836040516309463f9760e31b81526004016106bb9190613709565b8351610966578360405163234371eb60e21b81526004016106bb9190613709565b8261098657826040516372eab4d960e01b81526004016106bb91906136ed565b600f546040516370a0823160e01b81526001600160a01b03909116906370a08231906109b6908890600401613661565b60206040518083038186803b1580156109ce57600080fd5b505afa1580156109e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a069190612f30565b610a25578460405163678391f160e01b81526004016106bb9190613661565b610a4c826040518060400160405280600581526020016461723a2f2f60d81b815250611c52565b158015610a8c5750610a8a826040518060400160405280601481526020017368747470733a2f2f617277656176652e6e65742f60601b815250611c52565b155b8015610abe5750610abc8260405180604001604052806007815260200166697066733a2f2f60c81b815250611c52565b155b15610ade5781604051639bc1a52f60e01b81526004016106bb9190613709565b6000610ae986611cb8565b9050610af58184611cf7565b60008181526014602090815260409091208651610b1492880190612ac9565b50610b2d610b266301e1338086611db8565b4290611dc4565b600082815260146020526040812060010191909155610b4b86611dd0565b905081601582604051610b5e91906135b5565b9081526020016040518091039020600101819055506001601582604051610b8591906135b5565b908152604051908190036020019020805491151560ff19909216919091179055509050610bb26001600e55565b949350505050565b6107068383836040518060200160405280600081525061153c565b610bde81611f46565b610bfd57806040516306caeb1360e41b81526004016106bb91906136ed565b60008181526014602052604081208054610c9e9190610c1b90613a1d565b80601f0160208091040260200160405190810160405280929190818152602001828054610c4790613a1d565b8015610c945780601f10610c6957610100808354040283529160200191610c94565b820191906000526020600020905b815481529060010190602001808311610c7757829003601f168201915b5050505050611dd0565b6000838152601460205260408120919250610cb98282612b4d565b6001820160009055505081601582604051610cd491906135b5565b9081526020016040518091039020600101541415610d1c57601581604051610cfc91906135b5565b908152604051908190036020019020805460ff1916815560006001909101555b60008281526012602052604090208054610d3590613a1d565b159050610d90576000828152601260205260408082209051601391610d5991613607565b9081526040805160209281900383019020805460ff19169315159390931790925560008481526012909152908120610d9091612b4d565b61088b82611f63565b60606000806000806000610dac87611936565b92506000610db984611025565b600f546040516370a0823160e01b815291925060009182916001600160a01b0316906370a0823190610def908690600401613661565b60206040518083038186803b158015610e0757600080fd5b505afa158015610e1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3f9190612f30565b11905060008115610ecd57600f5460405163294cdf0d60e01b81526001600160a01b039091169063294cdf0d90610e7a908690600401613661565b60206040518083038186803b158015610e9257600080fd5b505afa158015610ea6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eca9190612f30565b90505b6000868152601460205260408082208151808301909252805482908290610ef390613a1d565b80601f0160208091040260200160405190810160405280929190818152602001828054610f1f90613a1d565b8015610f6c5780601f10610f4157610100808354040283529160200191610f6c565b820191906000526020600020905b815481529060010190602001808311610f4f57829003601f168201915b505050505081526020016001820154815250509050610f8e8160000151611f91565b6020909101519099509197509550925050504281101591939550919395565b60606000610fba83611936565b9050610fc581611575565b9392505050565b60006105bd82611f46565b6000610fe260085490565b82106110005760405162461bcd60e51b81526004016106bb90613889565b6008828154811061101357611013613ace565b90600052602060002001549050919050565b60008061103183611fbd565b90506001600160a01b0381166105bd5760405162461bcd60e51b81526004016106bb90613859565b60006001600160a01b0382166110815760405162461bcd60e51b81526004016106bb90613829565b506001600160a01b031660009081526003602052604090205490565b6110a5611fd8565b6110af6000612007565b565b6060601080546105d290613a1d565b60006110cb81611b31565b816040516020016110dc91906135b5565b6040516020818303038152906040528051906020012060106040516020016111049190613607565b6040516020818303038152906040528051906020012014156111395760405163c23f6ccb60e01b815260040160405180910390fd5b8151610706906010906020850190612ac9565b600f546040516331a9108f60e11b81526060916000916001600160a01b0390911690636352211e906111829086906004016136ed565b60206040518083038186803b15801561119a57600080fd5b505afa1580156111ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d29190612c6e565b9050610fc5816113ee565b600a546001600160a01b031690565b6000918252600b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600061122281611b31565b8160405160200161123391906135b5565b60405160208183030381529060405280519060200120601160405160200161125b9190613607565b6040516020818303038152906040528051906020012014156112905760405163c23f6ccb60e01b815260040160405180910390fd5b8151610706906011906020850190612ac9565b6060600180546105d290613a1d565b6000806112be83611dd0565b90506015816040516112d091906135b5565b9081526040519081900360200190205460ff16156113305760006015826040516112fa91906135b5565b90815260200160405180910390206001015490504260146000838152602001908152602001600020600101541092505050919050565b50600192915050565b50919050565b61088b338383612059565b60146020526000908152604090208054819061136590613a1d565b80601f016020809104026020016040519081016040528092919081815260200182805461139190613a1d565b80156113de5780601f106113b3576101008083540402835291602001916113de565b820191906000526020600020905b8154815290600101906020018083116113c157829003601f168201915b5050505050908060010154905082565b60606000806113fc84611059565b905060005b818110156114515760006114158683610807565b600081815260146020526040902060010154909150421161143e5761143b846001611dc4565b93505b508061144981613a71565b915050611401565b506000826001600160401b0381111561146c5761146c613ae4565b60405190808252806020026020018201604052801561149f57816020015b606081526020019060019003908161148a5790505b5090506000805b838110156115315760006114ba8883610807565b600081815260146020526040902060010154909150421161151e57600081815260146020526040902080546114f39190610c1b90613a1d565b84848151811061150557611505613ace565b602090810291909101015261151b836001611dc4565b92505b508061152981613a71565b9150506114a6565b509095945050505050565b611547335b836119b0565b6115635760405162461bcd60e51b81526004016106bb906137a9565b61156f848484846120fc565b50505050565b6060611580826118a3565b6000828152601260205260408120805461159990613a1d565b80601f01602080910402602001604051908101604052809291908181526020018280546115c590613a1d565b80156116125780601f106115e757610100808354040283529160200191611612565b820191906000526020600020905b8154815290600101906020018083116115f557829003601f168201915b50505050509050600061162361212f565b9050805160001415611636575092915050565b8151156116685780826040516020016116509291906135c1565b60405160208183030381529060405292505050919050565b610bb28461213e565b61167a82610748565b61168381611b31565b6107068383611bc1565b6011805461076a90613a1d565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6116d133611541565b6116f0573360405163060296c760e31b81526004016106bb9190613661565b8061171057806040516372eab4d960e01b81526004016106bb91906136ed565b6000828152601460205260408120805461172e9190610c1b90613a1d565b90508260158260405161174191906135b5565b908152602001604051809103902060010154146117755780836040516309a3b96f60e21b81526004016106bb929190613779565b6000838152601460205260409020600101544211156117b65761179f610b266301e1338084611db8565b6000848152601460205260409020600101556117f2565b6117df6117c76301e1338084611db8565b60008581526014602052604090206001015490611dc4565b6000848152601460205260409020600101555b600083815260146020526040908190206001015490517f88ef5d91ad01b04046836022a7aade9038eb1188da66972705cc01ae3d49f0839161183791869186916138c9565b60405180910390a1505050565b61184c611fd8565b6001600160a01b0381166118725760405162461bcd60e51b81526004016106bb906137d9565b61187b81612007565b50565b60006001600160e01b03198216637965db0b60e01b14806105bd57506105bd826121a4565b6118ac81611f46565b61187b5760405162461bcd60e51b81526004016106bb90613859565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906118fd82611025565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061194283611dd0565b905060158160405161195491906135b5565b9081526040519081900360200190205460ff166119865782604051636de04b9f60e01b81526004016106bb9190613709565b60158160405161199691906135b5565b908152602001604051809103902060010154915050919050565b6000806119bc83611025565b9050806001600160a01b0316846001600160a01b031614806119e357506119e3818561169a565b80610bb25750836001600160a01b03166119fc84610655565b6001600160a01b031614949350505050565b826001600160a01b0316611a2182611025565b6001600160a01b031614611a475760405162461bcd60e51b81526004016106bb906137e9565b6001600160a01b038216611a6d5760405162461bcd60e51b81526004016106bb90613809565b611a7a83838360016121c9565b826001600160a01b0316611a8d82611025565b6001600160a01b031614611ab35760405162461bcd60e51b81526004016106bb906137e9565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b038781168086526003855283862080546000190190559087168086528386208054600101905586865260029094528285208054909216841790915590518493600080516020613b6083398151915291a4505050565b61187b81336121d5565b611b4582826111ec565b61088b576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611b7d3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611bcb82826111ec565b1561088b576000828152600b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6002600e541415611c4b5760405162461bcd60e51b81526004016106bb906138a9565b6002600e55565b600080611c5e8461222e565b90506000611c6b8461222e565b805183519192501115611c83576000925050506105bd565b806020015182602001511415611c9e576001925050506105bd565b805160209283015192909101518190209120149392505050565b6000600080516020613b40833981519152611cd281611b31565b6000611cdd600c5490565b9050611ced600c80546001019055565b610fc5848261225b565b611d0082611f46565b611d1f57816040516306caeb1360e41b81526004016106bb91906136ed565b601381604051611d2f91906135b5565b9081526040519081900360200190205460ff1615611d62578060405163f62081bb60e01b81526004016106bb9190613709565b60008281526012602090815260409091208251611d8192840190612ac9565b506001601382604051611d9491906135b5565b908152604051908190036020019020805491151560ff199092169190911790555050565b6000610fc58284613971565b6000610fc58284613938565b60606000829050600081516001600160401b03811115611df257611df2613ae4565b6040519080825280601f01601f191660200182016040528015611e1c576020820181803683370190505b50905060005b8251811015611f3e57604160f81b838281518110611e4257611e42613ace565b01602001516001600160f81b03191610801590611e835750605a60f81b838281518110611e7157611e71613ace565b01602001516001600160f81b03191611155b15611ee557828181518110611e9a57611e9a613ace565b602001015160f81c60f81b60f81c6020611eb49190613950565b60f81b828281518110611ec957611ec9613ace565b60200101906001600160f81b031916908160001a905350611f2c565b828181518110611ef757611ef7613ace565b602001015160f81c60f81b828281518110611f1457611f14613ace565b60200101906001600160f81b031916908160001a9053505b80611f3681613a71565b915050611e22565b509392505050565b600080611f5283611fbd565b6001600160a01b0316141592915050565b611f6c3361071b565b611f885760405162461bcd60e51b81526004016106bb906137a9565b61187b81612275565b6060816010604051602001611fa792919061359d565b6040516020818303038152906040529050919050565b6000908152600260205260409020546001600160a01b031690565b33611fe16111dd565b6001600160a01b0316146110af5760405162461bcd60e51b81526004016106bb90613849565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316141561208b5760405162461bcd60e51b81526004016106bb90613819565b6001600160a01b0383811660008181526005602090815260408083209487168084529490915290819020805460ff1916851515179055517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31906120ef9085906136c4565b60405180910390a3505050565b612107848484611a0e565b61211384848484612306565b61156f5760405162461bcd60e51b81526004016106bb906137c9565b6060600d80546105d290613a1d565b6060612149826118a3565b600061215361212f565b905060008151116121735760405180602001604052806000815250610fc5565b8061217d84612410565b60405160200161218e9291906135d9565b6040516020818303038152906040529392505050565b60006001600160e01b0319821663780e9d6360e01b14806105bd57506105bd826124a4565b61156f848484846124f4565b6121df82826111ec565b61088b576121ec816125da565b6121f78360206125ec565b604051602001612208929190613613565b60408051601f198184030181529082905262461bcd60e51b82526106bb91600401613709565b60408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b61088b828260405180602001604052806000815250612757565b600061228082611025565b90506122908160008460016121c9565b61229982611025565b600083815260046020908152604080832080546001600160a01b03199081169091556001600160a01b038516808552600384528285208054600019019055878552600290935281842080549091169055519293508492600080516020613b60833981519152908390a45050565b60006001600160a01b0384163b1561240857604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061234a90339089908890889060040161366f565b602060405180830381600087803b15801561236457600080fd5b505af1925050508015612394575060408051601f3d908101601f1916820190925261239191810190612eb4565b60015b6123ee573d8080156123c2576040519150601f19603f3d011682016040523d82523d6000602084013e6123c7565b606091505b5080516123e65760405162461bcd60e51b81526004016106bb906137c9565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610bb2565b506001610bb2565b6060600061241d8361278a565b60010190506000816001600160401b0381111561243c5761243c613ae4565b6040519080825280601f01601f191660200182016040528015612466576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461249f57611f3e565b612470565b60006001600160e01b031982166380ac58cd60e01b14806124d557506001600160e01b03198216635b5e139f60e01b145b806105bd57506301ffc9a760e01b6001600160e01b03198316146105bd565b60018111156125155760405162461bcd60e51b81526004016106bb90613899565b816001600160a01b0385166125715761256c81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b612594565b836001600160a01b0316856001600160a01b031614612594576125948582612860565b6001600160a01b0384166125b0576125ab816128fd565b6125d3565b846001600160a01b0316846001600160a01b0316146125d3576125d384826129ac565b5050505050565b60606105bd6001600160a01b03831660145b606060006125fb836002613971565b612606906002613938565b6001600160401b0381111561261d5761261d613ae4565b6040519080825280601f01601f191660200182016040528015612647576020820181803683370190505b509050600360fc1b8160008151811061266257612662613ace565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061269157612691613ace565b60200101906001600160f81b031916908160001a90535060006126b5846002613971565b6126c0906001613938565b90505b6001811115612738576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106126f4576126f4613ace565b1a60f81b82828151811061270a5761270a613ace565b60200101906001600160f81b031916908160001a90535060049490941c9361273181613a06565b90506126c3565b508315610fc55760405162461bcd60e51b81526004016106bb90613799565b61276183836129f0565b61276e6000848484612306565b6107065760405162461bcd60e51b81526004016106bb906137c9565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106127c95772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6904ee2d6d415b85acef8160201b83106127f3576904ee2d6d415b85acef8160201b830492506020015b662386f26fc10000831061281157662386f26fc10000830492506010015b6305f5e1008310612829576305f5e100830492506008015b612710831061283d57612710830492506004015b6064831061284f576064830492506002015b600a83106105bd5760010192915050565b6000600161286d84611059565b6128779190613990565b6000838152600760205260409020549091508082146128ca576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061290f90600190613990565b6000838152600960205260408120546008805493945090928490811061293757612937613ace565b90600052602060002001549050806008838154811061295857612958613ace565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061299057612990613ab8565b6001900381819060005260206000200160009055905550505050565b60006129b783611059565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b038216612a165760405162461bcd60e51b81526004016106bb90613839565b612a1f81611f46565b15612a3c5760405162461bcd60e51b81526004016106bb906137f9565b612a4a6000838360016121c9565b612a5381611f46565b15612a705760405162461bcd60e51b81526004016106bb906137f9565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b031916841790555183929190600080516020613b60833981519152908290a45050565b828054612ad590613a1d565b90600052602060002090601f016020900481019282612af75760008555612b3d565b82601f10612b1057805160ff1916838001178555612b3d565b82800160010185558215612b3d579182015b82811115612b3d578251825591602001919060010190612b22565b50612b49929150612b83565b5090565b508054612b5990613a1d565b6000825580601f10612b69575050565b601f01602090049060005260206000209081019061187b91905b5b80821115612b495760008155600101612b84565b6000612bab612ba68461390d565b6138f1565b905082815260208101848484011115612bc657612bc6600080fd5b611f3e8482856139ce565b80356105bd81613b04565b80516105bd81613b04565b80356105bd81613b18565b80356105bd81613b20565b80356105bd81613b26565b80516105bd81613b26565b600082601f830112612c2757612c27600080fd5b8135610bb2848260208601612b98565b80356105bd81613b36565b80516105bd81613b20565b600060208284031215612c6257612c62600080fd5b6000610bb28484612bd1565b600060208284031215612c8357612c83600080fd5b6000610bb28484612bdc565b60008060408385031215612ca557612ca5600080fd5b6000612cb18585612bd1565b9250506020612cc285828601612bd1565b9150509250929050565b600080600060608486031215612ce457612ce4600080fd5b6000612cf08686612bd1565b9350506020612d0186828701612bd1565b9250506040612d1286828701612bf2565b9150509250925092565b60008060008060808587031215612d3557612d35600080fd5b6000612d418787612bd1565b9450506020612d5287828801612bd1565b9350506040612d6387828801612bf2565b92505060608501356001600160401b03811115612d8257612d82600080fd5b612d8e87828801612c13565b91505092959194509250565b60008060408385031215612db057612db0600080fd5b6000612dbc8585612bd1565b9250506020612cc285828601612be7565b60008060008060808587031215612de657612de6600080fd5b6000612df28787612bd1565b94505060208501356001600160401b03811115612e1157612e11600080fd5b612d5287828801612c13565b60008060408385031215612e3357612e33600080fd5b6000612e3f8585612bd1565b9250506020612cc285828601612bf2565b600060208284031215612e6557612e65600080fd5b6000610bb28484612bf2565b60008060408385031215612e8757612e87600080fd5b6000612cb18585612bf2565b600060208284031215612ea857612ea8600080fd5b6000610bb28484612bfd565b600060208284031215612ec957612ec9600080fd5b6000610bb28484612c08565b600060208284031215612eea57612eea600080fd5b6000610bb28484612c37565b600060208284031215612f0b57612f0b600080fd5b81356001600160401b03811115612f2457612f24600080fd5b610bb284828501612c13565b600060208284031215612f4557612f45600080fd5b6000610bb28484612c42565b60008060408385031215612f6757612f67600080fd5b6000612e3f8585612bf2565b6000610fc58383613002565b612f88816139a7565b82525050565b6000612f98825190565b80845260208401935083602082028501612fb28560200190565b8060005b85811015612fe75784840389528151612fcf8582612f73565b94506020830160209a909a0199925050600101612fb6565b5091979650505050505050565b801515612f88565b80612f88565b600061300c825190565b8084526020840193506130238185602086016139da565b61302c81613afa565b9093019392505050565b6000613040825190565b61304e8185602086016139da565b9290920192915050565b6000815461306581613a1d565b60018216801561307c576001811461308d576130bd565b60ff198316865281860193506130bd565b60008581526020902060005b838110156130b557815488820152600190910190602001613099565b838801955050505b50505092915050565b612f88816139c3565b60208082527f537472696e67733a20686578206c656e67746820696e73756666696369656e74910190815260005b5060200190565b602d81526000602082017f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6581526c1c881bdc88185c1c1c9bdd9959609a1b602082015291505b5060400190565b602b81526000602082017f455243373231456e756d657261626c653a206f776e657220696e646578206f7581526a74206f6620626f756e647360a81b6020820152915061314a565b603281526000602082017f4552433732313a207472616e7366657220746f206e6f6e20455243373231526581527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6020820152915061314a565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b6020820152915061314a565b602581526000602082017f4552433732313a207472616e736665722066726f6d20696e636f72726563742081526437bbb732b960d91b6020820152915061314a565b601c81526000602082017b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b815291506130fd565b602481526000602082017f4552433732313a207472616e7366657220746f20746865207a65726f206164648152637265737360e01b6020820152915061314a565b601981526000602082017822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b815291506130fd565b602981526000602082017f4552433732313a2061646472657373207a65726f206973206e6f7420612076618152683634b21037bbb732b960b91b6020820152915061314a565b60208082527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373910190815260006130fd565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572910190815260006130fd565b6018815260006020820177115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b815291506130fd565b602181526000602082017f4552433732313a20617070726f76616c20746f2063757272656e74206f776e658152603960f91b6020820152915061314a565b603d81526000602082017f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f81527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006020820152915061314a565b602c81526000602082017f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f81526b7574206f6620626f756e647360a01b6020820152915061314a565b603581526000602082017f455243373231456e756d657261626c653a20636f6e7365637574697665207472815274185b9cd9995c9cc81b9bdd081cdd5c1c1bdc9d1959605a1b6020820152915061314a565b601f81526000602082017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00815291506130fd565b602f81526000602082017f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636581526e103937b632b9903337b91039b2b63360891b6020820152915061314a565b60006135a98285613036565b9150610bb28284613058565b6000610fc58284613036565b60006135cd8285613036565b9150610bb28284613036565b60006135e58285613036565b91506135f18284613036565b64173539b7b760d91b8152915060058201610bb2565b6000610fc58284613058565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152601701600061363f8285613036565b7001034b99036b4b9b9b4b733903937b6329607d1b81529150601182016135cd565b602081016105bd8284612f7f565b6080810161367d8287612f7f565b61368a6020830186612f7f565b6136976040830185612ffc565b81810360608301526136a98184613002565b9695505050505050565b60208082528101610fc58184612f8e565b602081016105bd8284612ff4565b604081016136e08285612ff4565b610fc56020830184612ffc565b602081016105bd8284612ffc565b602081016105bd82846130c6565b60208082528101610fc58184613002565b60c0808252810161372b8189613002565b905061373a6020830188612ff4565b6137476040830187612ffc565b6137546060830186612ffc565b6137616080830185612ffc565b61376e60a0830184612ff4565b979650505050505050565b6040808252810161378a8185613002565b9050610fc56020830184612ffc565b602080825281016105bd816130cf565b602080825281016105bd81613104565b602080825281016105bd81613151565b602080825281016105bd81613199565b602080825281016105bd816131e8565b602080825281016105bd8161322b565b602080825281016105bd8161326d565b602080825281016105bd816132a0565b602080825281016105bd816132e1565b602080825281016105bd81613311565b602080825281016105bd81613357565b602080825281016105bd81613389565b602080825281016105bd816133bb565b602080825281016105bd816133ea565b602080825281016105bd81613428565b602080825281016105bd81613482565b602080825281016105bd816134cb565b602080825281016105bd8161351d565b602080825281016105bd81613551565b606081016138d78286612ffc565b6138e46020830185612ffc565b610bb26040830184612ffc565b60006138fc60405190565b90506139088282613a44565b919050565b60006001600160401b0382111561392657613926613ae4565b61392f82613afa565b60200192915050565b6000821982111561394b5761394b613a8c565b500190565b600060ff8216915060ff831692508260ff0382111561394b5761394b613a8c565b600081600019048311821515161561398b5761398b613a8c565b500290565b6000828210156139a2576139a2613a8c565b500390565b60006001600160a01b0382166105bd565b60006105bd826139a7565b60006105bd826139b8565b82818337506000910152565b60005b838110156139f55781810151838201526020016139dd565b8381111561156f5750506000910152565b600081613a1557613a15613a8c565b506000190190565b600281046001821680613a3157607f821691505b6020821081141561133957611339613aa2565b613a4d82613afa565b81018181106001600160401b0382111715613a6a57613a6a613ae4565b6040525050565b6000600019821415613a8557613a85613a8c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b601f01601f191690565b613b0d816139a7565b811461187b57600080fd5b801515613b0d565b80613b0d565b6001600160e01b03198116613b0d565b613b0d816139b856fe9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220cd770d5146971edba8ec26524883c427086054d445f7c78cfc8ffb9520800d9164736f6c6343000807003300000000000000000000000048e2042bf980e12b5c50ea78d38042517df0d90c00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000836198f984431ecdc97a7549c1bd6b3cd9e7a89b00000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000001043656c6f20446f6d61696e204e616d6500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000343444e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000052e63656c6f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003061723a2f2f764654463363707234722d6f71427065496c706430567047552d38417a4753324151714e676e445857414d00000000000000000000000000000000

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

00000000000000000000000048e2042bf980e12b5c50ea78d38042517df0d90c00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000836198f984431ecdc97a7549c1bd6b3cd9e7a89b00000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000001043656c6f20446f6d61696e204e616d6500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000343444e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000052e63656c6f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003061723a2f2f764654463363707234722d6f71427065496c706430567047552d38417a4753324151714e676e445857414d00000000000000000000000000000000

-----Decoded View---------------
Arg [0] : admin (address): 0x48e2042bf980e12b5c50ea78d38042517df0d90c
Arg [1] : name (string): Celo Domain Name
Arg [2] : symbol (string): CDN
Arg [3] : _soulboundIdentity (address): 0x836198f984431ecdc97a7549c1bd6b3cd9e7a89b
Arg [4] : _extension (string): .celo
Arg [5] : _contractURI (string): ar://vFTF3cpr4r-oqBpeIlpd0VpGU-8AzGS2AQqNgnDXWAM

-----Encoded View---------------
15 Constructor Arguments found :
Arg [0] : 00000000000000000000000048e2042bf980e12b5c50ea78d38042517df0d90c
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [3] : 000000000000000000000000836198f984431ecdc97a7549c1bd6b3cd9e7a89b
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000010
Arg [7] : 43656c6f20446f6d61696e204e616d6500000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [9] : 43444e0000000000000000000000000000000000000000000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [11] : 2e63656c6f000000000000000000000000000000000000000000000000000000
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000030
Arg [13] : 61723a2f2f764654463363707234722d6f71427065496c706430567047552d38
Arg [14] : 417a4753324151714e676e445857414d00000000000000000000000000000000


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