Contract 0xDc7E49f44690EDd8eF52C5Dd4d6EE8028E4EA949

Contract Overview

Balance:
0 MATIC
Txn Hash
Method
Block
From
To
Value [Txn Fee]
0xe6ace9b9d8e73a593485c4dacf78e534db2aac78057437ca61138bb724d64f5b0x60806040333009802023-03-19 9:47:348 days 13 hrs ago0xb43fafdeec73925c116a3b46e118cf79e885c8ee IN  Create: EnsSubdomainFactory0 MATIC0.0315085721885.82000002
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
EnsSubdomainFactory

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 19 : 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 2 of 19 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 3 of 19 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 4 of 19 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 5 of 19 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: 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 {
        if (batchSize > 1) {
            if (from != address(0)) {
                _balances[from] -= batchSize;
            }
            if (to != address(0)) {
                _balances[to] += batchSize;
            }
        }
    }

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

File 6 of 19 : 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 7 of 19 : 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 8 of 19 : 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 9 of 19 : 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 10 of 19 : 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 11 of 19 : 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 12 of 19 : 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 13 of 19 : 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 14 of 19 : 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 15 of 19 : 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 16 of 19 : 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 17 of 19 : ENSRegistry.sol
pragma solidity ^0.8.16;

/**
 * @title EnsRegistry
 * @dev Extract of the interface for ENS Registry
 */
interface IEnsRegistry {
	function setOwner(bytes32 node, address owner) external;
	function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external;
	function setResolver(bytes32 node, address resolver) external;
	function owner(bytes32 node) external view returns (address);
	function resolver(bytes32 node) external view returns (address);
}

/**
 * @title EnsRegistry
 */
contract EnsRegistry is IEnsRegistry {
	mapping(bytes32 => address) public owners;
	mapping(bytes32 => address) public resolvers;

	function setOwner(bytes32 _node, address _owner) public {
		owners[_node] = _owner;
	}

	function setSubnodeOwner(bytes32 _node, bytes32 _label, address _owner) public {
		owners[keccak256(abi.encodePacked(_node, _label))] = _owner;
	}

	function setResolver(bytes32 _node, address _resolver) public {
		resolvers[_node] = _resolver;
	}

	function owner(bytes32 _node) public view returns (address){
		return owners[_node];
	}

	function resolver(bytes32 _node) public view returns (address){
		return resolvers[_node];
	}
}

File 18 of 19 : ENSResolver.sol
pragma solidity ^0.8.16;

/**
 * @title EnsResolver
 * @dev Extract of the interface for ENS Resolver
 */
interface IEnsResolver {
	function setAddr(bytes32 node, address addr) external;
	function addr(bytes32 node) external view returns (address);
}

/**
 * @title EnsResolver
 */
contract EnsResolver is IEnsResolver {
	mapping(bytes32 => address) public targets;

	function setAddr(bytes32 _node, address _addr) public {
		targets[_node] = _addr;
	}

	function addr(bytes32 _node) public view returns (address) {
		return targets[_node];
	}
}

File 19 of 19 : ENSSubdomainFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

import "./ENSRegistry.sol";
import "./ENSResolver.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

// ---------------------------------------------------------------------------------------------------
// EnsSubdomainFactory - allows creating and configuring custom ENS subdomains with one contract call.
//
// @author Radek Ostrowski / https://startonchain.com - MIT Licence.
// Source: https://github.com/radek1st/ens-subdomain-factory
// ---------------------------------------------------------------------------------------------------

/**
 * @title EnsSubdomainFactory
 * @dev Allows to create and configure a subdomain for Ethereum ENS in one call.
 * After deploying this contract, change the owner of the domain you want to use
 * to this deployed contract address. For example, transfer the ownership of "startonchain.eth"
 * so anyone can create subdomains like "radek.startonchain.eth".
 */
contract EnsSubdomainFactory is ERC721 {
    using SafeMath for uint256;

    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;
    address public owner;
    EnsRegistry public registry;
    EnsResolver public resolver;
    bool public locked;
    bytes32 public emptyNamehash = 0x00;

    uint256 public YEAR = 365 days;

    struct NFTDomain {
        uint256 tokenId;
        string domainName;
        address currentOwner;
        uint256 createdAt;
        uint256 expiredAt;
    }

    uint256 public pricePerYear = 0.1 ether;

    mapping(uint256 => NFTDomain) public domainInfo;
    mapping(address=>uint256[]) public ownedDomains;

    event SubdomainCreated(
        address indexed creator,
        address indexed owner,
        string subdomain,
        string domain,
        string topdomain
    );
    event OwnershipTransferred(
        address indexed previousOwner,
        address indexed newOwner
    );
    event RegistryUpdated(
        address indexed previousRegistry,
        address indexed newRegistry
    );
    event ResolverUpdated(
        address indexed previousResolver,
        address indexed newResolver
    );
    event DomainTransfersLocked();

    constructor(EnsRegistry _registry, EnsResolver _resolver) ERC721("XEN ID","XEN") {
        owner = msg.sender;
        registry = _registry;
        resolver = _resolver;
        locked = false;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     *
     */
    modifier onlyOwner() {
        require(msg.sender == owner, "Not Owner");
        _;
    }


    /**
     * @dev Allows to create a subdomain (e.g. "radek.startonchain.eth"),
     * set its resolver and set its target address
     * @param _subdomain - sub domain name only e.g. "radek"
     * @param _owner - address that will become owner of this new subdomain
     * @param _target - address that this new domain will resolve to
     */
    function newSubdomain(
        string calldata _subdomain,
        address _owner,
        address _target
    ) private {
        //create namehash for the topdomain
        bytes32 topdomainNamehash = keccak256(
            abi.encodePacked(
                emptyNamehash,
                keccak256(abi.encodePacked("xen"))
            )
        );
        //create namehash for the domain
        bytes32 domainNamehash = keccak256(
            abi.encodePacked(
                topdomainNamehash,
                keccak256(abi.encodePacked("xendomains"))
            )
        );
        //make sure this contract owns the domain
        if(registry.owner(domainNamehash)==address(0)){
            registry.setOwner(domainNamehash,address(this));
        }

        require(
            registry.owner(domainNamehash) == address(this),
            "this contract should own the domain"
        );

        //create labelhash for the sub domain
        bytes32 subdomainLabelhash = keccak256(abi.encodePacked(_subdomain));
        //create namehash for the sub domain
        bytes32 subdomainNamehash = keccak256(
            abi.encodePacked(domainNamehash, subdomainLabelhash)
        );
        //make sure it is free or owned by the sender
        require(
            registry.owner(subdomainNamehash) == address(0) ||
                registry.owner(subdomainNamehash) == msg.sender,
            "sub domain already owned"
        );
        //create new subdomain, temporarily this smartcontract is the owner
        registry.setSubnodeOwner(
            domainNamehash,
            subdomainLabelhash,
            address(this)
        );
        //set public resolver for this domain
        registry.setResolver(subdomainNamehash, address(resolver));
        //set the destination address
        resolver.setAddr(subdomainNamehash, _target);
        //change the ownership back to requested owner
        registry.setOwner(subdomainNamehash, _owner);


        emit SubdomainCreated(
            msg.sender,
            _owner,
            _subdomain,
            "xendomains",
            "xen"
        );
    }

    /**
     * @dev Returns the owner of a domain (e.g. "startonchain.eth"),
     * @param _domain - domain name e.g. "startonchain"
     * @param _topdomain - parent domain name e.g. "eth" or "xyz"
     */
    function domainOwner(string calldata _domain, string calldata _topdomain)
        public
        view
        returns (address)
    {
        bytes32 topdomainNamehash = keccak256(
            abi.encodePacked(
                emptyNamehash,
                keccak256(abi.encodePacked(_topdomain))
            )
        );
        bytes32 namehash = keccak256(
            abi.encodePacked(
                topdomainNamehash,
                keccak256(abi.encodePacked(_domain))
            )
        );
        return registry.owner(namehash);
    }

    /**
     * @dev Return the owner of a subdomain (e.g. "radek.startonchain.eth"),
     * @param _subdomain - sub domain name only e.g. "radek"
     * @param _domain - parent domain name e.g. "startonchain"
     * @param _topdomain - parent domain name e.g. "eth", "xyz"
     */
    function subdomainOwner(
        string calldata _subdomain,
        string calldata _domain,
        string calldata _topdomain
    ) public view returns (address) {
        bytes32 topdomainNamehash = keccak256(
            abi.encodePacked(
                emptyNamehash,
                keccak256(abi.encodePacked(_topdomain))
            )
        );
        bytes32 domainNamehash = keccak256(
            abi.encodePacked(
                topdomainNamehash,
                keccak256(abi.encodePacked(_domain))
            )
        );
        bytes32 subdomainNamehash = keccak256(
            abi.encodePacked(
                domainNamehash,
                keccak256(abi.encodePacked(_subdomain))
            )
        );
        return registry.owner(subdomainNamehash);
    }

    /**
     * @dev Return the target address where the subdomain is pointing to (e.g. "0x12345..."),
     * @param _subdomain - sub domain name only e.g. "radek"
     * @param _domain - parent domain name e.g. "startonchain"
     * @param _topdomain - parent domain name e.g. "eth", "xyz"
     */
    function subdomainTarget(
        string calldata _subdomain,
        string calldata _domain,
        string calldata _topdomain
    ) public view returns (address) {
        bytes32 topdomainNamehash = keccak256(
            abi.encodePacked(
                emptyNamehash,
                keccak256(abi.encodePacked(_topdomain))
            )
        );
        bytes32 domainNamehash = keccak256(
            abi.encodePacked(
                topdomainNamehash,
                keccak256(abi.encodePacked(_domain))
            )
        );
        bytes32 subdomainNamehash = keccak256(
            abi.encodePacked(
                domainNamehash,
                keccak256(abi.encodePacked(_subdomain))
            )
        );
        address currentResolver = registry.resolver(subdomainNamehash);
        return EnsResolver(currentResolver).addr(subdomainNamehash);
    }

    /**
     * @dev The contract owner can take away the ownership of any domain owned by this contract.
     * @param _node - namehash of the domain
     * @param _owner - new owner for the domain
     */
    function transferDomainOwnership(bytes32 _node, address _owner)
        public
        onlyOwner
    {
        require(!locked);
        registry.setOwner(_node, _owner);
    }

    /**
     * @dev The contract owner can lock and prevent any future domain ownership transfers.
     */
    function lockDomainOwnershipTransfers() public onlyOwner {
        require(!locked);
        locked = true;
        emit DomainTransfersLocked();
    }

    /**
     * @dev Allows to update to new ENS registry.
     * @param _registry The address of new ENS registry to use.
     */
    function updateRegistry(EnsRegistry _registry) public onlyOwner {
        require(
            registry != _registry,
            "new registry should be different from old"
        );
        emit RegistryUpdated(address(registry), address(_registry));
        registry = _registry;
    }

    /**
     * @dev Allows to update to new ENS resolver.
     * @param _resolver The address of new ENS resolver to use.
     */
    function updateResolver(EnsResolver _resolver) public onlyOwner {
        require(
            resolver != _resolver,
            "new resolver should be different from old"
        );
        emit ResolverUpdated(address(resolver), address(_resolver));
        resolver = _resolver;
    }

    /**
     * @dev Allows the current owner to transfer control of the contract to a new owner.
     * @param _owner The address to transfer ownership to.
     */
    function transferContractOwnership(address _owner) public onlyOwner {
        require(_owner != address(0), "cannot transfer to address(0)");
        emit OwnershipTransferred(owner, _owner);
        owner = _owner;
    }

    function mintDomain(string calldata domainName, uint256 expiredYears)
        public
        payable
    {
        require(msg.sender != address(0), " ");
        require(expiredYears > 0, " Must be greater then 0_1");
        require(
            msg.value >= expiredYears.mul(pricePerYear),
            " Must be greater than 0_2"
        );

        _tokenIds.increment();
        NFTDomain memory newDomain = NFTDomain({
            tokenId: _tokenIds.current(),
            domainName: domainName,
            currentOwner: msg.sender,
            createdAt: block.timestamp,
            expiredAt: block.timestamp.add(expiredYears.mul(365 days))
        });
        domainInfo[_tokenIds.current()] = newDomain;
        ownedDomains[msg.sender].push(_tokenIds.current());
        _mint(msg.sender, _tokenIds.current());
        
        newSubdomain(domainName,msg.sender,msg.sender);
    }

    function transferNFTDomain(uint256 tokenId, address transferTo)
        public
        payable
    {
        require(msg.sender != address(0), " ");
        require(
            domainInfo[tokenId].currentOwner == msg.sender,
            "Only Owner can transfer"
        );
        require(transferTo != address(0), " ");
        require(
            domainInfo[tokenId].currentOwner != transferTo,
            "Cannot Trasnfered"
        );
        require(
            domainInfo[tokenId].expiredAt > block.timestamp,
            "Domain Expired"
        );
		require(msg.value>0,"");
        

        NFTDomain memory nftDomain = domainInfo[tokenId];
        ownedDomains[transferTo].push(tokenId);
        nftDomain.currentOwner = transferTo;
        _transfer(transferTo, msg.sender, tokenId);
    }

	function extendDuration(uint256 tokenId, uint256 _years) public payable {
     require(msg.sender != address(0), " ");
        require(
            domainInfo[tokenId].currentOwner == msg.sender,
            "Only Owner can Extend"
        );
        
     require(_years > 0, " Must be greater then 0");
        require(
            msg.value >= YEAR.mul(pricePerYear),
            " Must be greater than 0"
        );		
     NFTDomain memory nftDomain = domainInfo[tokenId];
     uint256 expiredYears=nftDomain.expiredAt.add(_years.mul(365 days));
     nftDomain.expiredAt = expiredYears ;
	}

}

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

Contract ABI

[{"inputs":[{"internalType":"contract EnsRegistry","name":"_registry","type":"address"},{"internalType":"contract EnsResolver","name":"_resolver","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[],"name":"DomainTransfersLocked","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":"address","name":"previousRegistry","type":"address"},{"indexed":true,"internalType":"address","name":"newRegistry","type":"address"}],"name":"RegistryUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousResolver","type":"address"},{"indexed":true,"internalType":"address","name":"newResolver","type":"address"}],"name":"ResolverUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creator","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"string","name":"subdomain","type":"string"},{"indexed":false,"internalType":"string","name":"domain","type":"string"},{"indexed":false,"internalType":"string","name":"topdomain","type":"string"}],"name":"SubdomainCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"YEAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"","type":"uint256"}],"name":"domainInfo","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"domainName","type":"string"},{"internalType":"address","name":"currentOwner","type":"address"},{"internalType":"uint256","name":"createdAt","type":"uint256"},{"internalType":"uint256","name":"expiredAt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_domain","type":"string"},{"internalType":"string","name":"_topdomain","type":"string"}],"name":"domainOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emptyNamehash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"_years","type":"uint256"}],"name":"extendDuration","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockDomainOwnershipTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"locked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"domainName","type":"string"},{"internalType":"uint256","name":"expiredYears","type":"uint256"}],"name":"mintDomain","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"ownedDomains","outputs":[{"internalType":"uint256","name":"","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":[],"name":"pricePerYear","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"contract EnsRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"resolver","outputs":[{"internalType":"contract EnsResolver","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_subdomain","type":"string"},{"internalType":"string","name":"_domain","type":"string"},{"internalType":"string","name":"_topdomain","type":"string"}],"name":"subdomainOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_subdomain","type":"string"},{"internalType":"string","name":"_domain","type":"string"},{"internalType":"string","name":"_topdomain","type":"string"}],"name":"subdomainTarget","outputs":[{"internalType":"address","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":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"transferContractOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_node","type":"bytes32"},{"internalType":"address","name":"_owner","type":"address"}],"name":"transferDomainOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"transferTo","type":"address"}],"name":"transferNFTDomain","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract EnsRegistry","name":"_registry","type":"address"}],"name":"updateRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract EnsResolver","name":"_resolver","type":"address"}],"name":"updateResolver","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040526000801b600a556301e13380600b5567016345785d8a0000600c553480156200002c57600080fd5b50604051620064573803806200645783398181016040528101906200005291906200028d565b6040518060400160405280600681526020017f58454e20494400000000000000000000000000000000000000000000000000008152506040518060400160405280600381526020017f58454e00000000000000000000000000000000000000000000000000000000008152508160009081620000cf91906200054e565b508060019081620000e191906200054e565b50505033600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600960146101000a81548160ff021916908315150217905550505062000635565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620001fc82620001cf565b9050919050565b60006200021082620001ef565b9050919050565b620002228162000203565b81146200022e57600080fd5b50565b600081519050620002428162000217565b92915050565b60006200025582620001ef565b9050919050565b620002678162000248565b81146200027357600080fd5b50565b60008151905062000287816200025c565b92915050565b60008060408385031215620002a757620002a6620001ca565b5b6000620002b78582860162000231565b9250506020620002ca8582860162000276565b9150509250929050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200035657607f821691505b6020821081036200036c576200036b6200030e565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620003d67fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000397565b620003e2868362000397565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006200042f620004296200042384620003fa565b62000404565b620003fa565b9050919050565b6000819050919050565b6200044b836200040e565b620004636200045a8262000436565b848454620003a4565b825550505050565b600090565b6200047a6200046b565b6200048781848462000440565b505050565b5b81811015620004af57620004a360008262000470565b6001810190506200048d565b5050565b601f821115620004fe57620004c88162000372565b620004d38462000387565b81016020851015620004e3578190505b620004fb620004f28562000387565b8301826200048c565b50505b505050565b600082821c905092915050565b6000620005236000198460080262000503565b1980831691505092915050565b60006200053e838362000510565b9150826002028217905092915050565b6200055982620002d4565b67ffffffffffffffff811115620005755762000574620002df565b5b6200058182546200033d565b6200058e828285620004b3565b600060209050601f831160018114620005c65760008415620005b1578287015190505b620005bd858262000530565b8655506200062d565b601f198416620005d68662000372565b60005b828110156200060057848901518255600182019150602085019450602081019050620005d9565b868310156200062057848901516200061c601f89168262000510565b8355505b6001600288020188555050505b505050505050565b615e1280620006456000396000f3fe6080604052600436106101ee5760003560e01c8063839145401161010d578063b4e439ff116100a0578063cf3090121161006f578063cf3090121461072c578063d6605fd814610757578063e2357d5414610773578063e6fe39ed1461078f578063e985e9c5146107b8576101ee565b8063b4e439ff1461065a578063b88d4fde1461069b578063bc7dbb22146106c4578063c87b56dd146106ef576101ee565b806395d89b41116100dc57806395d89b41146105b2578063a22cb465146105dd578063a843c51f14610606578063ae0848e41461062f576101ee565b8063839145401461050357806385dc8cff1461052e5780638da5cb5b1461054a578063946091ce14610575576101ee565b806323b872dd116101855780636616766311610154578063661676631461044757806370a08231146104845780637b103999146104c15780637dd45999146104ec576101ee565b806323b872dd1461037b57806342842e0e146103a457806357014fee146103cd5780636352211e1461040a576101ee565b8063095ea7b3116101c1578063095ea7b3146102c35780630ab4c065146102ec5780631a5da6c8146103295780631dc9a3b914610352576101ee565b806301ffc9a7146101f357806304f3bcec1461023057806306fdde031461025b578063081812fc14610286575b600080fd5b3480156101ff57600080fd5b5061021a60048036038101906102159190613ef6565b6107f5565b6040516102279190613f3e565b60405180910390f35b34801561023c57600080fd5b506102456108d7565b6040516102529190613fd8565b60405180910390f35b34801561026757600080fd5b506102706108fd565b60405161027d9190614083565b60405180910390f35b34801561029257600080fd5b506102ad60048036038101906102a891906140db565b61098f565b6040516102ba9190614129565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190614170565b6109d5565b005b3480156102f857600080fd5b50610313600480360381019061030e9190614215565b610aec565b6040516103209190614129565b60405180910390f35b34801561033557600080fd5b50610350600480360381019061034b9190614307565b610c99565b005b34801561035e57600080fd5b506103796004803603810190610374919061436a565b610e79565b005b34801561038757600080fd5b506103a2600480360381019061039d91906143aa565b610fb6565b005b3480156103b057600080fd5b506103cb60048036038101906103c691906143aa565b611016565b005b3480156103d957600080fd5b506103f460048036038101906103ef91906143fd565b611036565b6040516104019190614129565b60405180910390f35b34801561041657600080fd5b50610431600480360381019061042c91906140db565b61118b565b60405161043e9190614129565b60405180910390f35b34801561045357600080fd5b5061046e60048036038101906104699190614215565b611211565b60405161047b9190614129565b60405180910390f35b34801561049057600080fd5b506104ab60048036038101906104a6919061447e565b61143d565b6040516104b891906144ba565b60405180910390f35b3480156104cd57600080fd5b506104d66114f4565b6040516104e391906144f6565b60405180910390f35b3480156104f857600080fd5b5061050161151a565b005b34801561050f57600080fd5b5061051861160d565b60405161052591906144ba565b60405180910390f35b61054860048036038101906105439190614511565b611613565b005b34801561055657600080fd5b5061055f611aaa565b60405161056c9190614129565b60405180910390f35b34801561058157600080fd5b5061059c60048036038101906105979190614170565b611ad0565b6040516105a991906144ba565b60405180910390f35b3480156105be57600080fd5b506105c7611b01565b6040516105d49190614083565b60405180910390f35b3480156105e957600080fd5b5061060460048036038101906105ff919061457d565b611b93565b005b34801561061257600080fd5b5061062d6004803603810190610628919061447e565b611ba9565b005b34801561063b57600080fd5b50610644611d68565b60405161065191906144ba565b60405180910390f35b34801561066657600080fd5b50610681600480360381019061067c91906140db565b611d6e565b6040516106929594939291906145bd565b60405180910390f35b3480156106a757600080fd5b506106c260048036038101906106bd9190614747565b611e4c565b005b3480156106d057600080fd5b506106d9611eae565b6040516106e691906147d9565b60405180910390f35b3480156106fb57600080fd5b50610716600480360381019061071191906140db565b611eb4565b6040516107239190614083565b60405180910390f35b34801561073857600080fd5b50610741611f1c565b60405161074e9190613f3e565b60405180910390f35b610771600480360381019061076c91906147f4565b611f2f565b005b61078d60048036038101906107889190614834565b612247565b005b34801561079b57600080fd5b506107b660048036038101906107b191906148d2565b61253f565b005b3480156107c457600080fd5b506107df60048036038101906107da91906148ff565b61271f565b6040516107ec9190613f3e565b60405180910390f35b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806108c057507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806108d057506108cf826127b3565b5b9050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606000805461090c9061496e565b80601f01602080910402602001604051908101604052809291908181526020018280546109389061496e565b80156109855780601f1061095a57610100808354040283529160200191610985565b820191906000526020600020905b81548152906001019060200180831161096857829003601f168201915b5050505050905090565b600061099a8261281d565b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60006109e08261118b565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610a50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4790614a11565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610a6f612868565b73ffffffffffffffffffffffffffffffffffffffff161480610a9e5750610a9d81610a98612868565b61271f565b5b610add576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad490614aa3565b60405180910390fd5b610ae78383612870565b505050565b600080600a548484604051602001610b05929190614af3565b60405160208183030381529060405280519060200120604051602001610b2c929190614b2d565b6040516020818303038152906040528051906020012090506000818787604051602001610b5a929190614af3565b60405160208183030381529060405280519060200120604051602001610b81929190614b2d565b6040516020818303038152906040528051906020012090506000818a8a604051602001610baf929190614af3565b60405160208183030381529060405280519060200120604051602001610bd6929190614b2d565b604051602081830303815290604052805190602001209050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be3826040518263ffffffff1660e01b8152600401610c4991906147d9565b602060405180830381865afa158015610c66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8a9190614b6e565b93505050509695505050505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d29576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2090614be7565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603610db9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610db090614c79565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f482b97c53e48ffa324a976e2738053e9aff6eee04d8aac63b10e19411d869b8260405160405180910390a380600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0090614be7565b60405180910390fd5b600960149054906101000a900460ff1615610f2357600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b0fc9c383836040518363ffffffff1660e01b8152600401610f80929190614c99565b600060405180830381600087803b158015610f9a57600080fd5b505af1158015610fae573d6000803e3d6000fd5b505050505050565b610fc7610fc1612868565b82612929565b611006576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ffd90614d34565b60405180910390fd5b6110118383836129be565b505050565b61103183838360405180602001604052806000815250611e4c565b505050565b600080600a54848460405160200161104f929190614af3565b60405160208183030381529060405280519060200120604051602001611076929190614b2d565b60405160208183030381529060405280519060200120905060008187876040516020016110a4929190614af3565b604051602081830303815290604052805190602001206040516020016110cb929190614b2d565b604051602081830303815290604052805190602001209050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be3826040518263ffffffff1660e01b815260040161113e91906147d9565b602060405180830381865afa15801561115b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117f9190614b6e565b92505050949350505050565b60008061119783612cb7565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611208576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ff90614da0565b60405180910390fd5b80915050919050565b600080600a54848460405160200161122a929190614af3565b60405160208183030381529060405280519060200120604051602001611251929190614b2d565b604051602081830303815290604052805190602001209050600081878760405160200161127f929190614af3565b604051602081830303815290604052805190602001206040516020016112a6929190614b2d565b6040516020818303038152906040528051906020012090506000818a8a6040516020016112d4929190614af3565b604051602081830303815290604052805190602001206040516020016112fb929190614b2d565b6040516020818303038152906040528051906020012090506000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630178b8bf836040518263ffffffff1660e01b815260040161137091906147d9565b602060405180830381865afa15801561138d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b19190614b6e565b90508073ffffffffffffffffffffffffffffffffffffffff16633b3b57de836040518263ffffffff1660e01b81526004016113ec91906147d9565b602060405180830381865afa158015611409573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142d9190614b6e565b9450505050509695505050505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036114ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a490614e32565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146115aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a190614be7565b60405180910390fd5b600960149054906101000a900460ff16156115c457600080fd5b6001600960146101000a81548160ff0219169083151502179055507fd68bbea4b8d77ea0826a260170e3b50080b57c9ed7420ef5920b1a58e613e17960405160405180910390a1565b600b5481565b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1603611682576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167990614e9e565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff16600d600084815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611726576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171d90614f0a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178c90614e9e565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600d600084815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603611839576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183090614f76565b60405180910390fd5b42600d60008481526020019081526020016000206004015411611891576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188890614fe2565b60405180910390fd5b600034116118d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118cb90615028565b60405180910390fd5b6000600d60008481526020019081526020016000206040518060a00160405290816000820154815260200160018201805461190e9061496e565b80601f016020809104026020016040519081016040528092919081815260200182805461193a9061496e565b80156119875780601f1061195c57610100808354040283529160200191611987565b820191906000526020600020905b81548152906001019060200180831161196a57829003601f168201915b505050505081526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600382015481526020016004820154815250509050600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002083908060018154018082558091505060019003906000526020600020016000909190919091505581816040019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611aa58233856129be565b505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600e6020528160005260406000208181548110611aec57600080fd5b90600052602060002001600091509150505481565b606060018054611b109061496e565b80601f0160208091040260200160405190810160405280929190818152602001828054611b3c9061496e565b8015611b895780601f10611b5e57610100808354040283529160200191611b89565b820191906000526020600020905b815481529060010190602001808311611b6c57829003601f168201915b5050505050905090565b611ba5611b9e612868565b8383612cf4565b5050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c3090614be7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611ca8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c9f90615094565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600c5481565b600d602052806000526040600020600091509050806000015490806001018054611d979061496e565b80601f0160208091040260200160405190810160405280929190818152602001828054611dc39061496e565b8015611e105780601f10611de557610100808354040283529160200191611e10565b820191906000526020600020905b815481529060010190602001808311611df357829003601f168201915b5050505050908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030154908060040154905085565b611e5d611e57612868565b83612929565b611e9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e9390614d34565b60405180910390fd5b611ea884848484612e60565b50505050565b600a5481565b6060611ebf8261281d565b6000611ec9612ebc565b90506000815111611ee95760405180602001604052806000815250611f14565b80611ef384612ed3565b604051602001611f049291906150e5565b6040516020818303038152906040525b915050919050565b600960149054906101000a900460ff1681565b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1603611f9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f9590614e9e565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff16600d600084815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612042576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203990615155565b60405180910390fd5b60008111612085576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161207c906151c1565b60405180910390fd5b61209c600c54600b54612fa190919063ffffffff16565b3410156120de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d59061522d565b60405180910390fd5b6000600d60008481526020019081526020016000206040518060a0016040529081600082015481526020016001820180546121189061496e565b80601f01602080910402602001604051908101604052809291908181526020018280546121449061496e565b80156121915780601f1061216657610100808354040283529160200191612191565b820191906000526020600020905b81548152906001019060200180831161217457829003601f168201915b505050505081526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160038201548152602001600482015481525050905060006122356122226301e1338085612fa190919063ffffffff16565b8360800151612fb790919063ffffffff16565b90508082608001818152505050505050565b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16036122b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122ad90614e9e565b60405180910390fd5b600081116122f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122f090615299565b60405180910390fd5b61230e600c5482612fa190919063ffffffff16565b341015612350576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161234790615305565b60405180910390fd5b61235a6006612fcd565b60006040518060a001604052806123716006612fe3565b815260200185858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505081526020013373ffffffffffffffffffffffffffffffffffffffff16815260200142815260200161240b6123fc6301e1338086612fa190919063ffffffff16565b42612fb790919063ffffffff16565b815250905080600d600061241f6006612fe3565b815260200190815260200160002060008201518160000155602082015181600101908161244c91906154c7565b5060408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506060820151816003015560808201518160040155905050600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206124f46006612fe3565b908060018154018082558091505060019003906000526020600020016000909190919091505561252d336125286006612fe3565b612ff1565b6125398484333361320e565b50505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146125cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125c690614be7565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361265f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126569061560b565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f84b83d2b66cac119ccaaca68b476b0dc5371d5f2fd27f697770a910175fd38b660405160405180910390a380600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b61282681613a20565b612865576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161285c90614da0565b60405180910390fd5b50565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166128e38361118b565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000806129358361118b565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806129775750612976818561271f565b5b806129b557508373ffffffffffffffffffffffffffffffffffffffff1661299d8461098f565b73ffffffffffffffffffffffffffffffffffffffff16145b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff166129de8261118b565b73ffffffffffffffffffffffffffffffffffffffff1614612a34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a2b9061569d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612aa3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a9a9061572f565b60405180910390fd5b612ab08383836001613a61565b8273ffffffffffffffffffffffffffffffffffffffff16612ad08261118b565b73ffffffffffffffffffffffffffffffffffffffff1614612b26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b1d9061569d565b60405180910390fd5b6004600082815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612cb28383836001613b87565b505050565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d599061579b565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051612e539190613f3e565b60405180910390a3505050565b612e6b8484846129be565b612e7784848484613b8d565b612eb6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ead9061582d565b60405180910390fd5b50505050565b606060405180602001604052806000815250905090565b606060006001612ee284613d14565b01905060008167ffffffffffffffff811115612f0157612f0061461c565b5b6040519080825280601f01601f191660200182016040528015612f335781602001600182028036833780820191505090505b509050600082602001820190505b600115612f96578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8581612f8a57612f8961584d565b5b04945060008503612f41575b819350505050919050565b60008183612faf91906158ab565b905092915050565b60008183612fc59190615905565b905092915050565b6001816000016000828254019250508190555050565b600081600001549050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603613060576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161305790615985565b60405180910390fd5b61306981613a20565b156130a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130a0906159f1565b60405180910390fd5b6130b7600083836001613a61565b6130c081613a20565b15613100576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130f7906159f1565b60405180910390fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461320a600083836001613b87565b5050565b6000600a5460405160200161322290615a5d565b60405160208183030381529060405280519060200120604051602001613249929190614b2d565b60405160208183030381529060405280519060200120905060008160405160200161327390615abe565b6040516020818303038152906040528051906020012060405160200161329a929190614b2d565b604051602081830303815290604052805190602001209050600073ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be3836040518263ffffffff1660e01b815260040161332591906147d9565b602060405180830381865afa158015613342573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133669190614b6e565b73ffffffffffffffffffffffffffffffffffffffff160361341157600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b0fc9c382306040518363ffffffff1660e01b81526004016133de929190614c99565b600060405180830381600087803b1580156133f857600080fd5b505af115801561340c573d6000803e3d6000fd5b505050505b3073ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be3836040518263ffffffff1660e01b815260040161348391906147d9565b602060405180830381865afa1580156134a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134c49190614b6e565b73ffffffffffffffffffffffffffffffffffffffff161461351a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161351190615b45565b60405180910390fd5b6000868660405160200161352f929190614af3565b6040516020818303038152906040528051906020012090506000828260405160200161355c929190614b2d565b604051602081830303815290604052805190602001209050600073ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be3836040518263ffffffff1660e01b81526004016135e791906147d9565b602060405180830381865afa158015613604573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136289190614b6e565b73ffffffffffffffffffffffffffffffffffffffff16148061371057503373ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be3836040518263ffffffff1660e01b81526004016136b791906147d9565b602060405180830381865afa1580156136d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136f89190614b6e565b73ffffffffffffffffffffffffffffffffffffffff16145b61374f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161374690615bb1565b60405180910390fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166306ab59238484306040518463ffffffff1660e01b81526004016137ae93929190615bd1565b600060405180830381600087803b1580156137c857600080fd5b505af11580156137dc573d6000803e3d6000fd5b50505050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631896f70a82600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b815260040161385f929190614c99565b600060405180830381600087803b15801561387957600080fd5b505af115801561388d573d6000803e3d6000fd5b50505050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d5fa2b0082876040518363ffffffff1660e01b81526004016138ee929190614c99565b600060405180830381600087803b15801561390857600080fd5b505af115801561391c573d6000803e3d6000fd5b50505050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b0fc9c382886040518363ffffffff1660e01b815260040161397d929190614c99565b600060405180830381600087803b15801561399757600080fd5b505af11580156139ab573d6000803e3d6000fd5b505050508573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fbe172d0b7345b08856a54d791662df9f820be68a2a278f0ef50955f491eacde98a8a604051613a0e929190615c7b565b60405180910390a35050505050505050565b60008073ffffffffffffffffffffffffffffffffffffffff16613a4283612cb7565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b6001811115613b8157600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614613af55780600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254613aed9190615cc5565b925050819055505b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614613b805780600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254613b789190615905565b925050819055505b5b50505050565b50505050565b6000613bae8473ffffffffffffffffffffffffffffffffffffffff16613e67565b15613d07578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02613bd7612868565b8786866040518563ffffffff1660e01b8152600401613bf99493929190615d4e565b6020604051808303816000875af1925050508015613c3557506040513d601f19601f82011682018060405250810190613c329190615daf565b60015b613cb7573d8060008114613c65576040519150601f19603f3d011682016040523d82523d6000602084013e613c6a565b606091505b506000815103613caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613ca69061582d565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050613d0c565b600190505b949350505050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310613d72577a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008381613d6857613d6761584d565b5b0492506040810190505b6d04ee2d6d415b85acef81000000008310613daf576d04ee2d6d415b85acef81000000008381613da557613da461584d565b5b0492506020810190505b662386f26fc100008310613dde57662386f26fc100008381613dd457613dd361584d565b5b0492506010810190505b6305f5e1008310613e07576305f5e1008381613dfd57613dfc61584d565b5b0492506008810190505b6127108310613e2c576127108381613e2257613e2161584d565b5b0492506004810190505b60648310613e4f5760648381613e4557613e4461584d565b5b0492506002810190505b600a8310613e5e576001810190505b80915050919050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613ed381613e9e565b8114613ede57600080fd5b50565b600081359050613ef081613eca565b92915050565b600060208284031215613f0c57613f0b613e94565b5b6000613f1a84828501613ee1565b91505092915050565b60008115159050919050565b613f3881613f23565b82525050565b6000602082019050613f536000830184613f2f565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000613f9e613f99613f9484613f59565b613f79565b613f59565b9050919050565b6000613fb082613f83565b9050919050565b6000613fc282613fa5565b9050919050565b613fd281613fb7565b82525050565b6000602082019050613fed6000830184613fc9565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561402d578082015181840152602081019050614012565b60008484015250505050565b6000601f19601f8301169050919050565b600061405582613ff3565b61405f8185613ffe565b935061406f81856020860161400f565b61407881614039565b840191505092915050565b6000602082019050818103600083015261409d818461404a565b905092915050565b6000819050919050565b6140b8816140a5565b81146140c357600080fd5b50565b6000813590506140d5816140af565b92915050565b6000602082840312156140f1576140f0613e94565b5b60006140ff848285016140c6565b91505092915050565b600061411382613f59565b9050919050565b61412381614108565b82525050565b600060208201905061413e600083018461411a565b92915050565b61414d81614108565b811461415857600080fd5b50565b60008135905061416a81614144565b92915050565b6000806040838503121561418757614186613e94565b5b60006141958582860161415b565b92505060206141a6858286016140c6565b9150509250929050565b600080fd5b600080fd5b600080fd5b60008083601f8401126141d5576141d46141b0565b5b8235905067ffffffffffffffff8111156141f2576141f16141b5565b5b60208301915083600182028301111561420e5761420d6141ba565b5b9250929050565b6000806000806000806060878903121561423257614231613e94565b5b600087013567ffffffffffffffff8111156142505761424f613e99565b5b61425c89828a016141bf565b9650965050602087013567ffffffffffffffff81111561427f5761427e613e99565b5b61428b89828a016141bf565b9450945050604087013567ffffffffffffffff8111156142ae576142ad613e99565b5b6142ba89828a016141bf565b92509250509295509295509295565b60006142d482614108565b9050919050565b6142e4816142c9565b81146142ef57600080fd5b50565b600081359050614301816142db565b92915050565b60006020828403121561431d5761431c613e94565b5b600061432b848285016142f2565b91505092915050565b6000819050919050565b61434781614334565b811461435257600080fd5b50565b6000813590506143648161433e565b92915050565b6000806040838503121561438157614380613e94565b5b600061438f85828601614355565b92505060206143a08582860161415b565b9150509250929050565b6000806000606084860312156143c3576143c2613e94565b5b60006143d18682870161415b565b93505060206143e28682870161415b565b92505060406143f3868287016140c6565b9150509250925092565b6000806000806040858703121561441757614416613e94565b5b600085013567ffffffffffffffff81111561443557614434613e99565b5b614441878288016141bf565b9450945050602085013567ffffffffffffffff81111561446457614463613e99565b5b614470878288016141bf565b925092505092959194509250565b60006020828403121561449457614493613e94565b5b60006144a28482850161415b565b91505092915050565b6144b4816140a5565b82525050565b60006020820190506144cf60008301846144ab565b92915050565b60006144e082613fa5565b9050919050565b6144f0816144d5565b82525050565b600060208201905061450b60008301846144e7565b92915050565b6000806040838503121561452857614527613e94565b5b6000614536858286016140c6565b92505060206145478582860161415b565b9150509250929050565b61455a81613f23565b811461456557600080fd5b50565b60008135905061457781614551565b92915050565b6000806040838503121561459457614593613e94565b5b60006145a28582860161415b565b92505060206145b385828601614568565b9150509250929050565b600060a0820190506145d260008301886144ab565b81810360208301526145e4818761404a565b90506145f3604083018661411a565b61460060608301856144ab565b61460d60808301846144ab565b9695505050505050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61465482614039565b810181811067ffffffffffffffff821117156146735761467261461c565b5b80604052505050565b6000614686613e8a565b9050614692828261464b565b919050565b600067ffffffffffffffff8211156146b2576146b161461c565b5b6146bb82614039565b9050602081019050919050565b82818337600083830152505050565b60006146ea6146e584614697565b61467c565b90508281526020810184848401111561470657614705614617565b5b6147118482856146c8565b509392505050565b600082601f83011261472e5761472d6141b0565b5b813561473e8482602086016146d7565b91505092915050565b6000806000806080858703121561476157614760613e94565b5b600061476f8782880161415b565b94505060206147808782880161415b565b9350506040614791878288016140c6565b925050606085013567ffffffffffffffff8111156147b2576147b1613e99565b5b6147be87828801614719565b91505092959194509250565b6147d381614334565b82525050565b60006020820190506147ee60008301846147ca565b92915050565b6000806040838503121561480b5761480a613e94565b5b6000614819858286016140c6565b925050602061482a858286016140c6565b9150509250929050565b60008060006040848603121561484d5761484c613e94565b5b600084013567ffffffffffffffff81111561486b5761486a613e99565b5b614877868287016141bf565b9350935050602061488a868287016140c6565b9150509250925092565b600061489f82614108565b9050919050565b6148af81614894565b81146148ba57600080fd5b50565b6000813590506148cc816148a6565b92915050565b6000602082840312156148e8576148e7613e94565b5b60006148f6848285016148bd565b91505092915050565b6000806040838503121561491657614915613e94565b5b60006149248582860161415b565b92505060206149358582860161415b565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061498657607f821691505b6020821081036149995761499861493f565b5b50919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b60006149fb602183613ffe565b9150614a068261499f565b604082019050919050565b60006020820190508181036000830152614a2a816149ee565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015250565b6000614a8d603d83613ffe565b9150614a9882614a31565b604082019050919050565b60006020820190508181036000830152614abc81614a80565b9050919050565b600081905092915050565b6000614ada8385614ac3565b9350614ae78385846146c8565b82840190509392505050565b6000614b00828486614ace565b91508190509392505050565b6000819050919050565b614b27614b2282614334565b614b0c565b82525050565b6000614b398285614b16565b602082019150614b498284614b16565b6020820191508190509392505050565b600081519050614b6881614144565b92915050565b600060208284031215614b8457614b83613e94565b5b6000614b9284828501614b59565b91505092915050565b7f4e6f74204f776e65720000000000000000000000000000000000000000000000600082015250565b6000614bd1600983613ffe565b9150614bdc82614b9b565b602082019050919050565b60006020820190508181036000830152614c0081614bc4565b9050919050565b7f6e65772072656769737472792073686f756c6420626520646966666572656e7460008201527f2066726f6d206f6c640000000000000000000000000000000000000000000000602082015250565b6000614c63602983613ffe565b9150614c6e82614c07565b604082019050919050565b60006020820190508181036000830152614c9281614c56565b9050919050565b6000604082019050614cae60008301856147ca565b614cbb602083018461411a565b9392505050565b7f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560008201527f72206f7220617070726f76656400000000000000000000000000000000000000602082015250565b6000614d1e602d83613ffe565b9150614d2982614cc2565b604082019050919050565b60006020820190508181036000830152614d4d81614d11565b9050919050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b6000614d8a601883613ffe565b9150614d9582614d54565b602082019050919050565b60006020820190508181036000830152614db981614d7d565b9050919050565b7f4552433732313a2061646472657373207a65726f206973206e6f74206120766160008201527f6c6964206f776e65720000000000000000000000000000000000000000000000602082015250565b6000614e1c602983613ffe565b9150614e2782614dc0565b604082019050919050565b60006020820190508181036000830152614e4b81614e0f565b9050919050565b7f2000000000000000000000000000000000000000000000000000000000000000600082015250565b6000614e88600183613ffe565b9150614e9382614e52565b602082019050919050565b60006020820190508181036000830152614eb781614e7b565b9050919050565b7f4f6e6c79204f776e65722063616e207472616e73666572000000000000000000600082015250565b6000614ef4601783613ffe565b9150614eff82614ebe565b602082019050919050565b60006020820190508181036000830152614f2381614ee7565b9050919050565b7f43616e6e6f7420547261736e6665726564000000000000000000000000000000600082015250565b6000614f60601183613ffe565b9150614f6b82614f2a565b602082019050919050565b60006020820190508181036000830152614f8f81614f53565b9050919050565b7f446f6d61696e2045787069726564000000000000000000000000000000000000600082015250565b6000614fcc600e83613ffe565b9150614fd782614f96565b602082019050919050565b60006020820190508181036000830152614ffb81614fbf565b9050919050565b50565b6000615012600083613ffe565b915061501d82615002565b600082019050919050565b6000602082019050818103600083015261504181615005565b9050919050565b7f63616e6e6f74207472616e7366657220746f2061646472657373283029000000600082015250565b600061507e601d83613ffe565b915061508982615048565b602082019050919050565b600060208201905081810360008301526150ad81615071565b9050919050565b60006150bf82613ff3565b6150c98185614ac3565b93506150d981856020860161400f565b80840191505092915050565b60006150f182856150b4565b91506150fd82846150b4565b91508190509392505050565b7f4f6e6c79204f776e65722063616e20457874656e640000000000000000000000600082015250565b600061513f601583613ffe565b915061514a82615109565b602082019050919050565b6000602082019050818103600083015261516e81615132565b9050919050565b7f204d7573742062652067726561746572207468656e2030000000000000000000600082015250565b60006151ab601783613ffe565b91506151b682615175565b602082019050919050565b600060208201905081810360008301526151da8161519e565b9050919050565b7f204d7573742062652067726561746572207468616e2030000000000000000000600082015250565b6000615217601783613ffe565b9150615222826151e1565b602082019050919050565b600060208201905081810360008301526152468161520a565b9050919050565b7f204d7573742062652067726561746572207468656e20305f3100000000000000600082015250565b6000615283601983613ffe565b915061528e8261524d565b602082019050919050565b600060208201905081810360008301526152b281615276565b9050919050565b7f204d7573742062652067726561746572207468616e20305f3200000000000000600082015250565b60006152ef601983613ffe565b91506152fa826152b9565b602082019050919050565b6000602082019050818103600083015261531e816152e2565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026153877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261534a565b615391868361534a565b95508019841693508086168417925050509392505050565b60006153c46153bf6153ba846140a5565b613f79565b6140a5565b9050919050565b6000819050919050565b6153de836153a9565b6153f26153ea826153cb565b848454615357565b825550505050565b600090565b6154076153fa565b6154128184846153d5565b505050565b5b818110156154365761542b6000826153ff565b600181019050615418565b5050565b601f82111561547b5761544c81615325565b6154558461533a565b81016020851015615464578190505b6154786154708561533a565b830182615417565b50505b505050565b600082821c905092915050565b600061549e60001984600802615480565b1980831691505092915050565b60006154b7838361548d565b9150826002028217905092915050565b6154d082613ff3565b67ffffffffffffffff8111156154e9576154e861461c565b5b6154f3825461496e565b6154fe82828561543a565b600060209050601f831160018114615531576000841561551f578287015190505b61552985826154ab565b865550615591565b601f19841661553f86615325565b60005b8281101561556757848901518255600182019150602085019450602081019050615542565b868310156155845784890151615580601f89168261548d565b8355505b6001600288020188555050505b505050505050565b7f6e6577207265736f6c7665722073686f756c6420626520646966666572656e7460008201527f2066726f6d206f6c640000000000000000000000000000000000000000000000602082015250565b60006155f5602983613ffe565b915061560082615599565b604082019050919050565b60006020820190508181036000830152615624816155e8565b9050919050565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b6000615687602583613ffe565b91506156928261562b565b604082019050919050565b600060208201905081810360008301526156b68161567a565b9050919050565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000615719602483613ffe565b9150615724826156bd565b604082019050919050565b600060208201905081810360008301526157488161570c565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b6000615785601983613ffe565b91506157908261574f565b602082019050919050565b600060208201905081810360008301526157b481615778565b9050919050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b6000615817603283613ffe565b9150615822826157bb565b604082019050919050565b600060208201905081810360008301526158468161580a565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006158b6826140a5565b91506158c1836140a5565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156158fa576158f961587c565b5b828202905092915050565b6000615910826140a5565b915061591b836140a5565b92508282019050808211156159335761593261587c565b5b92915050565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b600061596f602083613ffe565b915061597a82615939565b602082019050919050565b6000602082019050818103600083015261599e81615962565b9050919050565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b60006159db601c83613ffe565b91506159e6826159a5565b602082019050919050565b60006020820190508181036000830152615a0a816159ce565b9050919050565b7f78656e0000000000000000000000000000000000000000000000000000000000600082015250565b6000615a47600383614ac3565b9150615a5282615a11565b600382019050919050565b6000615a6882615a3a565b9150819050919050565b7f78656e646f6d61696e7300000000000000000000000000000000000000000000600082015250565b6000615aa8600a83614ac3565b9150615ab382615a72565b600a82019050919050565b6000615ac982615a9b565b9150819050919050565b7f7468697320636f6e74726163742073686f756c64206f776e2074686520646f6d60008201527f61696e0000000000000000000000000000000000000000000000000000000000602082015250565b6000615b2f602383613ffe565b9150615b3a82615ad3565b604082019050919050565b60006020820190508181036000830152615b5e81615b22565b9050919050565b7f73756220646f6d61696e20616c7265616479206f776e65640000000000000000600082015250565b6000615b9b601883613ffe565b9150615ba682615b65565b602082019050919050565b60006020820190508181036000830152615bca81615b8e565b9050919050565b6000606082019050615be660008301866147ca565b615bf360208301856147ca565b615c00604083018461411a565b949350505050565b6000615c148385613ffe565b9350615c218385846146c8565b615c2a83614039565b840190509392505050565b6000615c42600a83613ffe565b9150615c4d82615a72565b602082019050919050565b6000615c65600383613ffe565b9150615c7082615a11565b602082019050919050565b60006060820190508181036000830152615c96818486615c08565b90508181036020830152615ca981615c35565b90508181036040830152615cbc81615c58565b90509392505050565b6000615cd0826140a5565b9150615cdb836140a5565b9250828203905081811115615cf357615cf261587c565b5b92915050565b600081519050919050565b600082825260208201905092915050565b6000615d2082615cf9565b615d2a8185615d04565b9350615d3a81856020860161400f565b615d4381614039565b840191505092915050565b6000608082019050615d63600083018761411a565b615d70602083018661411a565b615d7d60408301856144ab565b8181036060830152615d8f8184615d15565b905095945050505050565b600081519050615da981613eca565b92915050565b600060208284031215615dc557615dc4613e94565b5b6000615dd384828501615d9a565b9150509291505056fea2646970667358221220427bbdbcac395e4091ede8fc8b507e31914a4fdba6e9e5d79175e7759d78247764736f6c63430008100033000000000000000000000000ba57519313770d57cf61e5b7b18aaa012b3e990500000000000000000000000048f3a4dbc56f9e0a5e9686cb9f12855a4d346123

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

000000000000000000000000ba57519313770d57cf61e5b7b18aaa012b3e990500000000000000000000000048f3a4dbc56f9e0a5e9686cb9f12855a4d346123

-----Decoded View---------------
Arg [0] : _registry (address): 0xba57519313770d57cf61e5b7b18aaa012b3e9905
Arg [1] : _resolver (address): 0x48f3a4dbc56f9e0a5e9686cb9f12855a4d346123

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000ba57519313770d57cf61e5b7b18aaa012b3e9905
Arg [1] : 00000000000000000000000048f3a4dbc56f9e0a5e9686cb9f12855a4d346123


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading