ETH Price: $3,436.41 (+1.44%)

Token

Bored Town Domains (.town)

Overview

Max Total Supply

0 .town

Holders

2,268

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-
0x45a1fe688c01ccfd4606ac31d1f7b10fe2aa875e
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information

Contract Source Code Verified (Exact Match)

Contract Name:
TownDomains

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 1300 runs

Other Settings:
default evmVersion
File 1 of 24 : 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 24 : IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

import "../IERC1155.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}

File 3 of 24 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 4 of 24 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 5 of 24 : 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 6 of 24 : 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 7 of 24 : 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 8 of 24 : 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 9 of 24 : 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 10 of 24 : 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 11 of 24 : 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 12 of 24 : IBaseRegistrar.sol
import "../registry/ENS.sol";
import "./IBaseRegistrar.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

interface IBaseRegistrar is IERC721 {
    event ControllerAdded(address indexed controller);
    event ControllerRemoved(address indexed controller);
    event NameMigrated(
        uint256 indexed id,
        address indexed owner,
        uint256 expires
    );
    event NameRegistered(
        uint256 indexed id,
        address indexed owner,
        uint256 expires
    );
    event NameRenewed(uint256 indexed id, uint256 expires);

    // Authorises a controller, who can register and renew domains.
    function addController(address controller) external;

    // Revoke controller permission for an address.
    function removeController(address controller) external;

    // Set the resolver for the TLD this registrar manages.
    function setResolver(address resolver) external;

    // Returns the expiration timestamp of the specified label hash.
    function nameExpires(uint256 id) external view returns (uint256);

    // Returns true if the specified name is available for registration.
    function available(uint256 id) external view returns (bool);

    /**
     * @dev Register a name.
     */
    function register(
        uint256 id,
        address owner,
        uint256 duration
    ) external returns (uint256);

    function renew(uint256 id, uint256 duration) external returns (uint256);

    /**
     * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.
     */
    function reclaim(uint256 id, address owner) external;
}

File 13 of 24 : ENS.sol
pragma solidity >=0.8.4;

interface ENS {
    // Logged when the owner of a node assigns a new owner to a subnode.
    event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);

    // Logged when the owner of a node transfers ownership to a new account.
    event Transfer(bytes32 indexed node, address owner);

    // Logged when the resolver for a node changes.
    event NewResolver(bytes32 indexed node, address resolver);

    // Logged when the TTL of a node changes
    event NewTTL(bytes32 indexed node, uint64 ttl);

    // Logged when an operator is added or removed.
    event ApprovalForAll(
        address indexed owner,
        address indexed operator,
        bool approved
    );

    function setRecord(
        bytes32 node,
        address owner,
        address resolver,
        uint64 ttl
    ) external;

    function setSubnodeRecord(
        bytes32 node,
        bytes32 label,
        address owner,
        address resolver,
        uint64 ttl
    ) external;

    function setSubnodeOwner(
        bytes32 node,
        bytes32 label,
        address owner
    ) external returns (bytes32);

    function setResolver(bytes32 node, address resolver) external;

    function setOwner(bytes32 node, address owner) external;

    function setTTL(bytes32 node, uint64 ttl) external;

    function setApprovalForAll(address operator, bool approved) external;

    function owner(bytes32 node) external view returns (address);

    function resolver(bytes32 node) external view returns (address);

    function ttl(bytes32 node) external view returns (uint64);

    function recordExists(bytes32 node) external view returns (bool);

    function isApprovedForAll(
        address owner,
        address operator
    ) external view returns (bool);
}

File 14 of 24 : IReverseRegistrar.sol
pragma solidity >=0.8.4;

interface IReverseRegistrar {
    function setDefaultResolver(address resolver) external;

    function claim(address owner) external returns (bytes32);

    function claimForAddr(
        address addr,
        address owner,
        address resolver
    ) external returns (bytes32);

    function claimWithResolver(
        address owner,
        address resolver
    ) external returns (bytes32);

    function setName(string memory name) external returns (bytes32);

    function setNameForAddr(
        address addr,
        address owner,
        address resolver,
        string memory name
    ) external returns (bytes32);

    function node(address addr) external pure returns (bytes32);
}

File 15 of 24 : ReverseClaimer.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.17 <0.9.0;

import {ENS} from "../registry/ENS.sol";
import {IReverseRegistrar} from "../reverseRegistrar/IReverseRegistrar.sol";

contract ReverseClaimer {
    bytes32 constant ADDR_REVERSE_NODE =
        0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;

    constructor(ENS ens, address claimant) {
        IReverseRegistrar reverseRegistrar = IReverseRegistrar(
            ens.owner(ADDR_REVERSE_NODE)
        );
        reverseRegistrar.claim(claimant);
    }
}

File 16 of 24 : ERC20Recoverable.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.17 <0.9.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/**
    @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.
 */

contract ERC20Recoverable is Ownable {
    /**
    @notice Recover ERC20 tokens sent to the contract by mistake.
    @dev The contract is Ownable and only the owner can call the recover function.
    @param _to The address to send the tokens to.
@param _token The address of the ERC20 token to recover
    @param _amount The amount of tokens to recover.
 */
    function recoverFunds(
        address _token,
        address _to,
        uint256 _amount
    ) external onlyOwner {
        IERC20(_token).transfer(_to, _amount);
    }
}

File 17 of 24 : BytesUtils.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

library BytesUtils {
    /*
     * @dev Returns the keccak-256 hash of a byte range.
     * @param self The byte string to hash.
     * @param offset The position to start hashing at.
     * @param len The number of bytes to hash.
     * @return The hash of the byte range.
     */
    function keccak(
        bytes memory self,
        uint256 offset,
        uint256 len
    ) internal pure returns (bytes32 ret) {
        require(offset + len <= self.length);
        assembly {
            ret := keccak256(add(add(self, 32), offset), len)
        }
    }

    /**
     * @dev Returns the ENS namehash of a DNS-encoded name.
     * @param self The DNS-encoded name to hash.
     * @param offset The offset at which to start hashing.
     * @return The namehash of the name.
     */
    function namehash(
        bytes memory self,
        uint256 offset
    ) internal pure returns (bytes32) {
        (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);
        if (labelhash == bytes32(0)) {
            require(offset == self.length - 1, "namehash: Junk at end of name");
            return bytes32(0);
        }
        return
            keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));
    }

    /**
     * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.
     * @param self The byte string to read a label from.
     * @param idx The index to read a label at.
     * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.
     * @return newIdx The index of the start of the next label.
     */
    function readLabel(
        bytes memory self,
        uint256 idx
    ) internal pure returns (bytes32 labelhash, uint256 newIdx) {
        require(idx < self.length, "readLabel: Index out of bounds");
        uint256 len = uint256(uint8(self[idx]));
        if (len > 0) {
            labelhash = keccak(self, idx + 1, len);
        } else {
            labelhash = bytes32(0);
        }
        newIdx = idx + len + 1;
    }
}

File 18 of 24 : ERC1155Fuse.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol";
import "@openzeppelin/contracts/utils/Address.sol";

/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */

abstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {
    using Address for address;
    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(
        address indexed owner,
        address indexed approved,
        uint256 indexed tokenId
    );
    mapping(uint256 => uint256) public _tokens;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;
    // Mapping from token ID to approved address
    mapping(uint256 => address) internal _tokenApprovals;

    /**************************************************************************
     * ERC721 methods
     *************************************************************************/

    function ownerOf(uint256 id) public view virtual returns (address) {
        (address owner, , ) = getData(id);
        return owner;
    }

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

        require(
            msg.sender == owner || isApprovedForAll(owner, msg.sender),
            "AC"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(
        uint256 tokenId
    ) public view virtual returns (address) {
        return _tokenApprovals[tokenId];
    }

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

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(
        address account,
        uint256 id
    ) public view virtual override returns (uint256) {
        require(account != address(0), "BQ");
        address owner = ownerOf(id);
        if (owner == account) {
            return 1;
        }
        return 0;
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] memory accounts,
        uint256[] memory ids
    ) public view virtual override returns (uint256[] memory) {
        require(accounts.length == ids.length, "AI");

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            batchBalances[i] = balanceOf(accounts[i], ids[i]);
        }

        return batchBalances;
    }

    /**
     * @dev See {IERC1155-setApprovalForAll}.
     */
    function setApprovalForAll(
        address operator,
        bool approved
    ) public virtual override {
        require(msg.sender != operator, "SAS");

        _operatorApprovals[msg.sender][operator] = approved;
        emit ApprovalForAll(msg.sender, operator, approved);
    }

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

    /**
     * @dev Returns the Name's owner address and fuses
     */
    function getData(
        uint256 tokenId
    ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {
        uint256 t = _tokens[tokenId];
        owner = address(uint160(t));
        expiry = uint64(t >> 192);
        fuses = uint32(t >> 160);
    }

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(to != address(0), "TZ");
        require(
            from == msg.sender || isApprovedForAll(from, msg.sender),
            "CNO"
        );

        _transfer(from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override {
        require(ids.length == amounts.length, "IALM");
        require(to != address(0), "TZ");
        require(
            from == msg.sender || isApprovedForAll(from, msg.sender),
            "TCNO"
        );

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);

            _beforeTransfer(id, fuses, expiry);

            require(amount == 1 && oldOwner == from, "IBT");
            _setData(id, to, fuses, expiry);
        }

        emit TransferBatch(msg.sender, from, to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(
            msg.sender,
            from,
            to,
            ids,
            amounts,
            data
        );
    }

    /**************************************************************************
     * Internal/private methods
     *************************************************************************/

    /**
     * @dev Sets the Name's owner address and fuses
     */
    function _setData(
        uint256 tokenId,
        address owner,
        uint32 fuses,
        uint64 expiry
    ) internal virtual {
        _tokens[tokenId] =
            uint256(uint160(owner)) |
            (uint256(fuses) << 160) |
            (uint256(expiry) << 192);
    }

    function _beforeTransfer(
        uint256 id,
        uint32 fuses,
        uint64 expiry
    ) internal virtual;

    function _clearOwnerAndFuses(
        address owner,
        uint32 fuses,
        uint64 expiry
    ) internal virtual returns (address, uint32);

    function _mint(
        bytes32 node,
        address owner,
        uint32 fuses,
        uint64 expiry
    ) internal virtual {
        uint256 tokenId = uint256(node);
        (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(
            uint256(node)
        );

        uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &
            oldFuses;

        if (oldExpiry > expiry) {
            expiry = oldExpiry;
        }

        if (oldExpiry >= block.timestamp) {
            fuses = fuses | parentControlledFuses;
        }

        require(oldOwner == address(0), "MOE");
        require(owner != address(0), "MTZ");
        require(owner != address(this), "NON");

        _setData(tokenId, owner, fuses, expiry);
        emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);
        _doSafeTransferAcceptanceCheck(
            msg.sender,
            address(0),
            owner,
            tokenId,
            1,
            ""
        );
    }

    function _burn(uint256 tokenId) internal virtual {
        (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(
            tokenId
        );
        (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);
        // Clear approvals
        delete _tokenApprovals[tokenId];
        // Fuses and expiry are kept on burn
        _setData(tokenId, address(0x0), fuses, expiry);
        emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);
    }

    function _transfer(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);

        _beforeTransfer(id, fuses, expiry);

        require(amount == 1 && oldOwner == from, "IB");

        if (oldOwner == to) {
            return;
        }

        _setData(id, to, fuses, expiry);

        emit TransferSingle(msg.sender, from, to, id, amount);

        _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);
    }

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try
                IERC1155Receiver(to).onERC1155Received(
                    operator,
                    from,
                    id,
                    amount,
                    data
                )
            returns (bytes4 response) {
                if (
                    response != IERC1155Receiver(to).onERC1155Received.selector
                ) {
                    revert("RT");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("TNI");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try
                IERC1155Receiver(to).onERC1155BatchReceived(
                    operator,
                    from,
                    ids,
                    amounts,
                    data
                )
            returns (bytes4 response) {
                if (
                    response !=
                    IERC1155Receiver(to).onERC1155BatchReceived.selector
                ) {
                    revert("RT");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("TNI");
            }
        }
    }

    /* ERC721 internal functions */

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

File 19 of 24 : IMetadataService.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

interface IMetadataService {
    function uri(uint256) external view returns (string memory);
}

File 20 of 24 : INameWrapper.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "../registry/ENS.sol";
import "../ethregistrar/IBaseRegistrar.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "./IMetadataService.sol";
import "./INameWrapperUpgrade.sol";

uint32 constant CANNOT_UNWRAP = 1;
uint32 constant CANNOT_BURN_FUSES = 2;
uint32 constant CANNOT_TRANSFER = 4;
uint32 constant CANNOT_SET_RESOLVER = 8;
uint32 constant CANNOT_SET_TTL = 16;
uint32 constant CANNOT_CREATE_SUBDOMAIN = 32;
uint32 constant CANNOT_APPROVE = 64;
//uint16 reserved for parent controlled fuses from bit 17 to bit 32
uint32 constant PARENT_CANNOT_CONTROL = 1 << 16;
uint32 constant IS_DOT_ETH = 1 << 17;
uint32 constant CAN_EXTEND_EXPIRY = 1 << 18;
uint32 constant CAN_DO_EVERYTHING = 0;
uint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;
// all fuses apart from IS_DOT_ETH
uint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;

interface INameWrapper is IERC1155 {
    event NameWrapped(
        bytes32 indexed node,
        bytes name,
        address owner,
        uint32 fuses,
        uint64 expiry
    );

    event NameUnwrapped(bytes32 indexed node, address owner);

    event FusesSet(bytes32 indexed node, uint32 fuses);
    event ExpiryExtended(bytes32 indexed node, uint64 expiry);

    function ens() external view returns (ENS);

    function registrar() external view returns (IBaseRegistrar);

    function metadataService() external view returns (IMetadataService);

    function names(bytes32) external view returns (bytes memory);

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

    function upgradeContract() external view returns (INameWrapperUpgrade);

    function supportsInterface(bytes4 interfaceID) external view returns (bool);

    function wrap(
        bytes calldata name,
        address wrappedOwner,
        address resolver
    ) external;

    function wrapETH2LD(
        string calldata label,
        address wrappedOwner,
        uint16 ownerControlledFuses,
        address resolver
    ) external returns (uint64 expires);

    function registerAndWrapETH2LD(
        string calldata label,
        address wrappedOwner,
        uint256 duration,
        address resolver,
        uint16 ownerControlledFuses
    ) external returns (uint256 registrarExpiry);

    function renew(
        uint256 labelHash,
        uint256 duration
    ) external returns (uint256 expires);

    function unwrap(bytes32 node, bytes32 label, address owner) external;

    function unwrapETH2LD(
        bytes32 label,
        address newRegistrant,
        address newController
    ) external;

    function upgrade(bytes calldata name, bytes calldata extraData) external;

    function setFuses(
        bytes32 node,
        uint16 ownerControlledFuses
    ) external returns (uint32 newFuses);

    function setChildFuses(
        bytes32 parentNode,
        bytes32 labelhash,
        uint32 fuses,
        uint64 expiry
    ) external;

    function setSubnodeRecord(
        bytes32 node,
        string calldata label,
        address owner,
        address resolver,
        uint64 ttl,
        uint32 fuses,
        uint64 expiry
    ) external returns (bytes32);

    function setRecord(
        bytes32 node,
        address owner,
        address resolver,
        uint64 ttl
    ) external;

    function setSubnodeOwner(
        bytes32 node,
        string calldata label,
        address newOwner,
        uint32 fuses,
        uint64 expiry
    ) external returns (bytes32);

    function extendExpiry(
        bytes32 node,
        bytes32 labelhash,
        uint64 expiry
    ) external returns (uint64);

    function canModifyName(
        bytes32 node,
        address addr
    ) external view returns (bool);

    function setResolver(bytes32 node, address resolver) external;

    function setTTL(bytes32 node, uint64 ttl) external;

    function ownerOf(uint256 id) external view returns (address owner);

    function approve(address to, uint256 tokenId) external;

    function getApproved(uint256 tokenId) external view returns (address);

    function getData(
        uint256 id
    ) external view returns (address, uint32, uint64);

    function setMetadataService(IMetadataService _metadataService) external;

    function uri(uint256 tokenId) external view returns (string memory);

    function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;

    function allFusesBurned(
        bytes32 node,
        uint32 fuseMask
    ) external view returns (bool);

    function isWrapped(bytes32) external view returns (bool);

    function isWrapped(bytes32, bytes32) external view returns (bool);
}

File 21 of 24 : INameWrapperUpgrade.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

interface INameWrapperUpgrade {
    function wrapFromUpgrade(
        bytes calldata name,
        address wrappedOwner,
        uint32 fuses,
        uint64 expiry,
        address approved,
        bytes calldata extraData
    ) external;
}

File 22 of 24 : NameWrapper.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import {ERC1155Fuse, IERC165, IERC1155MetadataURI} from "./ERC1155Fuse.sol";
import {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from "./INameWrapper.sol";
import {INameWrapperUpgrade} from "./INameWrapperUpgrade.sol";
import {IMetadataService} from "./IMetadataService.sol";
import {ENS} from "../registry/ENS.sol";
import {IReverseRegistrar} from "../reverseRegistrar/IReverseRegistrar.sol";
import {ReverseClaimer} from "../reverseRegistrar/ReverseClaimer.sol";
import {IBaseRegistrar} from "../ethregistrar/IBaseRegistrar.sol";
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {BytesUtils} from "./BytesUtils.sol";
import {ERC20Recoverable} from "../utils/ERC20Recoverable.sol";

error Unauthorised(bytes32 node, address addr);
error IncompatibleParent();
error IncorrectTokenType();
error LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);
error LabelTooShort();
error LabelTooLong(string label);
error IncorrectTargetOwner(address owner);
error CannotUpgrade();
error OperationProhibited(bytes32 node);
error NameIsNotWrapped();
error NameIsStillExpired();

error NotController();

// Contract size optimization
contract Controllable is Ownable {
    mapping(address => bool) public controllers;

    event ControllerChanged(address indexed controller, bool active);

    function setController(address controller, bool active) public onlyOwner {
        controllers[controller] = active;
        emit ControllerChanged(controller, active);
    }

    modifier onlyController() {
        if (!controllers[msg.sender]) revert NotController();
        _;
    }
}

abstract contract NameWrapper is
    Ownable,
    ERC1155Fuse,
    INameWrapper,
    Controllable,
    IERC721Receiver,
    ERC20Recoverable,
    ReverseClaimer
{
    using BytesUtils for bytes;

    ENS public immutable ens;
    IBaseRegistrar public immutable registrar;
    IMetadataService public metadataService;
    mapping(bytes32 => bytes) public names;

    uint64 private constant GRACE_PERIOD = 90 days;
    bytes32 private immutable ETH_NODE;
    bytes32 private immutable ETH_LABELHASH;
    bytes32 private constant ROOT_NODE =
        0x0000000000000000000000000000000000000000000000000000000000000000;

    INameWrapperUpgrade public upgradeContract;
    uint64 private constant MAX_EXPIRY = type(uint64).max;

    constructor(
        ENS _ens,
        IBaseRegistrar _registrar,
        IMetadataService _metadataService,
        string memory _ethNode
    ) ReverseClaimer(_ens, msg.sender) {
        ens = _ens;
        registrar = _registrar;
        metadataService = _metadataService;

        ETH_NODE = keccak256(
            abi.encodePacked(bytes32(0), keccak256(bytes(_ethNode)))
        );
        ETH_LABELHASH = keccak256(bytes(_ethNode));

        /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */

        _setData(
            uint256(ETH_NODE),
            address(0),
            uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),
            MAX_EXPIRY
        );
        _setData(
            uint256(ROOT_NODE),
            address(0),
            uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),
            MAX_EXPIRY
        );
        names[ROOT_NODE] = "\x00";
        names[ETH_NODE] = bytes(string.concat("\x00", _ethNode, "\x00"));
        names[ETH_NODE][0] = bytes1(uint8(names[ETH_NODE].length - 2));

        _transferOwnership(ens.owner(bytes32(0)));
    }

    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {
        return
            interfaceId == type(INameWrapper).interfaceId ||
            interfaceId == type(IERC721Receiver).interfaceId ||
            interfaceId == type(IERC721).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /* ERC1155 Fuse */

    /**
     * @notice Gets the owner of a name
     * @param id Label as a string of the .eth domain to wrap
     * @return owner The owner of the name
     */

    function ownerOf(
        uint256 id
    ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {
        return super.ownerOf(id);
    }

    /**
     * @notice Gets the owner of a name
     * @param id Namehash of the name
     * @return operator Approved operator of a name
     */

    function getApproved(
        uint256 id
    )
        public
        view
        override(ERC1155Fuse, INameWrapper)
        returns (address operator)
    {
        address owner = ownerOf(id);
        if (owner == address(0)) {
            return address(0);
        }
        return super.getApproved(id);
    }

    /**
     * @notice Approves an address for a name
     * @param to address to approve
     * @param tokenId name to approve
     */

    function approve(
        address to,
        uint256 tokenId
    ) public override(ERC1155Fuse, INameWrapper) {
        (, uint32 fuses, ) = getData(tokenId);
        if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {
            revert OperationProhibited(bytes32(tokenId));
        }
        super.approve(to, tokenId);
    }

    /**
     * @notice Gets the data for a name
     * @param id Namehash of the name
     * @return owner Owner of the name
     * @return fuses Fuses of the name
     * @return expiry Expiry of the name
     */

    function getData(
        uint256 id
    )
        public
        view
        override(ERC1155Fuse, INameWrapper)
        returns (address owner, uint32 fuses, uint64 expiry)
    {
        (owner, fuses, expiry) = super.getData(id);

        (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);
    }

    /* Metadata service */

    /**
     * @notice Set the metadata service. Only the owner can do this
     * @param _metadataService The new metadata service
     */

    function setMetadataService(
        IMetadataService _metadataService
    ) public onlyOwner {
        metadataService = _metadataService;
    }

    /**
     * @notice Get the metadata uri
     * @param tokenId The id of the token
     * @return string uri of the metadata service
     */
    function uri(
        uint256 tokenId
    )
        public
        view
        override(INameWrapper, IERC1155MetadataURI)
        returns (string memory)
    {
        return metadataService.uri(tokenId);
    }

    /**
     * @notice Set the address of the upgradeContract of the contract. only admin can do this
     * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time
     * to make the contract not upgradable.
     * @param _upgradeAddress address of an upgraded contract
     */

    function setUpgradeContract(
        INameWrapperUpgrade _upgradeAddress
    ) public onlyOwner {
        if (address(upgradeContract) != address(0)) {
            registrar.setApprovalForAll(address(upgradeContract), false);
            ens.setApprovalForAll(address(upgradeContract), false);
        }

        upgradeContract = _upgradeAddress;

        if (address(upgradeContract) != address(0)) {
            registrar.setApprovalForAll(address(upgradeContract), true);
            ens.setApprovalForAll(address(upgradeContract), true);
        }
    }

    /**
     * @notice Checks if msg.sender is the owner or operator of the owner of a name
     * @param node namehash of the name to check
     */

    modifier onlyTokenOwner(bytes32 node) {
        if (!canModifyName(node, msg.sender)) {
            revert Unauthorised(node, msg.sender);
        }

        _;
    }

    /**
     * @notice Checks if owner or operator of the owner
     * @param node namehash of the name to check
     * @param addr which address to check permissions for
     * @return whether or not is owner or operator
     */

    function canModifyName(
        bytes32 node,
        address addr
    ) public view returns (bool) {
        (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));
        return
            (owner == addr || isApprovedForAll(owner, addr)) &&
            !_isETH2LDInGracePeriod(fuses, expiry);
    }

    /**
     * @notice Checks if owner/operator or approved by owner
     * @param node namehash of the name to check
     * @param addr which address to check permissions for
     * @return whether or not is owner/operator or approved
     */

    function canExtendSubnames(
        bytes32 node,
        address addr
    ) public view returns (bool) {
        (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));
        return
            (owner == addr ||
                isApprovedForAll(owner, addr) ||
                getApproved(uint256(node)) == addr) &&
            !_isETH2LDInGracePeriod(fuses, expiry);
    }

    /**
     * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract
     * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar
     * @param label Label as a string of the .eth domain to wrap
     * @param wrappedOwner Owner of the name in this contract
     * @param ownerControlledFuses Initial owner-controlled fuses to set
     * @param resolver Resolver contract address
     */

    function wrapETH2LD(
        string calldata label,
        address wrappedOwner,
        uint16 ownerControlledFuses,
        address resolver
    ) public returns (uint64 expiry) {
        uint256 tokenId = uint256(keccak256(bytes(label)));
        address registrant = registrar.ownerOf(tokenId);
        if (
            registrant != msg.sender &&
            !registrar.isApprovedForAll(registrant, msg.sender)
        ) {
            revert Unauthorised(
                _makeNode(ETH_NODE, bytes32(tokenId)),
                msg.sender
            );
        }

        // transfer the token from the user to this contract
        registrar.transferFrom(registrant, address(this), tokenId);

        // transfer the ens record back to the new owner (this contract)
        registrar.reclaim(tokenId, address(this));

        expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;

        _wrapETH2LD(
            label,
            wrappedOwner,
            ownerControlledFuses,
            expiry,
            resolver
        );
    }

    /**
     * @dev Registers a new .eth second-level domain and wraps it.
     *      Only callable by authorised controllers.
     * @param label The label to register (Eg, 'foo' for 'foo.eth').
     * @param wrappedOwner The owner of the wrapped name.
     * @param duration The duration, in seconds, to register the name for.
     * @param resolver The resolver address to set on the ENS registry (optional).
     * @param ownerControlledFuses Initial owner-controlled fuses to set
     * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.
     */

    function registerAndWrapETH2LD(
        string calldata label,
        address wrappedOwner,
        uint256 duration,
        address resolver,
        uint16 ownerControlledFuses
    ) external onlyController returns (uint256 registrarExpiry) {
        uint256 tokenId = uint256(keccak256(bytes(label)));
        registrarExpiry = registrar.register(tokenId, address(this), duration);
        _wrapETH2LD(
            label,
            wrappedOwner,
            ownerControlledFuses,
            uint64(registrarExpiry) + GRACE_PERIOD,
            resolver
        );
    }

    /**
     * @notice Renews a .eth second-level domain.
     * @dev Only callable by authorised controllers.
     * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').
     * @param duration The number of seconds to renew the name for.
     * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.
     */

    function renew(
        uint256 tokenId,
        uint256 duration
    ) external onlyController returns (uint256 expires) {
        bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));

        uint256 registrarExpiry = registrar.renew(tokenId, duration);

        // Do not set anything in wrapper if name is not wrapped
        try registrar.ownerOf(tokenId) returns (address registrarOwner) {
            if (
                registrarOwner != address(this) ||
                ens.owner(node) != address(this)
            ) {
                return registrarExpiry;
            }
        } catch {
            return registrarExpiry;
        }

        // Set expiry in Wrapper
        uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;

        // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()
        (address owner, uint32 fuses, ) = super.getData(uint256(node));
        _setData(node, owner, fuses, expiry);

        return registrarExpiry;
    }

    /**
     * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain
     * @dev Can be called by the owner in the registry or an authorised caller in the registry
     * @param name The name to wrap, in DNS format
     * @param wrappedOwner Owner of the name in this contract
     * @param resolver Resolver contract
     */

    function wrap(
        bytes calldata name,
        address wrappedOwner,
        address resolver
    ) public {
        (bytes32 labelhash, uint256 offset) = name.readLabel(0);
        bytes32 parentNode = name.namehash(offset);
        bytes32 node = _makeNode(parentNode, labelhash);

        names[node] = name;

        if (parentNode == ETH_NODE) {
            revert IncompatibleParent();
        }

        address owner = ens.owner(node);

        if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {
            revert Unauthorised(node, msg.sender);
        }

        if (resolver != address(0)) {
            ens.setResolver(node, resolver);
        }

        ens.setOwner(node, address(this));

        _wrap(node, name, wrappedOwner, 0, 0);
    }

    /**
     * @notice Unwraps a .eth domain. e.g. vitalik.eth
     * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper
     * @param labelhash Labelhash of the .eth domain
     * @param registrant Sets the owner in the .eth registrar to this address
     * @param controller Sets the owner in the registry to this address
     */

    function unwrapETH2LD(
        bytes32 labelhash,
        address registrant,
        address controller
    ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {
        if (registrant == address(this)) {
            revert IncorrectTargetOwner(registrant);
        }
        _unwrap(_makeNode(ETH_NODE, labelhash), controller);
        registrar.safeTransferFrom(
            address(this),
            registrant,
            uint256(labelhash)
        );
    }

    /**
     * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain
     * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper
     * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')
     * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')
     * @param controller Sets the owner in the registry to this address
     */

    function unwrap(
        bytes32 parentNode,
        bytes32 labelhash,
        address controller
    ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {
        if (parentNode == ETH_NODE) {
            revert IncompatibleParent();
        }
        if (controller == address(0x0) || controller == address(this)) {
            revert IncorrectTargetOwner(controller);
        }
        _unwrap(_makeNode(parentNode, labelhash), controller);
    }

    /**
     * @notice Sets fuses of a name
     * @param node Namehash of the name
     * @param ownerControlledFuses Owner-controlled fuses to burn
     * @return Old fuses
     */

    function setFuses(
        bytes32 node,
        uint16 ownerControlledFuses
    )
        public
        onlyTokenOwner(node)
        operationAllowed(node, CANNOT_BURN_FUSES)
        returns (uint32)
    {
        // owner protected by onlyTokenOwner
        (address owner, uint32 oldFuses, uint64 expiry) = getData(
            uint256(node)
        );
        _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);
        return oldFuses;
    }

    /**
     * @notice Extends expiry for a name
     * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')
     * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')
     * @param expiry When the name will expire in seconds since the Unix epoch
     * @return New expiry
     */

    function extendExpiry(
        bytes32 parentNode,
        bytes32 labelhash,
        uint64 expiry
    ) public returns (uint64) {
        bytes32 node = _makeNode(parentNode, labelhash);

        if (!_isWrapped(node)) {
            revert NameIsNotWrapped();
        }

        // this flag is used later, when checking fuses
        bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);
        // only allow the owner of the name or owner of the parent name
        if (!canExtendSubname && !canModifyName(node, msg.sender)) {
            revert Unauthorised(node, msg.sender);
        }

        (address owner, uint32 fuses, uint64 oldExpiry) = getData(
            uint256(node)
        );

        // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name
        if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {
            revert OperationProhibited(node);
        }

        // Max expiry is set to the expiry of the parent
        (, , uint64 maxExpiry) = getData(uint256(parentNode));
        expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);

        _setData(node, owner, fuses, expiry);
        emit ExpiryExtended(node, expiry);
        return expiry;
    }

    /**
     * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain
     * @dev Can be called by the owner or an authorised caller
     * @param name The name to upgrade, in DNS format
     * @param extraData Extra data to pass to the upgrade contract
     */

    function upgrade(bytes calldata name, bytes calldata extraData) public {
        bytes32 node = name.namehash(0);

        if (address(upgradeContract) == address(0)) {
            revert CannotUpgrade();
        }

        if (!canModifyName(node, msg.sender)) {
            revert Unauthorised(node, msg.sender);
        }

        (address currentOwner, uint32 fuses, uint64 expiry) = getData(
            uint256(node)
        );

        address approved = getApproved(uint256(node));

        _burn(uint256(node));

        upgradeContract.wrapFromUpgrade(
            name,
            currentOwner,
            fuses,
            expiry,
            approved,
            extraData
        );
    }

    /** 
    /* @notice Sets fuses of a name that you own the parent of
     * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')
     * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')
     * @param fuses Fuses to burn
     * @param expiry When the name will expire in seconds since the Unix epoch
     */

    function setChildFuses(
        bytes32 parentNode,
        bytes32 labelhash,
        uint32 fuses,
        uint64 expiry
    ) public {
        bytes32 node = _makeNode(parentNode, labelhash);
        _checkFusesAreSettable(node, fuses);
        (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(
            uint256(node)
        );
        if (owner == address(0) || ens.owner(node) != address(this)) {
            revert NameIsNotWrapped();
        }
        // max expiry is set to the expiry of the parent
        (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));
        if (parentNode == ROOT_NODE) {
            if (!canModifyName(node, msg.sender)) {
                revert Unauthorised(node, msg.sender);
            }
        } else {
            if (!canModifyName(parentNode, msg.sender)) {
                revert Unauthorised(parentNode, msg.sender);
            }
        }

        _checkParentFuses(node, fuses, parentFuses);

        expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);

        // if PARENT_CANNOT_CONTROL has been burned and fuses have changed
        if (
            oldFuses & PARENT_CANNOT_CONTROL != 0 &&
            oldFuses | fuses != oldFuses
        ) {
            revert OperationProhibited(node);
        }
        fuses |= oldFuses;
        _setFuses(node, owner, fuses, oldExpiry, expiry);
    }

    /**
     * @notice Sets the subdomain owner in the registry and then wraps the subdomain
     * @param parentNode Parent namehash of the subdomain
     * @param label Label of the subdomain as a string
     * @param owner New owner in the wrapper
     * @param fuses Initial fuses for the wrapped subdomain
     * @param expiry When the name will expire in seconds since the Unix epoch
     * @return node Namehash of the subdomain
     */

    function setSubnodeOwner(
        bytes32 parentNode,
        string calldata label,
        address owner,
        uint32 fuses,
        uint64 expiry
    ) public onlyTokenOwner(parentNode) returns (bytes32 node) {
        bytes32 labelhash = keccak256(bytes(label));
        node = _makeNode(parentNode, labelhash);
        _checkCanCallSetSubnodeOwner(parentNode, node);
        _checkFusesAreSettable(node, fuses);
        bytes memory name = _saveLabel(parentNode, node, label);
        expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);

        if (!_isWrapped(node)) {
            ens.setSubnodeOwner(parentNode, labelhash, address(this));
            _wrap(node, name, owner, fuses, expiry);
        } else {
            _updateName(parentNode, node, label, owner, fuses, expiry);
        }
    }

    /**
     * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain
     * @param parentNode parent namehash of the subdomain
     * @param label label of the subdomain as a string
     * @param owner new owner in the wrapper
     * @param resolver resolver contract in the registry
     * @param ttl ttl in the registry
     * @param fuses initial fuses for the wrapped subdomain
     * @param expiry When the name will expire in seconds since the Unix epoch
     * @return node Namehash of the subdomain
     */

    function setSubnodeRecord(
        bytes32 parentNode,
        string memory label,
        address owner,
        address resolver,
        uint64 ttl,
        uint32 fuses,
        uint64 expiry
    ) public onlyTokenOwner(parentNode) returns (bytes32 node) {
        bytes32 labelhash = keccak256(bytes(label));
        node = _makeNode(parentNode, labelhash);
        _checkCanCallSetSubnodeOwner(parentNode, node);
        _checkFusesAreSettable(node, fuses);
        _saveLabel(parentNode, node, label);
        expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);
        if (!_isWrapped(node)) {
            ens.setSubnodeRecord(
                parentNode,
                labelhash,
                address(this),
                resolver,
                ttl
            );
            _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);
        } else {
            ens.setSubnodeRecord(
                parentNode,
                labelhash,
                address(this),
                resolver,
                ttl
            );
            _updateName(parentNode, node, label, owner, fuses, expiry);
        }
    }

    /**
     * @notice Sets records for the name in the ENS Registry
     * @param node Namehash of the name to set a record for
     * @param owner New owner in the registry
     * @param resolver Resolver contract
     * @param ttl Time to live in the registry
     */

    function setRecord(
        bytes32 node,
        address owner,
        address resolver,
        uint64 ttl
    )
        public
        onlyTokenOwner(node)
        operationAllowed(
            node,
            CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL
        )
    {
        ens.setRecord(node, address(this), resolver, ttl);
        if (owner == address(0)) {
            (, uint32 fuses, ) = getData(uint256(node));
            if (fuses & IS_DOT_ETH == IS_DOT_ETH) {
                revert IncorrectTargetOwner(owner);
            }
            _unwrap(node, address(0));
        } else {
            address oldOwner = ownerOf(uint256(node));
            _transfer(oldOwner, owner, uint256(node), 1, "");
        }
    }

    /**
     * @notice Sets resolver contract in the registry
     * @param node namehash of the name
     * @param resolver the resolver contract
     */

    function setResolver(
        bytes32 node,
        address resolver
    ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {
        ens.setResolver(node, resolver);
    }

    /**
     * @notice Sets TTL in the registry
     * @param node Namehash of the name
     * @param ttl TTL in the registry
     */

    function setTTL(
        bytes32 node,
        uint64 ttl
    ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {
        ens.setTTL(node, ttl);
    }

    /**
     * @dev Allows an operation only if none of the specified fuses are burned.
     * @param node The namehash of the name to check fuses on.
     * @param fuseMask A bitmask of fuses that must not be burned.
     */

    modifier operationAllowed(bytes32 node, uint32 fuseMask) {
        (, uint32 fuses, ) = getData(uint256(node));
        if (fuses & fuseMask != 0) {
            revert OperationProhibited(node);
        }
        _;
    }

    /**
     * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord
     * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt
     *      and checks whether the owner of the subdomain is 0x0 for creating or already exists for
     *      replacing a subdomain. If either conditions are true, then it is possible to call
     *      setSubnodeOwner
     * @param parentNode Namehash of the parent name to check
     * @param subnode Namehash of the subname to check
     */

    function _checkCanCallSetSubnodeOwner(
        bytes32 parentNode,
        bytes32 subnode
    ) internal view {
        (
            address subnodeOwner,
            uint32 subnodeFuses,
            uint64 subnodeExpiry
        ) = getData(uint256(subnode));

        // check if the registry owner is 0 and expired
        // check if the wrapper owner is 0 and expired
        // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN
        bool expired = subnodeExpiry < block.timestamp;
        if (
            expired &&
            // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired
            (subnodeOwner == address(0) ||
                // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired
                ens.owner(subnode) == address(0))
        ) {
            (, uint32 parentFuses, ) = getData(uint256(parentNode));
            if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {
                revert OperationProhibited(subnode);
            }
        } else {
            if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {
                revert OperationProhibited(subnode);
            }
        }
    }

    /**
     * @notice Checks all Fuses in the mask are burned for the node
     * @param node Namehash of the name
     * @param fuseMask The fuses you want to check
     * @return Boolean of whether or not all the selected fuses are burned
     */

    function allFusesBurned(
        bytes32 node,
        uint32 fuseMask
    ) public view returns (bool) {
        (, uint32 fuses, ) = getData(uint256(node));
        return fuses & fuseMask == fuseMask;
    }

    /**
     * @notice Checks if a name is wrapped
     * @param node Namehash of the name
     * @return Boolean of whether or not the name is wrapped
     */

    function isWrapped(bytes32 node) public view returns (bool) {
        bytes memory name = names[node];
        if (name.length == 0) {
            return false;
        }
        (bytes32 labelhash, uint256 offset) = name.readLabel(0);
        bytes32 parentNode = name.namehash(offset);
        return isWrapped(parentNode, labelhash);
    }

    /**
     * @notice Checks if a name is wrapped in a more gas efficient way
     * @param parentNode Namehash of the name
     * @param labelhash Namehash of the name
     * @return Boolean of whether or not the name is wrapped
     */

    function isWrapped(
        bytes32 parentNode,
        bytes32 labelhash
    ) public view returns (bool) {
        bytes32 node = _makeNode(parentNode, labelhash);
        bool wrapped = _isWrapped(node);
        if (parentNode != ETH_NODE) {
            return wrapped;
        }
        try registrar.ownerOf(uint256(labelhash)) returns (address owner) {
            return owner == address(this);
        } catch {
            return false;
        }
    }

    function onERC721Received(
        address to,
        address,
        uint256 tokenId,
        bytes calldata data
    ) public returns (bytes4) {
        //check if it's the eth registrar ERC721
        if (msg.sender != address(registrar)) {
            revert IncorrectTokenType();
        }

        (
            string memory label,
            address owner,
            uint16 ownerControlledFuses,
            address resolver
        ) = abi.decode(data, (string, address, uint16, address));

        bytes32 labelhash = bytes32(tokenId);
        bytes32 labelhashFromData = keccak256(bytes(label));

        if (labelhashFromData != labelhash) {
            revert LabelMismatch(labelhashFromData, labelhash);
        }

        // transfer the ens record back to the new owner (this contract)
        registrar.reclaim(uint256(labelhash), address(this));

        uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;

        _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);

        return IERC721Receiver(to).onERC721Received.selector;
    }

    /***** Internal functions */

    function _beforeTransfer(
        uint256 id,
        uint32 fuses,
        uint64 expiry
    ) internal override {
        // For this check, treat .eth 2LDs as expiring at the start of the grace period.
        if (fuses & IS_DOT_ETH == IS_DOT_ETH) {
            expiry -= GRACE_PERIOD;
        }

        if (expiry < block.timestamp) {
            // Transferable if the name was not emancipated
            if (fuses & PARENT_CANNOT_CONTROL != 0) {
                revert("IB");
            }
        } else {
            // Transferable if CANNOT_TRANSFER is unburned
            if (fuses & CANNOT_TRANSFER != 0) {
                revert OperationProhibited(bytes32(id));
            }
        }

        // delete token approval if CANNOT_APPROVE has not been burnt
        if (fuses & CANNOT_APPROVE == 0) {
            delete _tokenApprovals[id];
        }
    }

    function _clearOwnerAndFuses(
        address owner,
        uint32 fuses,
        uint64 expiry
    ) internal view override returns (address, uint32) {
        if (expiry < block.timestamp) {
            if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {
                owner = address(0);
            }
            fuses = 0;
        }

        return (owner, fuses);
    }

    function _makeNode(
        bytes32 node,
        bytes32 labelhash
    ) private pure returns (bytes32) {
        return keccak256(abi.encodePacked(node, labelhash));
    }

    function _addLabel(
        string memory label,
        bytes memory name
    ) internal pure returns (bytes memory ret) {
        if (bytes(label).length < 1) {
            revert LabelTooShort();
        }
        if (bytes(label).length > 255) {
            revert LabelTooLong(label);
        }
        return abi.encodePacked(uint8(bytes(label).length), label, name);
    }

    function _mint(
        bytes32 node,
        address owner,
        uint32 fuses,
        uint64 expiry
    ) internal virtual override {
        _canFusesBeBurned(node, fuses);
        (address oldOwner, , ) = super.getData(uint256(node));
        if (oldOwner != address(0)) {
            // burn and unwrap old token of old owner
            _burn(uint256(node));
            emit NameUnwrapped(node, address(0));
        }
        super._mint(node, owner, fuses, expiry);
    }

    function _wrap(
        bytes32 node,
        bytes memory name,
        address wrappedOwner,
        uint32 fuses,
        uint64 expiry
    ) internal {
        _mint(node, wrappedOwner, fuses, expiry);
        emit NameWrapped(node, name, wrappedOwner, fuses, expiry);
    }

    function _storeNameAndWrap(
        bytes32 parentNode,
        bytes32 node,
        string memory label,
        address owner,
        uint32 fuses,
        uint64 expiry
    ) internal {
        bytes memory name = _addLabel(label, names[parentNode]);
        _wrap(node, name, owner, fuses, expiry);
    }

    function _saveLabel(
        bytes32 parentNode,
        bytes32 node,
        string memory label
    ) internal returns (bytes memory) {
        bytes memory name = _addLabel(label, names[parentNode]);
        names[node] = name;
        return name;
    }

    function _updateName(
        bytes32 parentNode,
        bytes32 node,
        string memory label,
        address owner,
        uint32 fuses,
        uint64 expiry
    ) internal {
        (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(
            uint256(node)
        );
        bytes memory name = _addLabel(label, names[parentNode]);
        if (names[node].length == 0) {
            names[node] = name;
        }
        _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);
        if (owner == address(0)) {
            _unwrap(node, address(0));
        } else {
            _transfer(oldOwner, owner, uint256(node), 1, "");
        }
    }

    // wrapper function for stack limit
    function _checkParentFusesAndExpiry(
        bytes32 parentNode,
        bytes32 node,
        uint32 fuses,
        uint64 expiry
    ) internal view returns (uint64) {
        (, , uint64 oldExpiry) = getData(uint256(node));
        (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));
        _checkParentFuses(node, fuses, parentFuses);
        return _normaliseExpiry(expiry, oldExpiry, maxExpiry);
    }

    function _checkParentFuses(
        bytes32 node,
        uint32 fuses,
        uint32 parentFuses
    ) internal pure {
        bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=
            0;

        bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;

        if (isBurningParentControlledFuses && parentHasNotBurnedCU) {
            revert OperationProhibited(node);
        }
    }

    function _normaliseExpiry(
        uint64 expiry,
        uint64 oldExpiry,
        uint64 maxExpiry
    ) private pure returns (uint64) {
        // Expiry cannot be more than maximum allowed
        // .eth names will check registrar, non .eth check parent
        if (expiry > maxExpiry) {
            expiry = maxExpiry;
        }
        // Expiry cannot be less than old expiry
        if (expiry < oldExpiry) {
            expiry = oldExpiry;
        }

        return expiry;
    }

    function _wrapETH2LD(
        string memory label,
        address wrappedOwner,
        uint32 fuses,
        uint64 expiry,
        address resolver
    ) private {
        bytes32 labelhash = keccak256(bytes(label));
        bytes32 node = _makeNode(ETH_NODE, labelhash);
        // hardcode dns-encoded eth string for gas savings
        bytes memory name = _addLabel(label, names[ETH_NODE]);
        names[node] = name;

        _wrap(
            node,
            name,
            wrappedOwner,
            fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,
            expiry
        );

        if (resolver != address(0)) {
            ens.setResolver(node, resolver);
        }
    }

    function _unwrap(bytes32 node, address owner) private {
        if (allFusesBurned(node, CANNOT_UNWRAP)) {
            revert OperationProhibited(node);
        }

        // Burn token and fuse data
        _burn(uint256(node));
        ens.setOwner(node, owner);

        emit NameUnwrapped(node, owner);
    }

    function _setFuses(
        bytes32 node,
        address owner,
        uint32 fuses,
        uint64 oldExpiry,
        uint64 expiry
    ) internal {
        _setData(node, owner, fuses, expiry);
        emit FusesSet(node, fuses);
        if (expiry > oldExpiry) {
            emit ExpiryExtended(node, expiry);
        }
    }

    function _setData(
        bytes32 node,
        address owner,
        uint32 fuses,
        uint64 expiry
    ) internal {
        _canFusesBeBurned(node, fuses);
        super._setData(uint256(node), owner, fuses, expiry);
    }

    function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {
        // If a non-parent controlled fuse is being burned, check PCC and CU are burnt
        if (
            fuses & ~PARENT_CONTROLLED_FUSES != 0 &&
            fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=
            (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)
        ) {
            revert OperationProhibited(node);
        }
    }

    function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {
        if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {
            // Cannot directly burn other non-user settable fuses
            revert OperationProhibited(node);
        }
    }

    function _isWrapped(bytes32 node) internal view returns (bool) {
        return
            ownerOf(uint256(node)) != address(0) &&
            ens.owner(node) == address(this);
    }

    function _isETH2LDInGracePeriod(
        uint32 fuses,
        uint64 expiry
    ) internal view returns (bool) {
        return
            fuses & IS_DOT_ETH == IS_DOT_ETH &&
            expiry - GRACE_PERIOD < block.timestamp;
    }
}

File 23 of 24 : NameWrapper721.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "./NameWrapper.sol";

abstract contract NameWrapper721 is NameWrapper {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(
        address indexed from,
        address indexed to,
        uint256 indexed tokenId
    );

    constructor(
        ENS _ens,
        IBaseRegistrar _registrar,
        IMetadataService _metadataService,
        string memory _ethNode
    ) NameWrapper(_ens, _registrar, _metadataService, _ethNode) {}

    function balanceOf(address owner) external view returns (uint256) {}

    function _mint(
        bytes32 node,
        address owner,
        uint32 fuses,
        uint64 expiry
    ) internal virtual override {
        super._mint(node, owner, fuses, expiry);
        emit Transfer(address(0), owner, uint256(node));
    }

    function _burn(uint256 tokenId) internal virtual override {
        (address oldOwner, , ) = ERC1155Fuse.getData(tokenId);
        super._burn(tokenId);
        emit Transfer(oldOwner, address(0), tokenId);
    }

    function _transfer(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual override {
        super._transfer(from, to, id, amount, data);
        emit Transfer(from, to, id);
    }

    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override(ERC1155Fuse, IERC1155) {
        super.safeBatchTransferFrom(from, to, ids, amounts, data);

        unchecked {
            uint256 idsLength = ids.length;
            for (uint256 i; i < idsLength; ++i) {
                emit Transfer(from, to, ids[i]);
            }
        }
    }

    function transferFrom(address from, address to, uint256 tokenId) public {
        safeTransferFrom(from, to, tokenId, 1, "");
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public {
        safeTransferFrom(from, to, tokenId, 1, "");
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) public {
        safeTransferFrom(from, to, tokenId, 1, data);
    }

    function tokenURI(uint256 _tokenId) public view returns (string memory) {
        return uri(_tokenId);
    }
}

File 24 of 24 : TownDomains.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "./NameWrapper721.sol";

contract TownDomains is NameWrapper721 {
    string public constant name = "Bored Town Domains";
    string public constant symbol = ".town";
    string public constant contractURI =
        "https://metadata.opti.domains/collection/domains/town";

    constructor(
        ENS _ens,
        IBaseRegistrar _registrar,
        IMetadataService _metadataService,
        string memory _ethNode
    ) NameWrapper721(_ens, _registrar, _metadataService, _ethNode) {}
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract ENS","name":"_ens","type":"address"},{"internalType":"contract IBaseRegistrar","name":"_registrar","type":"address"},{"internalType":"contract IMetadataService","name":"_metadataService","type":"address"},{"internalType":"string","name":"_ethNode","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CannotUpgrade","type":"error"},{"inputs":[],"name":"IncompatibleParent","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"IncorrectTargetOwner","type":"error"},{"inputs":[],"name":"IncorrectTokenType","type":"error"},{"inputs":[{"internalType":"bytes32","name":"labelHash","type":"bytes32"},{"internalType":"bytes32","name":"expectedLabelhash","type":"bytes32"}],"name":"LabelMismatch","type":"error"},{"inputs":[{"internalType":"string","name":"label","type":"string"}],"name":"LabelTooLong","type":"error"},{"inputs":[],"name":"LabelTooShort","type":"error"},{"inputs":[],"name":"NameIsNotWrapped","type":"error"},{"inputs":[],"name":"NotController","type":"error"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"OperationProhibited","type":"error"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"addr","type":"address"}],"name":"Unauthorised","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"controller","type":"address"},{"indexed":false,"internalType":"bool","name":"active","type":"bool"}],"name":"ControllerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"expiry","type":"uint64"}],"name":"ExpiryExtended","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"fuses","type":"uint32"}],"name":"FusesSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"NameUnwrapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"name","type":"bytes"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint32","name":"fuses","type":"uint32"},{"indexed":false,"internalType":"uint64","name":"expiry","type":"uint64"}],"name":"NameWrapped","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":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_tokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint32","name":"fuseMask","type":"uint32"}],"name":"allFusesBurned","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"addr","type":"address"}],"name":"canExtendSubnames","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"addr","type":"address"}],"name":"canModifyName","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"controllers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ens","outputs":[{"internalType":"contract ENS","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"parentNode","type":"bytes32"},{"internalType":"bytes32","name":"labelhash","type":"bytes32"},{"internalType":"uint64","name":"expiry","type":"uint64"}],"name":"extendExpiry","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"operator","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getData","outputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint32","name":"fuses","type":"uint32"},{"internalType":"uint64","name":"expiry","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"parentNode","type":"bytes32"},{"internalType":"bytes32","name":"labelhash","type":"bytes32"}],"name":"isWrapped","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"isWrapped","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metadataService","outputs":[{"internalType":"contract IMetadataService","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"names","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"recoverFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"label","type":"string"},{"internalType":"address","name":"wrappedOwner","type":"address"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"address","name":"resolver","type":"address"},{"internalType":"uint16","name":"ownerControlledFuses","type":"uint16"}],"name":"registerAndWrapETH2LD","outputs":[{"internalType":"uint256","name":"registrarExpiry","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"registrar","outputs":[{"internalType":"contract IBaseRegistrar","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"renew","outputs":[{"internalType":"uint256","name":"expires","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","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":"bytes32","name":"parentNode","type":"bytes32"},{"internalType":"bytes32","name":"labelhash","type":"bytes32"},{"internalType":"uint32","name":"fuses","type":"uint32"},{"internalType":"uint64","name":"expiry","type":"uint64"}],"name":"setChildFuses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"controller","type":"address"},{"internalType":"bool","name":"active","type":"bool"}],"name":"setController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint16","name":"ownerControlledFuses","type":"uint16"}],"name":"setFuses","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IMetadataService","name":"_metadataService","type":"address"}],"name":"setMetadataService","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"resolver","type":"address"},{"internalType":"uint64","name":"ttl","type":"uint64"}],"name":"setRecord","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"resolver","type":"address"}],"name":"setResolver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"parentNode","type":"bytes32"},{"internalType":"string","name":"label","type":"string"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint32","name":"fuses","type":"uint32"},{"internalType":"uint64","name":"expiry","type":"uint64"}],"name":"setSubnodeOwner","outputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"parentNode","type":"bytes32"},{"internalType":"string","name":"label","type":"string"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"resolver","type":"address"},{"internalType":"uint64","name":"ttl","type":"uint64"},{"internalType":"uint32","name":"fuses","type":"uint32"},{"internalType":"uint64","name":"expiry","type":"uint64"}],"name":"setSubnodeRecord","outputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint64","name":"ttl","type":"uint64"}],"name":"setTTL","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract INameWrapperUpgrade","name":"_upgradeAddress","type":"address"}],"name":"setUpgradeContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"parentNode","type":"bytes32"},{"internalType":"bytes32","name":"labelhash","type":"bytes32"},{"internalType":"address","name":"controller","type":"address"}],"name":"unwrap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"labelhash","type":"bytes32"},{"internalType":"address","name":"registrant","type":"address"},{"internalType":"address","name":"controller","type":"address"}],"name":"unwrapETH2LD","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"name","type":"bytes"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upgradeContract","outputs":[{"internalType":"contract INameWrapperUpgrade","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"name","type":"bytes"},{"internalType":"address","name":"wrappedOwner","type":"address"},{"internalType":"address","name":"resolver","type":"address"}],"name":"wrap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"label","type":"string"},{"internalType":"address","name":"wrappedOwner","type":"address"},{"internalType":"uint16","name":"ownerControlledFuses","type":"uint16"},{"internalType":"address","name":"resolver","type":"address"}],"name":"wrapETH2LD","outputs":[{"internalType":"uint64","name":"expiry","type":"uint64"}],"stateMutability":"nonpayable","type":"function"}]

6101006040523480156200001257600080fd5b506040516200681e3803806200681e833981016040819052620000359162000478565b838383838383838383336200005081620003d3565b620003d3565b6040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e260048201526000906001600160a01b038416906302571be390602401602060405180830381865afa158015620000b8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000de919062000571565b604051630f41a04d60e11b81526001600160a01b03848116600483015291925090821690631e83409a906024016020604051808303816000875af11580156200012b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000151919062000598565b505050506001600160a01b0384811660805283811660a052600580546001600160a01b03191691841691909117905580516020808301919091206040805160009381019390935282015260600160408051808303601f19018152918152815160209283012060c081905283518484012060e052600090815260019092529020600163fffeffff60a01b03199055600080526001602052600163fffeffff60a01b03197fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb4955604080518082019091526001815260006020808301829052908052600690527f54cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f89062000262908262000641565b50806040516020016200027691906200070d565b60408051601f1981840301815291815260c051600090815260066020522090620002a1908262000641565b5060c0516000908152600660205260409020805460029190620002c490620005b2565b620002d19291506200073d565b60f81b6006600060c051815260200190815260200160002060008154620002f890620005b2565b811062000309576200030962000765565b815460011615620003295790600052602060002090602091828204019190065b601f036101000a81548160ff02191690600160f81b84040217905550620003c16080516001600160a01b03166302571be36000801b6040518263ffffffff1660e01b81526004016200037d91815260200190565b602060405180830381865afa1580156200039b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200004a919062000571565b5050505050505050505050506200077b565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200043957600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b838110156200046f57818101518382015260200162000455565b50506000910152565b600080600080608085870312156200048f57600080fd5b84516200049c8162000423565b6020860151909450620004af8162000423565b6040860151909350620004c28162000423565b60608601519092506001600160401b0380821115620004e057600080fd5b818701915087601f830112620004f557600080fd5b8151818111156200050a576200050a6200043c565b604051601f8201601f19908116603f011681019083821181831017156200053557620005356200043c565b816040528281528a60208487010111156200054f57600080fd5b6200056283602083016020880162000452565b979a9699509497505050505050565b6000602082840312156200058457600080fd5b8151620005918162000423565b9392505050565b600060208284031215620005ab57600080fd5b5051919050565b600181811c90821680620005c757607f821691505b602082108103620005e857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200063c57600081815260208120601f850160051c81016020861015620006175750805b601f850160051c820191505b81811015620006385782815560010162000623565b5050505b505050565b81516001600160401b038111156200065d576200065d6200043c565b62000675816200066e8454620005b2565b84620005ee565b602080601f831160018114620006ad5760008415620006945750858301515b600019600386901b1c1916600185901b17855562000638565b600085815260208120601f198616915b82811015620006de57888601518255948401946001909101908401620006bd565b5085821015620006fd5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008152600082516200072881600185016020870162000452565b60006001939091019283015250600201919050565b818103818111156200075f57634e487b7160e01b600052601160045260246000fd5b92915050565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c05160e051615f4d620008d1600039600050506000818161196f01528181611a1d01528181611c6d0152818161240701528181612c2401528181612d1401528181612f480152818161365f01526136b901526000818161056601528181610d0101528181610ddb01528181610e6501528181611ab101528181611b4701528181611bf501528181611d1701528181611d8d01528181611e0d0152818161202901528181612165015281816122a401528181612492015281816125180152612d580152600081816105b301528181610c8701528181610fd0015281816111a101528181611253015281816113c6015281816121ea01528181612329015281816125c3015281816127ba01528181612ad301528181612f9f0152818161304d015281816131160152818161318f015281816137d7015281816138f201528181613ad701526141280152615f4d6000f3fe608060405234801561001057600080fd5b506004361061036c5760003560e01c80636e5d6ad2116101d3578063c87b56dd11610104578063e8a3d485116100a2578063ed70554d1161007c578063ed70554d14610895578063f242432a146108b5578063f2fde38b146108c8578063fd0cd0d9146108db57600080fd5b8063e8a3d4851461083e578063e985e9c514610846578063eb8ae5301461088257600080fd5b8063d8c9921a116100de578063d8c9921a146107e2578063d9a50c12146107f5578063da8c229e14610808578063e0dba60f1461082b57600080fd5b8063c87b56dd146107a9578063c93ab3fd146107bc578063cf408823146107cf57600080fd5b8063a22cb46511610171578063b6bcad261161014b578063b6bcad261461075d578063b88d4fde14610770578063c475abff14610783578063c658e0861461079657600080fd5b8063a22cb46514610724578063a401498214610737578063adf4960a1461074a57600080fd5b80638b4dfa75116101ad5780638b4dfa75146106b15780638cf8b41e146106c45780638da5cb5b146106d757806395d89b41146106e857600080fd5b80636e5d6ad21461066957806370a0823114610695578063715018a6146106a957600080fd5b806320c38e2b116102ad578063402906fc1161024b5780634e1273f4116102255780634e1273f41461061057806353095467146106305780635d3590d5146106435780636352211e1461065657600080fd5b8063402906fc146105d557806341415eab146105fd57806342842e0e1461053b57600080fd5b80632b20e397116102875780632b20e397146105615780632eb2c2d61461058857806333c69ea91461059b5780633f15457f146105ae57600080fd5b806320c38e2b1461052857806323b872dd1461053b57806324c1af441461054e57600080fd5b80630e4cd7251161031a578063150b7a02116102f4578063150b7a02146104c35780631534e177146104ef5780631896f70a146105025780631f4e15041461051557600080fd5b80630e4cd7251461048a5780630e89341c1461049d57806314ab9038146104b057600080fd5b806306fdde031161034b57806306fdde0314610401578063081812fc1461044a578063095ea7b31461047557600080fd5b8062fdd58e146103715780630178fe3f1461039757806301ffc9a7146103de575b600080fd5b61038461037f366004614d47565b6108ee565b6040519081526020015b60405180910390f35b6103aa6103a5366004614d73565b610987565b604080516001600160a01b03909416845263ffffffff909216602084015267ffffffffffffffff169082015260600161038e565b6103f16103ec366004614da2565b6109b7565b604051901515815260200161038e565b61043d6040518060400160405280601281526020017f426f72656420546f776e20446f6d61696e73000000000000000000000000000081525081565b60405161038e9190614e0f565b61045d610458366004614d73565b610a44565b6040516001600160a01b03909116815260200161038e565b610488610483366004614d47565b610a89565b005b6103f1610498366004614e22565b610acf565b61043d6104ab366004614d73565b610b69565b6104886104be366004614e6f565b610bdb565b6104d66104d1366004614ee4565b610cf4565b6040516001600160e01b0319909116815260200161038e565b6104886104fd366004614f57565b610f06565b610488610510366004614e22565b610f3d565b60075461045d906001600160a01b031681565b61043d610536366004614d73565b610fff565b610488610549366004614f74565b611099565b61038461055c366004615090565b6110b6565b61045d7f000000000000000000000000000000000000000000000000000000000000000081565b6104886105963660046151b8565b6112ca565b6104886105a9366004615266565b61134f565b61045d7f000000000000000000000000000000000000000000000000000000000000000081565b6105e86105e33660046152be565b611544565b60405163ffffffff909116815260200161038e565b6103f161060b366004614e22565b6115e6565b61062361061e3660046152e1565b611643565b60405161038e91906153df565b60055461045d906001600160a01b031681565b610488610651366004614f74565b61175b565b61045d610664366004614d73565b6117f5565b61067c6106773660046153f2565b611800565b60405167ffffffffffffffff909116815260200161038e565b6103846106a3366004614f57565b50600090565b610488611955565b6104886106bf366004615427565b611969565b61067c6106d2366004615469565b611b13565b6000546001600160a01b031661045d565b61043d6040518060400160405280600581526020017f2e746f776e00000000000000000000000000000000000000000000000000000081525081565b6104886107323660046154f2565b611edf565b610384610745366004615520565b611fa3565b6103f16107583660046155a1565b6120fe565b61048861076b366004614f57565b612123565b61048861077e366004614ee4565b61238d565b6103846107913660046155c4565b6123d1565b6103846107a43660046155e6565b612688565b61043d6107b7366004614d73565b612895565b6104886107ca366004615659565b6128a0565b6104886107dd3660046156c5565b612a11565b6104886107f03660046156fd565b612bca565b6103f16108033660046155c4565b612cda565b6103f1610816366004614f57565b60046020526000908152604090205460ff1681565b6104886108393660046154f2565b612de7565b61043d612e4f565b6103f161085436600461572b565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b610488610890366004615759565b612e6b565b6103846108a3366004614d73565b60016020526000908152604090205481565b6104886108c33660046157c1565b613236565b6104886108d6366004614f57565b613304565b6103f16108e9366004614d73565b613391565b60006001600160a01b03831661094b5760405162461bcd60e51b815260206004820152600260248201527f425100000000000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b6000610956836117f5565b9050836001600160a01b0316816001600160a01b03160361097b576001915050610981565b60009150505b92915050565b60008181526001602052604090205460a081901c60c082901c6109ab838383613469565b90959094509092509050565b60006001600160e01b031982167fd82c42d8000000000000000000000000000000000000000000000000000000001480610a0157506001600160e01b03198216630a85bd0160e11b145b80610a3557506001600160e01b031982167f80ac58cd00000000000000000000000000000000000000000000000000000000145b806109815750610981826134a0565b600080610a50836117f5565b90506001600160a01b038116610a695750600092915050565b6000838152600360205260409020546001600160a01b03165b9392505050565b6000610a9482610987565b50915050603f196040821601610ac05760405163a2a7201360e01b815260048101839052602401610942565b610aca8383613522565b505050565b6000808080610add86610987565b925092509250846001600160a01b0316836001600160a01b03161480610b2857506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff165b80610b4c57506001600160a01b038516610b4187610a44565b6001600160a01b0316145b8015610b5f5750610b5d8282613620565b155b9695505050505050565b6005546040516303a24d0760e21b8152600481018390526060916001600160a01b031690630e89341c90602401600060405180830381865afa158015610bb3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610981919081019061582a565b81610be681336115e6565b610c0c5760405163168ab55d60e31b815260048101829052336024820152604401610942565b8260106000610c1a83610987565b5091505063ffffffff8282161615610c485760405163a2a7201360e01b815260048101849052602401610942565b6040517f14ab90380000000000000000000000000000000000000000000000000000000081526004810187905267ffffffffffffffff861660248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906314ab9038906044015b600060405180830381600087803b158015610cd457600080fd5b505af1158015610ce8573d6000803e3d6000fd5b50505050505050505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610d58576040517f1931a53800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080610d69868801886158a2565b83516020850120939750919550935091508890808214610dbf576040517fc65c3ccc0000000000000000000000000000000000000000000000000000000081526004810182905260248101839052604401610942565b604051630a3b53db60e21b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906328ed4f6c90604401600060405180830381600087803b158015610e2757600080fd5b505af1158015610e3b573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018d9052600092506276a70091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d6e4fa8690602401602060405180830381865afa158015610eac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed0919061590a565b610eda9190615939565b9050610eed87878761ffff168488613651565b50630a85bd0160e11b9c9b505050505050505050505050565b610f0e61383d565b6005805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b81610f4881336115e6565b610f6e5760405163168ab55d60e31b815260048101829052336024820152604401610942565b8260086000610f7c83610987565b5091505063ffffffff8282161615610faa5760405163a2a7201360e01b815260048101849052602401610942565b604051630c4b7b8560e11b8152600481018790526001600160a01b0386811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401610cba565b6006602052600090815260409020805461101890615961565b80601f016020809104026020016040519081016040528092919081815260200182805461104490615961565b80156110915780601f1061106657610100808354040283529160200191611091565b820191906000526020600020905b81548152906001019060200180831161107457829003601f168201915b505050505081565b610aca838383600160405180602001604052806000815250613236565b6000876110c381336115e6565b6110e95760405163168ab55d60e31b815260048101829052336024820152604401610942565b875160208901206111218a82604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b925061112d8a84613897565b61113783866139d6565b6111428a848b613a09565b5061114f8a848787613a53565b935061115a83613a99565b611210576040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156111e557600080fd5b505af11580156111f9573d6000803e3d6000fd5b5050505061120b8a848b8b8989613b52565b6112bd565b6040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561129757600080fd5b505af11580156112ab573d6000803e3d6000fd5b505050506112bd8a848b8b8989613b80565b5050979650505050505050565b6112d78585858585613c44565b825160005b81811015611346578481815181106112f6576112f661599b565b6020026020010151866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46001016112dc565b50505050505050565b6040805160208082018790528183018690528251808303840181526060909201909252805191012061138181846139d6565b6000808061138e84610987565b919450925090506001600160a01b038316158061143d57506040516302571be360e01b81526004810185905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa15801561140d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143191906159b1565b6001600160a01b031614155b1561145b57604051635374b59960e01b815260040160405180910390fd5b6000806114678a610987565b90935091508a90506114a85761147d86336115e6565b6114a35760405163168ab55d60e31b815260048101879052336024820152604401610942565b6114d8565b6114b28a336115e6565b6114d85760405163168ab55d60e31b8152600481018b9052336024820152604401610942565b6114e3868984613ee3565b6114ee878483613f1e565b96506201000084161580159061151257508363ffffffff1688851763ffffffff1614155b156115335760405163a2a7201360e01b815260048101879052602401610942565b96831796610ce886868a868b613f68565b60008261155181336115e6565b6115775760405163168ab55d60e31b815260048101829052336024820152604401610942565b836002600061158583610987565b5091505063ffffffff82821616156115b35760405163a2a7201360e01b815260048101849052602401610942565b600080806115c08a610987565b9250925092506115d98a84848c61ffff16178485613f68565b5098975050505050505050565b60008080806115f486610987565b925092509250846001600160a01b0316836001600160a01b03161480610b4c57506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff16610b4c565b606081518351146116965760405162461bcd60e51b815260206004820152600260248201527f41490000000000000000000000000000000000000000000000000000000000006044820152606401610942565b6000835167ffffffffffffffff8111156116b2576116b2614fb5565b6040519080825280602002602001820160405280156116db578160200160208202803683370190505b50905060005b8451811015611753576117268582815181106116ff576116ff61599b565b60200260200101518583815181106117195761171961599b565b60200260200101516108ee565b8282815181106117385761173861599b565b602090810291909101015261174c816159ce565b90506116e1565b509392505050565b61176361383d565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af11580156117cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ef91906159e7565b50505050565b600061098182614012565b6040805160208082018690528183018590528251808303840181526060909201909252805191012060009061183481613a99565b61185157604051635374b59960e01b815260040160405180910390fd5b600061185d8633610acf565b905080158015611874575061187282336115e6565b155b1561189b5760405163168ab55d60e31b815260048101839052336024820152604401610942565b600080806118a885610987565b925092509250831580156118bf5750620400008216155b156118e05760405163a2a7201360e01b815260048101869052602401610942565b60006118eb8a610987565b925050506118fa888383613f1e565b97506119088685858b614028565b60405167ffffffffffffffff8916815286907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b1329060200160405180910390a2509598975050505050505050565b61195d61383d565b6119676000614070565b565b604080517f0000000000000000000000000000000000000000000000000000000000000000602080830191909152818301869052825180830384018152606090920190925280519101206119bd81336115e6565b6119e35760405163168ab55d60e31b815260048101829052336024820152604401610942565b306001600160a01b03841603611a1757604051632ca49b0d60e11b81526001600160a01b0384166004820152602401610942565b604080517f000000000000000000000000000000000000000000000000000000000000000060208083019190915281830187905282518083038401815260609092019092528051910120611a6c905b836140cd565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038481166024830152604482018690527f000000000000000000000000000000000000000000000000000000000000000016906342842e0e90606401600060405180830381600087803b158015611af557600080fd5b505af1158015611b09573d6000803e3d6000fd5b5050505050505050565b6000808686604051611b26929190615a04565b6040519081900381206331a9108f60e11b82526004820181905291506000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611b96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bba91906159b1565b90506001600160a01b0381163314801590611c62575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015611c3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c6091906159e7565b155b15611cd257604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091528183018590528251808303840181526060830193849052805191012063168ab55d60e31b909252606481019190915233608482015260a401610942565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152306024830152604482018490527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90606401600060405180830381600087803b158015611d5b57600080fd5b505af1158015611d6f573d6000803e3d6000fd5b5050604051630a3b53db60e21b8152600481018590523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506328ed4f6c9150604401600060405180830381600087803b158015611ddb57600080fd5b505af1158015611def573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018590526276a70092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063d6e4fa8690602401602060405180830381865afa158015611e5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e81919061590a565b611e8b9190615939565b9250611ed488888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff88168688613651565b505095945050505050565b6001600160a01b0382163303611f375760405162461bcd60e51b815260206004820152600360248201527f53415300000000000000000000000000000000000000000000000000000000006044820152606401610942565b3360008181526002602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3360009081526004602052604081205460ff16611fd3576040516323019e6760e01b815260040160405180910390fd5b60008787604051611fe5929190615a04565b6040519081900381207ffca247ac000000000000000000000000000000000000000000000000000000008252600482018190523060248301526044820187905291507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fca247ac906064016020604051808303816000875af115801561207a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209e919061590a565b91506120f388888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff86166120ed6276a70087615939565b88613651565b509695505050505050565b60008061210a84610987565b50841663ffffffff908116908516149250505092915050565b61212b61383d565b6007546001600160a01b03161561224b5760075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156121ab57600080fd5b505af11580156121bf573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561223257600080fd5b505af1158015612246573d6000803e3d6000fd5b505050505b6007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091551561238a5760075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156122ea57600080fd5b505af11580156122fe573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561237157600080fd5b505af1158015612385573d6000803e3d6000fd5b505050505b50565b612385858585600186868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061323692505050565b3360009081526004602052604081205460ff16612401576040516323019e6760e01b815260040160405180910390fd5b604080517f0000000000000000000000000000000000000000000000000000000000000000602080830191909152818301869052825180830384018152606090920190925280519101206000906040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101869052602481018590529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c475abff906044016020604051808303816000875af11580156124db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ff919061590a565b6040516331a9108f60e11b8152600481018790529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015612583575060408051601f3d908101601f19168201909252612580918101906159b1565b60015b6125905791506109819050565b6001600160a01b0381163014158061263a57506040516302571be360e01b81526004810184905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa15801561260a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061262e91906159b1565b6001600160a01b031614155b15612649575091506109819050565b5060006126596276a70083615939565b60008481526001602052604090205490915060a081901c61267c85838386614028565b50919695505050505050565b60008661269581336115e6565b6126bb5760405163168ab55d60e31b815260048101829052336024820152604401610942565b600087876040516126cd929190615a04565b604051809103902090506127088982604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506127148984613897565b61271e83866139d6565b60006127618a858b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613a0992505050565b905061276f8a858888613a53565b945061277a84613a99565b612842576040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018b9052602481018390523060448201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906306ab5923906064016020604051808303816000875af115801561280b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061282f919061590a565b5061283d84828989896141bf565b612888565b6128888a858b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c91508b9050613b80565b5050509695505050505050565b606061098182610b69565b60006128e6600086868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506142019050565b6007549091506001600160a01b031661292b576040517f24c1d6d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61293581336115e6565b61295b5760405163168ab55d60e31b815260048101829052336024820152604401610942565b6000808061296884610987565b91945092509050600061297a85610a44565b9050612985856142c0565b600760009054906101000a90046001600160a01b03166001600160a01b0316639198c2768a8a878787878e8e6040518963ffffffff1660e01b81526004016129d4989796959493929190615a3d565b600060405180830381600087803b1580156129ee57600080fd5b505af1158015612a02573d6000803e3d6000fd5b50505050505050505050505050565b83612a1c81336115e6565b612a425760405163168ab55d60e31b815260048101829052336024820152604401610942565b84601c6000612a5083610987565b5091505063ffffffff8282161615612a7e5760405163a2a7201360e01b815260048101849052602401610942565b6040517fcf408823000000000000000000000000000000000000000000000000000000008152600481018990523060248201526001600160a01b03878116604483015267ffffffffffffffff871660648301527f0000000000000000000000000000000000000000000000000000000000000000169063cf40882390608401600060405180830381600087803b158015612b1757600080fd5b505af1158015612b2b573d6000803e3d6000fd5b5050506001600160a01b0388169050612b92576000612b4989610987565b509150506201ffff1962020000821601612b8157604051632ca49b0d60e11b81526001600160a01b0389166004820152602401610942565b612b8c8960006140cd565b50611b09565b6000612b9d896117f5565b9050612bbf81898b60001c600160405180602001604052806000815250614314565b505050505050505050565b60408051602080820186905281830185905282518083038401815260609092019092528051910120612bfc81336115e6565b612c225760405163168ab55d60e31b815260048101829052336024820152604401610942565b7f00000000000000000000000000000000000000000000000000000000000000008403612c625760405163615a470360e01b815260040160405180910390fd5b6001600160a01b0382161580612c8057506001600160a01b03821630145b15612ca957604051632ca49b0d60e11b81526001600160a01b0383166004820152602401610942565b604080516020808201879052818301869052825180830384018152606090920190925280519101206117ef90611a66565b604080516020808201859052818301849052825180830384018152606090920190925280519101206000906000612d1082613a99565b90507f00000000000000000000000000000000000000000000000000000000000000008514612d425791506109819050565b6040516331a9108f60e11b8152600481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015612dc3575060408051601f3d908101601f19168201909252612dc0918101906159b1565b60015b612dd257600092505050610981565b6001600160a01b031630149250610981915050565b612def61383d565b6001600160a01b038216600081815260046020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf8791015b60405180910390a25050565b604051806060016040528060358152602001615ee36035913981565b600080612eb2600087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506143699050565b915091506000612efb8288888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506142019050565b604080516020808201849052818301879052825180830384018152606090920190925280519101209091506000906000818152600660205260409020909150612f45888a83615aec565b507f00000000000000000000000000000000000000000000000000000000000000008203612f865760405163615a470360e01b815260040160405180910390fd5b6040516302571be360e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015612fee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301291906159b1565b90506001600160a01b03811633148015906130ba575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015613094573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130b891906159e7565b155b156130e15760405163168ab55d60e31b815260048101839052336024820152604401610942565b6001600160a01b0386161561317357604051630c4b7b8560e11b8152600481018390526001600160a01b0387811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b15801561315a57600080fd5b505af115801561316e573d6000803e3d6000fd5b505050505b604051635b0fc9c360e01b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635b0fc9c390604401600060405180830381600087803b1580156131db57600080fd5b505af11580156131ef573d6000803e3d6000fd5b50505050612bbf828a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508d935091508190506141bf565b6001600160a01b0384166132715760405162461bcd60e51b81526020600482015260026024820152612a2d60f11b6044820152606401610942565b6001600160a01b0385163314806132ab57506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b6132f75760405162461bcd60e51b815260206004820152600360248201527f434e4f00000000000000000000000000000000000000000000000000000000006044820152606401610942565b6123858585858585614314565b61330c61383d565b6001600160a01b0381166133885760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610942565b61238a81614070565b600081815260066020526040812080548291906133ad90615961565b80601f01602080910402602001604051908101604052809291908181526020018280546133d990615961565b80156134265780601f106133fb57610100808354040283529160200191613426565b820191906000526020600020905b81548152906001019060200180831161340957829003601f168201915b50505050509050805160000361343f5750600092915050565b60008061344c8382614369565b9092509050600061345d8483614201565b9050610b5f8184612cda565b600080428367ffffffffffffffff1610156134975761ffff196201000085160161349257600094505b600093505b50929391925050565b60006001600160e01b031982167fd9b67a260000000000000000000000000000000000000000000000000000000014806134ea57506001600160e01b031982166303a24d0760e21b145b8061098157507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614610981565b600061352d826117f5565b9050806001600160a01b0316836001600160a01b0316036135905760405162461bcd60e51b815260206004820152600360248201527f41434f00000000000000000000000000000000000000000000000000000000006044820152606401610942565b336001600160a01b03821614806135ca57506001600160a01b038116600090815260026020908152604080832033845290915290205460ff165b6136165760405162461bcd60e51b815260206004820152600260248201527f41430000000000000000000000000000000000000000000000000000000000006044820152606401610942565b610aca8383614420565b600062020000838116148015610a8257504261363f6276a70084615bac565b67ffffffffffffffff16109392505050565b8451602086012060006136ab7f000000000000000000000000000000000000000000000000000000000000000083604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b9050600061377488600660007f0000000000000000000000000000000000000000000000000000000000000000815260200190815260200160002080546136f190615961565b80601f016020809104026020016040519081016040528092919081815260200182805461371d90615961565b801561376a5780601f1061373f5761010080835404028352916020019161376a565b820191906000526020600020905b81548152906001019060200180831161374d57829003601f168201915b505050505061449b565b600083815260066020526040902090915061378f8282615bcd565b506137a2828289620300008a17896141bf565b6001600160a01b03841615611b0957604051630c4b7b8560e11b8152600481018390526001600160a01b0385811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b15801561381b57600080fd5b505af115801561382f573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b031633146119675760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610942565b600080806138a484610987565b919450925090504267ffffffffffffffff82161080801561396857506001600160a01b038416158061396857506040516302571be360e01b8152600481018690526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613939573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061395d91906159b1565b6001600160a01b0316145b156139a757600061397887610987565b5091505060208116156139a15760405163a2a7201360e01b815260048101879052602401610942565b506139ce565b620100008316156139ce5760405163a2a7201360e01b815260048101869052602401610942565b505050505050565b63fffdffff81811763ffffffff1614613a055760405163a2a7201360e01b815260048101839052602401610942565b5050565b60606000613a2f836006600088815260200190815260200160002080546136f190615961565b6000858152600660205260409020909150613a4a8282615bcd565b50949350505050565b600080613a5f85610987565b92505050600080613a728860001c610987565b9250925050613a82878784613ee3565b613a8d858483613f1e565b98975050505050505050565b600080613aa5836117f5565b6001600160a01b03161415801561098157506040516302571be360e01b81526004810183905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613b1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b4291906159b1565b6001600160a01b03161492915050565b60008681526006602052604081208054613b719187916136f190615961565b905061134686828686866141bf565b60008080613b8d88610987565b9250925092506000613bb788600660008d815260200190815260200160002080546136f190615961565b60008a8152600660205260409020805491925090613bd490615961565b9050600003613bf7576000898152600660205260409020613bf58282615bcd565b505b613c0689858886178589613f68565b6001600160a01b038716613c2457613c1f8960006140cd565b610ce8565b610ce884888b60001c600160405180602001604052806000815250614314565b8151835114613c975760405162461bcd60e51b81526004016109429060208082526004908201527f49414c4d00000000000000000000000000000000000000000000000000000000604082015260600190565b6001600160a01b038416613cd25760405162461bcd60e51b81526020600482015260026024820152612a2d60f11b6044820152606401610942565b6001600160a01b038516331480613d0c57506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b613d5a5760405162461bcd60e51b81526004016109429060208082526004908201527f54434e4f00000000000000000000000000000000000000000000000000000000604082015260600190565b60005b8351811015613e7d576000848281518110613d7a57613d7a61599b565b602002602001015190506000848381518110613d9857613d9861599b565b602002602001015190506000806000613db085610987565b925092509250613dc1858383614544565b836001148015613de257508a6001600160a01b0316836001600160a01b0316145b613e2e5760405162461bcd60e51b815260206004820152600360248201527f49425400000000000000000000000000000000000000000000000000000000006044820152606401610942565b60008581526001602052604090206001600160a01b038b1663ffffffff60a01b60a085901b16176001600160c01b031960c084901b16179055505050505080613e76906159ce565b9050613d5d565b50836001600160a01b0316856001600160a01b0316336001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051613ecd929190615c8d565b60405180910390a4612385338686868686614610565b63ffff00008216158015906001831615908290613efd5750805b156123855760405163a2a7201360e01b815260048101869052602401610942565b60008167ffffffffffffffff168467ffffffffffffffff161115613f40578193505b8267ffffffffffffffff168467ffffffffffffffff161015613f60578293505b509192915050565b613f7485858584614028565b60405163ffffffff8416815285907f39873f00c80f4f94b7bd1594aebcf650f003545b74824d57ddf4939e3ff3a34b9060200160405180910390a28167ffffffffffffffff168167ffffffffffffffff1611156123855760405167ffffffffffffffff8216815285907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b132906020015b60405180910390a25050505050565b60008061401e83610987565b5090949350505050565b6140328483614763565b60008481526001602052604090206001600160a01b03841663ffffffff60a01b60a085901b16176001600160c01b031960c084901b161790556117ef565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6140d88260016120fe565b156140f95760405163a2a7201360e01b815260048101839052602401610942565b614102826142c0565b604051635b0fc9c360e01b8152600481018390526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b15801561416c57600080fd5b505af1158015614180573d6000803e3d6000fd5b50506040516001600160a01b03841681528492507fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49150602001612e43565b6141cb8584848461479c565b847f8ce7013e8abebc55c3890a68f5a27c67c3f7efa64e584de5fb22363c606fd340858585856040516140039493929190615cbb565b60008060006142108585614369565b90925090508161428257600185516142289190615d03565b84146142765760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d650000006044820152606401610942565b50600091506109819050565b61428c8582614201565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6000818152600160205260409020546142d8826147e6565b60405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b61432185858585856148b5565b82846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050505050565b600080835183106143bc5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e647300006044820152606401610942565b60008484815181106143d0576143d061599b565b016020015160f81c905080156143fc576143f5856143ef866001615d16565b836149d9565b9250614401565b600092505b61440b8185615d16565b614416906001615d16565b9150509250929050565b6000818152600360205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091558190614462826117f5565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60606001835110156144d9576040517f280dacb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff8351111561451757826040517fe3ba295f0000000000000000000000000000000000000000000000000000000081526004016109429190614e0f565b8251838360405160200161452d93929190615d29565b604051602081830303815290604052905092915050565b6201ffff1962020000831601614564576145616276a70082615bac565b90505b428167ffffffffffffffff1610156145b357620100008216156145ae5760405162461bcd60e51b815260206004820152600260248201526124a160f11b6044820152606401610942565b6145d8565b60048216156145d85760405163a2a7201360e01b815260048101849052602401610942565b60408216600003610aca5750506000908152600360205260409020805473ffffffffffffffffffffffffffffffffffffffff19169055565b6001600160a01b0384163b156139ce5760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906146549089908990889088908890600401615d8a565b6020604051808303816000875af192505050801561468f575060408051601f3d908101601f1916820190925261468c91810190615ddc565b60015b61471e5761469b615df9565b806308c379a0036146d457506146af615e15565b806146ba57506146d6565b8060405162461bcd60e51b81526004016109429190614e0f565b505b60405162461bcd60e51b815260206004820152600360248201527f544e4900000000000000000000000000000000000000000000000000000000006044820152606401610942565b6001600160e01b0319811663bc197c8160e01b146113465760405162461bcd60e51b8152602060048201526002602482015261149560f21b6044820152606401610942565b61ffff81161580159061477b57506201000181811614155b15613a055760405163a2a7201360e01b815260048101839052602401610942565b6147a8848484846149fd565b60405184906001600160a01b038516906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a450505050565b60008181526001602052604090205460a081901c60c082901c61480a838383613469565b6000868152600360209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191690556001909152902063ffffffff60a01b60a083901b166001600160c01b031960c086901b1617905592506148669050565b60408051858152600160208201526000916001600160a01b0386169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a450505050565b60008060006148c386610987565b9250925092506148d4868383614544565b8460011480156148f55750876001600160a01b0316836001600160a01b0316145b6149265760405162461bcd60e51b815260206004820152600260248201526124a160f11b6044820152606401610942565b866001600160a01b0316836001600160a01b03160361494757505050612385565b60008681526001602052604090206001600160a01b03881663ffffffff60a01b60a085901b16176001600160c01b031960c084901b1617905560408051878152602081018790526001600160a01b03808a1692908b169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611b09338989898989614a71565b82516000906149e88385615d16565b11156149f357600080fd5b5091016020012090565b614a078483614763565b6000848152600160205260409020546001600160a01b03811615614a6557614a2e856142c0565b6040516000815285907fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49060200160405180910390a25b61238585858585614b41565b6001600160a01b0384163b156139ce5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190614ab59089908990889088908890600401615e9f565b6020604051808303816000875af1925050508015614af0575060408051601f3d908101601f19168201909252614aed91810190615ddc565b60015b614afc5761469b615df9565b6001600160e01b0319811663f23a6e6160e01b146113465760405162461bcd60e51b8152602060048201526002602482015261149560f21b6044820152606401610942565b8360008080614b4f84610987565b9194509250905063ffff0000821667ffffffffffffffff8087169083161115614b76578195505b428267ffffffffffffffff1610614b8c57958617955b6001600160a01b03841615614be35760405162461bcd60e51b815260206004820152600360248201527f4d4f4500000000000000000000000000000000000000000000000000000000006044820152606401610942565b6001600160a01b038816614c395760405162461bcd60e51b815260206004820152600360248201527f4d545a00000000000000000000000000000000000000000000000000000000006044820152606401610942565b306001600160a01b03891603614c915760405162461bcd60e51b815260206004820152600360248201527f4e4f4e00000000000000000000000000000000000000000000000000000000006044820152606401610942565b60008581526001602052604090206001600160a01b03891663ffffffff60a01b60a08a901b16176001600160c01b031960c089901b1617905560408051868152600160208201526001600160a01b038a169160009133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612bbf3360008a88600160405180602001604052806000815250614a71565b6001600160a01b038116811461238a57600080fd5b60008060408385031215614d5a57600080fd5b8235614d6581614d32565b946020939093013593505050565b600060208284031215614d8557600080fd5b5035919050565b6001600160e01b03198116811461238a57600080fd5b600060208284031215614db457600080fd5b8135610a8281614d8c565b60005b83811015614dda578181015183820152602001614dc2565b50506000910152565b60008151808452614dfb816020860160208601614dbf565b601f01601f19169290920160200192915050565b602081526000610a826020830184614de3565b60008060408385031215614e3557600080fd5b823591506020830135614e4781614d32565b809150509250929050565b803567ffffffffffffffff81168114614e6a57600080fd5b919050565b60008060408385031215614e8257600080fd5b82359150614e9260208401614e52565b90509250929050565b60008083601f840112614ead57600080fd5b50813567ffffffffffffffff811115614ec557600080fd5b602083019150836020828501011115614edd57600080fd5b9250929050565b600080600080600060808688031215614efc57600080fd5b8535614f0781614d32565b94506020860135614f1781614d32565b935060408601359250606086013567ffffffffffffffff811115614f3a57600080fd5b614f4688828901614e9b565b969995985093965092949392505050565b600060208284031215614f6957600080fd5b8135610a8281614d32565b600080600060608486031215614f8957600080fd5b8335614f9481614d32565b92506020840135614fa481614d32565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff81118282101715614ff157614ff1614fb5565b6040525050565b600067ffffffffffffffff82111561501257615012614fb5565b50601f01601f191660200190565b600082601f83011261503157600080fd5b813561503c81614ff8565b6040516150498282614fcb565b82815285602084870101111561505e57600080fd5b82602086016020830137600092810160200192909252509392505050565b803563ffffffff81168114614e6a57600080fd5b600080600080600080600060e0888a0312156150ab57600080fd5b87359650602088013567ffffffffffffffff8111156150c957600080fd5b6150d58a828b01615020565b96505060408801356150e681614d32565b945060608801356150f681614d32565b935061510460808901614e52565b925061511260a0890161507c565b915061512060c08901614e52565b905092959891949750929550565b600067ffffffffffffffff82111561514857615148614fb5565b5060051b60200190565b600082601f83011261516357600080fd5b813560206151708261512e565b60405161517d8282614fcb565b83815260059390931b850182019282810191508684111561519d57600080fd5b8286015b848110156120f357803583529183019183016151a1565b600080600080600060a086880312156151d057600080fd5b85356151db81614d32565b945060208601356151eb81614d32565b9350604086013567ffffffffffffffff8082111561520857600080fd5b61521489838a01615152565b9450606088013591508082111561522a57600080fd5b61523689838a01615152565b9350608088013591508082111561524c57600080fd5b5061525988828901615020565b9150509295509295909350565b6000806000806080858703121561527c57600080fd5b84359350602085013592506152936040860161507c565b91506152a160608601614e52565b905092959194509250565b803561ffff81168114614e6a57600080fd5b600080604083850312156152d157600080fd5b82359150614e92602084016152ac565b600080604083850312156152f457600080fd5b823567ffffffffffffffff8082111561530c57600080fd5b818501915085601f83011261532057600080fd5b8135602061532d8261512e565b60405161533a8282614fcb565b83815260059390931b850182019282810191508984111561535a57600080fd5b948201945b8386101561538157853561537281614d32565b8252948201949082019061535f565b9650508601359250508082111561539757600080fd5b5061441685828601615152565b600081518084526020808501945080840160005b838110156153d4578151875295820195908201906001016153b8565b509495945050505050565b602081526000610a8260208301846153a4565b60008060006060848603121561540757600080fd5b833592506020840135915061541e60408501614e52565b90509250925092565b60008060006060848603121561543c57600080fd5b83359250602084013561544e81614d32565b9150604084013561545e81614d32565b809150509250925092565b60008060008060006080868803121561548157600080fd5b853567ffffffffffffffff81111561549857600080fd5b6154a488828901614e9b565b90965094505060208601356154b881614d32565b92506154c6604087016152ac565b915060608601356154d681614d32565b809150509295509295909350565b801515811461238a57600080fd5b6000806040838503121561550557600080fd5b823561551081614d32565b91506020830135614e47816154e4565b60008060008060008060a0878903121561553957600080fd5b863567ffffffffffffffff81111561555057600080fd5b61555c89828a01614e9b565b909750955050602087013561557081614d32565b935060408701359250606087013561558781614d32565b9150615595608088016152ac565b90509295509295509295565b600080604083850312156155b457600080fd5b82359150614e926020840161507c565b600080604083850312156155d757600080fd5b50508035926020909101359150565b60008060008060008060a087890312156155ff57600080fd5b86359550602087013567ffffffffffffffff81111561561d57600080fd5b61562989828a01614e9b565b909650945050604087013561563d81614d32565b925061564b6060880161507c565b915061559560808801614e52565b6000806000806040858703121561566f57600080fd5b843567ffffffffffffffff8082111561568757600080fd5b61569388838901614e9b565b909650945060208701359150808211156156ac57600080fd5b506156b987828801614e9b565b95989497509550505050565b600080600080608085870312156156db57600080fd5b8435935060208501356156ed81614d32565b9250604085013561529381614d32565b60008060006060848603121561571257600080fd5b8335925060208401359150604084013561545e81614d32565b6000806040838503121561573e57600080fd5b823561574981614d32565b91506020830135614e4781614d32565b6000806000806060858703121561576f57600080fd5b843567ffffffffffffffff81111561578657600080fd5b61579287828801614e9b565b90955093505060208501356157a681614d32565b915060408501356157b681614d32565b939692955090935050565b600080600080600060a086880312156157d957600080fd5b85356157e481614d32565b945060208601356157f481614d32565b93506040860135925060608601359150608086013567ffffffffffffffff81111561581e57600080fd5b61525988828901615020565b60006020828403121561583c57600080fd5b815167ffffffffffffffff81111561585357600080fd5b8201601f8101841361586457600080fd5b805161586f81614ff8565b60405161587c8282614fcb565b82815286602084860101111561589157600080fd5b610b5f836020830160208701614dbf565b600080600080608085870312156158b857600080fd5b843567ffffffffffffffff8111156158cf57600080fd5b6158db87828801615020565b94505060208501356158ec81614d32565b92506158fa604086016152ac565b915060608501356157b681614d32565b60006020828403121561591c57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b67ffffffffffffffff81811683821601908082111561595a5761595a615923565b5092915050565b600181811c9082168061597557607f821691505b60208210810361599557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156159c357600080fd5b8151610a8281614d32565b6000600182016159e0576159e0615923565b5060010190565b6000602082840312156159f957600080fd5b8151610a82816154e4565b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60c081526000615a5160c083018a8c615a14565b6001600160a01b03898116602085015263ffffffff8916604085015267ffffffffffffffff881660608501528616608084015282810360a0840152615a97818587615a14565b9b9a5050505050505050505050565b601f821115610aca57600081815260208120601f850160051c81016020861015615acd5750805b601f850160051c820191505b818110156139ce57828155600101615ad9565b67ffffffffffffffff831115615b0457615b04614fb5565b615b1883615b128354615961565b83615aa6565b6000601f841160018114615b4c5760008515615b345750838201355b600019600387901b1c1916600186901b178355612385565b600083815260209020601f19861690835b82811015615b7d5786850135825560209485019460019092019101615b5d565b5086821015615b9a5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b67ffffffffffffffff82811682821603908082111561595a5761595a615923565b815167ffffffffffffffff811115615be757615be7614fb5565b615bfb81615bf58454615961565b84615aa6565b602080601f831160018114615c305760008415615c185750858301515b600019600386901b1c1916600185901b1785556139ce565b600085815260208120601f198616915b82811015615c5f57888601518255948401946001909101908401615c40565b5085821015615c7d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000615ca060408301856153a4565b8281036020840152615cb281856153a4565b95945050505050565b608081526000615cce6080830187614de3565b6001600160a01b039590951660208301525063ffffffff92909216604083015267ffffffffffffffff16606090910152919050565b8181038181111561098157610981615923565b8082018082111561098157610981615923565b7fff000000000000000000000000000000000000000000000000000000000000008460f81b16815260008351615d66816001850160208801614dbf565b835190830190615d7d816001840160208801614dbf565b0160010195945050505050565b60006001600160a01b03808816835280871660208401525060a06040830152615db660a08301866153a4565b8281036060840152615dc881866153a4565b90508281036080840152613a8d8185614de3565b600060208284031215615dee57600080fd5b8151610a8281614d8c565b600060033d1115615e125760046000803e5060005160e01c5b90565b600060443d1015615e235790565b6040516003193d81016004833e81513d67ffffffffffffffff8160248401118184111715615e5357505050505090565b8285019150815181811115615e6b5750505050505090565b843d8701016020828501011115615e855750505050505090565b615e9460208286010187614fcb565b509095945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152615ed760a0830184614de3565b97965050505050505056fe68747470733a2f2f6d657461646174612e6f7074692e646f6d61696e732f636f6c6c656374696f6e2f646f6d61696e732f746f776ea26469706673582212208b551cdf2415d95b129de5adc1af52b884e6dd3d0365ed227c13454b577bf59b64736f6c63430008110033000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b490000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e000000000000000000000000b02eded8502b029aa7f2cb02e1c2a0c45253127900000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000004746f776e00000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061036c5760003560e01c80636e5d6ad2116101d3578063c87b56dd11610104578063e8a3d485116100a2578063ed70554d1161007c578063ed70554d14610895578063f242432a146108b5578063f2fde38b146108c8578063fd0cd0d9146108db57600080fd5b8063e8a3d4851461083e578063e985e9c514610846578063eb8ae5301461088257600080fd5b8063d8c9921a116100de578063d8c9921a146107e2578063d9a50c12146107f5578063da8c229e14610808578063e0dba60f1461082b57600080fd5b8063c87b56dd146107a9578063c93ab3fd146107bc578063cf408823146107cf57600080fd5b8063a22cb46511610171578063b6bcad261161014b578063b6bcad261461075d578063b88d4fde14610770578063c475abff14610783578063c658e0861461079657600080fd5b8063a22cb46514610724578063a401498214610737578063adf4960a1461074a57600080fd5b80638b4dfa75116101ad5780638b4dfa75146106b15780638cf8b41e146106c45780638da5cb5b146106d757806395d89b41146106e857600080fd5b80636e5d6ad21461066957806370a0823114610695578063715018a6146106a957600080fd5b806320c38e2b116102ad578063402906fc1161024b5780634e1273f4116102255780634e1273f41461061057806353095467146106305780635d3590d5146106435780636352211e1461065657600080fd5b8063402906fc146105d557806341415eab146105fd57806342842e0e1461053b57600080fd5b80632b20e397116102875780632b20e397146105615780632eb2c2d61461058857806333c69ea91461059b5780633f15457f146105ae57600080fd5b806320c38e2b1461052857806323b872dd1461053b57806324c1af441461054e57600080fd5b80630e4cd7251161031a578063150b7a02116102f4578063150b7a02146104c35780631534e177146104ef5780631896f70a146105025780631f4e15041461051557600080fd5b80630e4cd7251461048a5780630e89341c1461049d57806314ab9038146104b057600080fd5b806306fdde031161034b57806306fdde0314610401578063081812fc1461044a578063095ea7b31461047557600080fd5b8062fdd58e146103715780630178fe3f1461039757806301ffc9a7146103de575b600080fd5b61038461037f366004614d47565b6108ee565b6040519081526020015b60405180910390f35b6103aa6103a5366004614d73565b610987565b604080516001600160a01b03909416845263ffffffff909216602084015267ffffffffffffffff169082015260600161038e565b6103f16103ec366004614da2565b6109b7565b604051901515815260200161038e565b61043d6040518060400160405280601281526020017f426f72656420546f776e20446f6d61696e73000000000000000000000000000081525081565b60405161038e9190614e0f565b61045d610458366004614d73565b610a44565b6040516001600160a01b03909116815260200161038e565b610488610483366004614d47565b610a89565b005b6103f1610498366004614e22565b610acf565b61043d6104ab366004614d73565b610b69565b6104886104be366004614e6f565b610bdb565b6104d66104d1366004614ee4565b610cf4565b6040516001600160e01b0319909116815260200161038e565b6104886104fd366004614f57565b610f06565b610488610510366004614e22565b610f3d565b60075461045d906001600160a01b031681565b61043d610536366004614d73565b610fff565b610488610549366004614f74565b611099565b61038461055c366004615090565b6110b6565b61045d7f000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e81565b6104886105963660046151b8565b6112ca565b6104886105a9366004615266565b61134f565b61045d7f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b49081565b6105e86105e33660046152be565b611544565b60405163ffffffff909116815260200161038e565b6103f161060b366004614e22565b6115e6565b61062361061e3660046152e1565b611643565b60405161038e91906153df565b60055461045d906001600160a01b031681565b610488610651366004614f74565b61175b565b61045d610664366004614d73565b6117f5565b61067c6106773660046153f2565b611800565b60405167ffffffffffffffff909116815260200161038e565b6103846106a3366004614f57565b50600090565b610488611955565b6104886106bf366004615427565b611969565b61067c6106d2366004615469565b611b13565b6000546001600160a01b031661045d565b61043d6040518060400160405280600581526020017f2e746f776e00000000000000000000000000000000000000000000000000000081525081565b6104886107323660046154f2565b611edf565b610384610745366004615520565b611fa3565b6103f16107583660046155a1565b6120fe565b61048861076b366004614f57565b612123565b61048861077e366004614ee4565b61238d565b6103846107913660046155c4565b6123d1565b6103846107a43660046155e6565b612688565b61043d6107b7366004614d73565b612895565b6104886107ca366004615659565b6128a0565b6104886107dd3660046156c5565b612a11565b6104886107f03660046156fd565b612bca565b6103f16108033660046155c4565b612cda565b6103f1610816366004614f57565b60046020526000908152604090205460ff1681565b6104886108393660046154f2565b612de7565b61043d612e4f565b6103f161085436600461572b565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b610488610890366004615759565b612e6b565b6103846108a3366004614d73565b60016020526000908152604090205481565b6104886108c33660046157c1565b613236565b6104886108d6366004614f57565b613304565b6103f16108e9366004614d73565b613391565b60006001600160a01b03831661094b5760405162461bcd60e51b815260206004820152600260248201527f425100000000000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b6000610956836117f5565b9050836001600160a01b0316816001600160a01b03160361097b576001915050610981565b60009150505b92915050565b60008181526001602052604090205460a081901c60c082901c6109ab838383613469565b90959094509092509050565b60006001600160e01b031982167fd82c42d8000000000000000000000000000000000000000000000000000000001480610a0157506001600160e01b03198216630a85bd0160e11b145b80610a3557506001600160e01b031982167f80ac58cd00000000000000000000000000000000000000000000000000000000145b806109815750610981826134a0565b600080610a50836117f5565b90506001600160a01b038116610a695750600092915050565b6000838152600360205260409020546001600160a01b03165b9392505050565b6000610a9482610987565b50915050603f196040821601610ac05760405163a2a7201360e01b815260048101839052602401610942565b610aca8383613522565b505050565b6000808080610add86610987565b925092509250846001600160a01b0316836001600160a01b03161480610b2857506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff165b80610b4c57506001600160a01b038516610b4187610a44565b6001600160a01b0316145b8015610b5f5750610b5d8282613620565b155b9695505050505050565b6005546040516303a24d0760e21b8152600481018390526060916001600160a01b031690630e89341c90602401600060405180830381865afa158015610bb3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610981919081019061582a565b81610be681336115e6565b610c0c5760405163168ab55d60e31b815260048101829052336024820152604401610942565b8260106000610c1a83610987565b5091505063ffffffff8282161615610c485760405163a2a7201360e01b815260048101849052602401610942565b6040517f14ab90380000000000000000000000000000000000000000000000000000000081526004810187905267ffffffffffffffff861660248201527f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b4906001600160a01b0316906314ab9038906044015b600060405180830381600087803b158015610cd457600080fd5b505af1158015610ce8573d6000803e3d6000fd5b50505050505050505050565b6000336001600160a01b037f000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e1614610d58576040517f1931a53800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080610d69868801886158a2565b83516020850120939750919550935091508890808214610dbf576040517fc65c3ccc0000000000000000000000000000000000000000000000000000000081526004810182905260248101839052604401610942565b604051630a3b53db60e21b8152600481018390523060248201527f000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e6001600160a01b0316906328ed4f6c90604401600060405180830381600087803b158015610e2757600080fd5b505af1158015610e3b573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018d9052600092506276a70091506001600160a01b037f000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e169063d6e4fa8690602401602060405180830381865afa158015610eac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed0919061590a565b610eda9190615939565b9050610eed87878761ffff168488613651565b50630a85bd0160e11b9c9b505050505050505050505050565b610f0e61383d565b6005805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b81610f4881336115e6565b610f6e5760405163168ab55d60e31b815260048101829052336024820152604401610942565b8260086000610f7c83610987565b5091505063ffffffff8282161615610faa5760405163a2a7201360e01b815260048101849052602401610942565b604051630c4b7b8560e11b8152600481018790526001600160a01b0386811660248301527f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b4901690631896f70a90604401610cba565b6006602052600090815260409020805461101890615961565b80601f016020809104026020016040519081016040528092919081815260200182805461104490615961565b80156110915780601f1061106657610100808354040283529160200191611091565b820191906000526020600020905b81548152906001019060200180831161107457829003601f168201915b505050505081565b610aca838383600160405180602001604052806000815250613236565b6000876110c381336115e6565b6110e95760405163168ab55d60e31b815260048101829052336024820152604401610942565b875160208901206111218a82604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b925061112d8a84613897565b61113783866139d6565b6111428a848b613a09565b5061114f8a848787613a53565b935061115a83613a99565b611210576040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b4901690635ef2c7f09060a401600060405180830381600087803b1580156111e557600080fd5b505af11580156111f9573d6000803e3d6000fd5b5050505061120b8a848b8b8989613b52565b6112bd565b6040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b4901690635ef2c7f09060a401600060405180830381600087803b15801561129757600080fd5b505af11580156112ab573d6000803e3d6000fd5b505050506112bd8a848b8b8989613b80565b5050979650505050505050565b6112d78585858585613c44565b825160005b81811015611346578481815181106112f6576112f661599b565b6020026020010151866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46001016112dc565b50505050505050565b6040805160208082018790528183018690528251808303840181526060909201909252805191012061138181846139d6565b6000808061138e84610987565b919450925090506001600160a01b038316158061143d57506040516302571be360e01b81526004810185905230906001600160a01b037f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b49016906302571be390602401602060405180830381865afa15801561140d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143191906159b1565b6001600160a01b031614155b1561145b57604051635374b59960e01b815260040160405180910390fd5b6000806114678a610987565b90935091508a90506114a85761147d86336115e6565b6114a35760405163168ab55d60e31b815260048101879052336024820152604401610942565b6114d8565b6114b28a336115e6565b6114d85760405163168ab55d60e31b8152600481018b9052336024820152604401610942565b6114e3868984613ee3565b6114ee878483613f1e565b96506201000084161580159061151257508363ffffffff1688851763ffffffff1614155b156115335760405163a2a7201360e01b815260048101879052602401610942565b96831796610ce886868a868b613f68565b60008261155181336115e6565b6115775760405163168ab55d60e31b815260048101829052336024820152604401610942565b836002600061158583610987565b5091505063ffffffff82821616156115b35760405163a2a7201360e01b815260048101849052602401610942565b600080806115c08a610987565b9250925092506115d98a84848c61ffff16178485613f68565b5098975050505050505050565b60008080806115f486610987565b925092509250846001600160a01b0316836001600160a01b03161480610b4c57506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff16610b4c565b606081518351146116965760405162461bcd60e51b815260206004820152600260248201527f41490000000000000000000000000000000000000000000000000000000000006044820152606401610942565b6000835167ffffffffffffffff8111156116b2576116b2614fb5565b6040519080825280602002602001820160405280156116db578160200160208202803683370190505b50905060005b8451811015611753576117268582815181106116ff576116ff61599b565b60200260200101518583815181106117195761171961599b565b60200260200101516108ee565b8282815181106117385761173861599b565b602090810291909101015261174c816159ce565b90506116e1565b509392505050565b61176361383d565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af11580156117cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ef91906159e7565b50505050565b600061098182614012565b6040805160208082018690528183018590528251808303840181526060909201909252805191012060009061183481613a99565b61185157604051635374b59960e01b815260040160405180910390fd5b600061185d8633610acf565b905080158015611874575061187282336115e6565b155b1561189b5760405163168ab55d60e31b815260048101839052336024820152604401610942565b600080806118a885610987565b925092509250831580156118bf5750620400008216155b156118e05760405163a2a7201360e01b815260048101869052602401610942565b60006118eb8a610987565b925050506118fa888383613f1e565b97506119088685858b614028565b60405167ffffffffffffffff8916815286907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b1329060200160405180910390a2509598975050505050505050565b61195d61383d565b6119676000614070565b565b604080517f4e64474f406bfb88babba9d48fc501844ea2246343195cdcfe2fb6b54571b71b602080830191909152818301869052825180830384018152606090920190925280519101206119bd81336115e6565b6119e35760405163168ab55d60e31b815260048101829052336024820152604401610942565b306001600160a01b03841603611a1757604051632ca49b0d60e11b81526001600160a01b0384166004820152602401610942565b604080517f4e64474f406bfb88babba9d48fc501844ea2246343195cdcfe2fb6b54571b71b60208083019190915281830187905282518083038401815260609092019092528051910120611a6c905b836140cd565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038481166024830152604482018690527f000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e16906342842e0e90606401600060405180830381600087803b158015611af557600080fd5b505af1158015611b09573d6000803e3d6000fd5b5050505050505050565b6000808686604051611b26929190615a04565b6040519081900381206331a9108f60e11b82526004820181905291506000907f000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e6001600160a01b031690636352211e90602401602060405180830381865afa158015611b96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bba91906159b1565b90506001600160a01b0381163314801590611c62575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e169063e985e9c590604401602060405180830381865afa158015611c3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c6091906159e7565b155b15611cd257604080517f4e64474f406bfb88babba9d48fc501844ea2246343195cdcfe2fb6b54571b71b6020808301919091528183018590528251808303840181526060830193849052805191012063168ab55d60e31b909252606481019190915233608482015260a401610942565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152306024830152604482018490527f000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e16906323b872dd90606401600060405180830381600087803b158015611d5b57600080fd5b505af1158015611d6f573d6000803e3d6000fd5b5050604051630a3b53db60e21b8152600481018590523060248201527f000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e6001600160a01b031692506328ed4f6c9150604401600060405180830381600087803b158015611ddb57600080fd5b505af1158015611def573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018590526276a70092507f000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e6001600160a01b0316915063d6e4fa8690602401602060405180830381865afa158015611e5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e81919061590a565b611e8b9190615939565b9250611ed488888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff88168688613651565b505095945050505050565b6001600160a01b0382163303611f375760405162461bcd60e51b815260206004820152600360248201527f53415300000000000000000000000000000000000000000000000000000000006044820152606401610942565b3360008181526002602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3360009081526004602052604081205460ff16611fd3576040516323019e6760e01b815260040160405180910390fd5b60008787604051611fe5929190615a04565b6040519081900381207ffca247ac000000000000000000000000000000000000000000000000000000008252600482018190523060248301526044820187905291507f000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e6001600160a01b03169063fca247ac906064016020604051808303816000875af115801561207a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209e919061590a565b91506120f388888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff86166120ed6276a70087615939565b88613651565b509695505050505050565b60008061210a84610987565b50841663ffffffff908116908516149250505092915050565b61212b61383d565b6007546001600160a01b03161561224b5760075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e9091169063a22cb46590604401600060405180830381600087803b1580156121ab57600080fd5b505af11580156121bf573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b490909116925063a22cb4659150604401600060405180830381600087803b15801561223257600080fd5b505af1158015612246573d6000803e3d6000fd5b505050505b6007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091551561238a5760075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e9091169063a22cb46590604401600060405180830381600087803b1580156122ea57600080fd5b505af11580156122fe573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b490909116925063a22cb4659150604401600060405180830381600087803b15801561237157600080fd5b505af1158015612385573d6000803e3d6000fd5b505050505b50565b612385858585600186868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061323692505050565b3360009081526004602052604081205460ff16612401576040516323019e6760e01b815260040160405180910390fd5b604080517f4e64474f406bfb88babba9d48fc501844ea2246343195cdcfe2fb6b54571b71b602080830191909152818301869052825180830384018152606090920190925280519101206000906040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101869052602481018590529091506000906001600160a01b037f000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e169063c475abff906044016020604051808303816000875af11580156124db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ff919061590a565b6040516331a9108f60e11b8152600481018790529091507f000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e6001600160a01b031690636352211e90602401602060405180830381865afa925050508015612583575060408051601f3d908101601f19168201909252612580918101906159b1565b60015b6125905791506109819050565b6001600160a01b0381163014158061263a57506040516302571be360e01b81526004810184905230906001600160a01b037f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b49016906302571be390602401602060405180830381865afa15801561260a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061262e91906159b1565b6001600160a01b031614155b15612649575091506109819050565b5060006126596276a70083615939565b60008481526001602052604090205490915060a081901c61267c85838386614028565b50919695505050505050565b60008661269581336115e6565b6126bb5760405163168ab55d60e31b815260048101829052336024820152604401610942565b600087876040516126cd929190615a04565b604051809103902090506127088982604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506127148984613897565b61271e83866139d6565b60006127618a858b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613a0992505050565b905061276f8a858888613a53565b945061277a84613a99565b612842576040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018b9052602481018390523060448201527f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b4906001600160a01b0316906306ab5923906064016020604051808303816000875af115801561280b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061282f919061590a565b5061283d84828989896141bf565b612888565b6128888a858b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c91508b9050613b80565b5050509695505050505050565b606061098182610b69565b60006128e6600086868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506142019050565b6007549091506001600160a01b031661292b576040517f24c1d6d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61293581336115e6565b61295b5760405163168ab55d60e31b815260048101829052336024820152604401610942565b6000808061296884610987565b91945092509050600061297a85610a44565b9050612985856142c0565b600760009054906101000a90046001600160a01b03166001600160a01b0316639198c2768a8a878787878e8e6040518963ffffffff1660e01b81526004016129d4989796959493929190615a3d565b600060405180830381600087803b1580156129ee57600080fd5b505af1158015612a02573d6000803e3d6000fd5b50505050505050505050505050565b83612a1c81336115e6565b612a425760405163168ab55d60e31b815260048101829052336024820152604401610942565b84601c6000612a5083610987565b5091505063ffffffff8282161615612a7e5760405163a2a7201360e01b815260048101849052602401610942565b6040517fcf408823000000000000000000000000000000000000000000000000000000008152600481018990523060248201526001600160a01b03878116604483015267ffffffffffffffff871660648301527f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b490169063cf40882390608401600060405180830381600087803b158015612b1757600080fd5b505af1158015612b2b573d6000803e3d6000fd5b5050506001600160a01b0388169050612b92576000612b4989610987565b509150506201ffff1962020000821601612b8157604051632ca49b0d60e11b81526001600160a01b0389166004820152602401610942565b612b8c8960006140cd565b50611b09565b6000612b9d896117f5565b9050612bbf81898b60001c600160405180602001604052806000815250614314565b505050505050505050565b60408051602080820186905281830185905282518083038401815260609092019092528051910120612bfc81336115e6565b612c225760405163168ab55d60e31b815260048101829052336024820152604401610942565b7f4e64474f406bfb88babba9d48fc501844ea2246343195cdcfe2fb6b54571b71b8403612c625760405163615a470360e01b815260040160405180910390fd5b6001600160a01b0382161580612c8057506001600160a01b03821630145b15612ca957604051632ca49b0d60e11b81526001600160a01b0383166004820152602401610942565b604080516020808201879052818301869052825180830384018152606090920190925280519101206117ef90611a66565b604080516020808201859052818301849052825180830384018152606090920190925280519101206000906000612d1082613a99565b90507f4e64474f406bfb88babba9d48fc501844ea2246343195cdcfe2fb6b54571b71b8514612d425791506109819050565b6040516331a9108f60e11b8152600481018590527f000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e6001600160a01b031690636352211e90602401602060405180830381865afa925050508015612dc3575060408051601f3d908101601f19168201909252612dc0918101906159b1565b60015b612dd257600092505050610981565b6001600160a01b031630149250610981915050565b612def61383d565b6001600160a01b038216600081815260046020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf8791015b60405180910390a25050565b604051806060016040528060358152602001615ee36035913981565b600080612eb2600087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506143699050565b915091506000612efb8288888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506142019050565b604080516020808201849052818301879052825180830384018152606090920190925280519101209091506000906000818152600660205260409020909150612f45888a83615aec565b507f4e64474f406bfb88babba9d48fc501844ea2246343195cdcfe2fb6b54571b71b8203612f865760405163615a470360e01b815260040160405180910390fd5b6040516302571be360e01b8152600481018290526000907f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b4906001600160a01b0316906302571be390602401602060405180830381865afa158015612fee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301291906159b1565b90506001600160a01b03811633148015906130ba575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b490169063e985e9c590604401602060405180830381865afa158015613094573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130b891906159e7565b155b156130e15760405163168ab55d60e31b815260048101839052336024820152604401610942565b6001600160a01b0386161561317357604051630c4b7b8560e11b8152600481018390526001600160a01b0387811660248301527f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b4901690631896f70a90604401600060405180830381600087803b15801561315a57600080fd5b505af115801561316e573d6000803e3d6000fd5b505050505b604051635b0fc9c360e01b8152600481018390523060248201527f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b4906001600160a01b031690635b0fc9c390604401600060405180830381600087803b1580156131db57600080fd5b505af11580156131ef573d6000803e3d6000fd5b50505050612bbf828a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508d935091508190506141bf565b6001600160a01b0384166132715760405162461bcd60e51b81526020600482015260026024820152612a2d60f11b6044820152606401610942565b6001600160a01b0385163314806132ab57506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b6132f75760405162461bcd60e51b815260206004820152600360248201527f434e4f00000000000000000000000000000000000000000000000000000000006044820152606401610942565b6123858585858585614314565b61330c61383d565b6001600160a01b0381166133885760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610942565b61238a81614070565b600081815260066020526040812080548291906133ad90615961565b80601f01602080910402602001604051908101604052809291908181526020018280546133d990615961565b80156134265780601f106133fb57610100808354040283529160200191613426565b820191906000526020600020905b81548152906001019060200180831161340957829003601f168201915b50505050509050805160000361343f5750600092915050565b60008061344c8382614369565b9092509050600061345d8483614201565b9050610b5f8184612cda565b600080428367ffffffffffffffff1610156134975761ffff196201000085160161349257600094505b600093505b50929391925050565b60006001600160e01b031982167fd9b67a260000000000000000000000000000000000000000000000000000000014806134ea57506001600160e01b031982166303a24d0760e21b145b8061098157507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614610981565b600061352d826117f5565b9050806001600160a01b0316836001600160a01b0316036135905760405162461bcd60e51b815260206004820152600360248201527f41434f00000000000000000000000000000000000000000000000000000000006044820152606401610942565b336001600160a01b03821614806135ca57506001600160a01b038116600090815260026020908152604080832033845290915290205460ff165b6136165760405162461bcd60e51b815260206004820152600260248201527f41430000000000000000000000000000000000000000000000000000000000006044820152606401610942565b610aca8383614420565b600062020000838116148015610a8257504261363f6276a70084615bac565b67ffffffffffffffff16109392505050565b8451602086012060006136ab7f4e64474f406bfb88babba9d48fc501844ea2246343195cdcfe2fb6b54571b71b83604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b9050600061377488600660007f4e64474f406bfb88babba9d48fc501844ea2246343195cdcfe2fb6b54571b71b815260200190815260200160002080546136f190615961565b80601f016020809104026020016040519081016040528092919081815260200182805461371d90615961565b801561376a5780601f1061373f5761010080835404028352916020019161376a565b820191906000526020600020905b81548152906001019060200180831161374d57829003601f168201915b505050505061449b565b600083815260066020526040902090915061378f8282615bcd565b506137a2828289620300008a17896141bf565b6001600160a01b03841615611b0957604051630c4b7b8560e11b8152600481018390526001600160a01b0385811660248301527f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b4901690631896f70a90604401600060405180830381600087803b15801561381b57600080fd5b505af115801561382f573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b031633146119675760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610942565b600080806138a484610987565b919450925090504267ffffffffffffffff82161080801561396857506001600160a01b038416158061396857506040516302571be360e01b8152600481018690526000906001600160a01b037f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b49016906302571be390602401602060405180830381865afa158015613939573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061395d91906159b1565b6001600160a01b0316145b156139a757600061397887610987565b5091505060208116156139a15760405163a2a7201360e01b815260048101879052602401610942565b506139ce565b620100008316156139ce5760405163a2a7201360e01b815260048101869052602401610942565b505050505050565b63fffdffff81811763ffffffff1614613a055760405163a2a7201360e01b815260048101839052602401610942565b5050565b60606000613a2f836006600088815260200190815260200160002080546136f190615961565b6000858152600660205260409020909150613a4a8282615bcd565b50949350505050565b600080613a5f85610987565b92505050600080613a728860001c610987565b9250925050613a82878784613ee3565b613a8d858483613f1e565b98975050505050505050565b600080613aa5836117f5565b6001600160a01b03161415801561098157506040516302571be360e01b81526004810183905230906001600160a01b037f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b49016906302571be390602401602060405180830381865afa158015613b1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b4291906159b1565b6001600160a01b03161492915050565b60008681526006602052604081208054613b719187916136f190615961565b905061134686828686866141bf565b60008080613b8d88610987565b9250925092506000613bb788600660008d815260200190815260200160002080546136f190615961565b60008a8152600660205260409020805491925090613bd490615961565b9050600003613bf7576000898152600660205260409020613bf58282615bcd565b505b613c0689858886178589613f68565b6001600160a01b038716613c2457613c1f8960006140cd565b610ce8565b610ce884888b60001c600160405180602001604052806000815250614314565b8151835114613c975760405162461bcd60e51b81526004016109429060208082526004908201527f49414c4d00000000000000000000000000000000000000000000000000000000604082015260600190565b6001600160a01b038416613cd25760405162461bcd60e51b81526020600482015260026024820152612a2d60f11b6044820152606401610942565b6001600160a01b038516331480613d0c57506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b613d5a5760405162461bcd60e51b81526004016109429060208082526004908201527f54434e4f00000000000000000000000000000000000000000000000000000000604082015260600190565b60005b8351811015613e7d576000848281518110613d7a57613d7a61599b565b602002602001015190506000848381518110613d9857613d9861599b565b602002602001015190506000806000613db085610987565b925092509250613dc1858383614544565b836001148015613de257508a6001600160a01b0316836001600160a01b0316145b613e2e5760405162461bcd60e51b815260206004820152600360248201527f49425400000000000000000000000000000000000000000000000000000000006044820152606401610942565b60008581526001602052604090206001600160a01b038b1663ffffffff60a01b60a085901b16176001600160c01b031960c084901b16179055505050505080613e76906159ce565b9050613d5d565b50836001600160a01b0316856001600160a01b0316336001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051613ecd929190615c8d565b60405180910390a4612385338686868686614610565b63ffff00008216158015906001831615908290613efd5750805b156123855760405163a2a7201360e01b815260048101869052602401610942565b60008167ffffffffffffffff168467ffffffffffffffff161115613f40578193505b8267ffffffffffffffff168467ffffffffffffffff161015613f60578293505b509192915050565b613f7485858584614028565b60405163ffffffff8416815285907f39873f00c80f4f94b7bd1594aebcf650f003545b74824d57ddf4939e3ff3a34b9060200160405180910390a28167ffffffffffffffff168167ffffffffffffffff1611156123855760405167ffffffffffffffff8216815285907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b132906020015b60405180910390a25050505050565b60008061401e83610987565b5090949350505050565b6140328483614763565b60008481526001602052604090206001600160a01b03841663ffffffff60a01b60a085901b16176001600160c01b031960c084901b161790556117ef565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6140d88260016120fe565b156140f95760405163a2a7201360e01b815260048101839052602401610942565b614102826142c0565b604051635b0fc9c360e01b8152600481018390526001600160a01b0382811660248301527f000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b4901690635b0fc9c390604401600060405180830381600087803b15801561416c57600080fd5b505af1158015614180573d6000803e3d6000fd5b50506040516001600160a01b03841681528492507fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49150602001612e43565b6141cb8584848461479c565b847f8ce7013e8abebc55c3890a68f5a27c67c3f7efa64e584de5fb22363c606fd340858585856040516140039493929190615cbb565b60008060006142108585614369565b90925090508161428257600185516142289190615d03565b84146142765760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d650000006044820152606401610942565b50600091506109819050565b61428c8582614201565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6000818152600160205260409020546142d8826147e6565b60405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b61432185858585856148b5565b82846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050505050565b600080835183106143bc5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e647300006044820152606401610942565b60008484815181106143d0576143d061599b565b016020015160f81c905080156143fc576143f5856143ef866001615d16565b836149d9565b9250614401565b600092505b61440b8185615d16565b614416906001615d16565b9150509250929050565b6000818152600360205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091558190614462826117f5565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60606001835110156144d9576040517f280dacb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff8351111561451757826040517fe3ba295f0000000000000000000000000000000000000000000000000000000081526004016109429190614e0f565b8251838360405160200161452d93929190615d29565b604051602081830303815290604052905092915050565b6201ffff1962020000831601614564576145616276a70082615bac565b90505b428167ffffffffffffffff1610156145b357620100008216156145ae5760405162461bcd60e51b815260206004820152600260248201526124a160f11b6044820152606401610942565b6145d8565b60048216156145d85760405163a2a7201360e01b815260048101849052602401610942565b60408216600003610aca5750506000908152600360205260409020805473ffffffffffffffffffffffffffffffffffffffff19169055565b6001600160a01b0384163b156139ce5760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906146549089908990889088908890600401615d8a565b6020604051808303816000875af192505050801561468f575060408051601f3d908101601f1916820190925261468c91810190615ddc565b60015b61471e5761469b615df9565b806308c379a0036146d457506146af615e15565b806146ba57506146d6565b8060405162461bcd60e51b81526004016109429190614e0f565b505b60405162461bcd60e51b815260206004820152600360248201527f544e4900000000000000000000000000000000000000000000000000000000006044820152606401610942565b6001600160e01b0319811663bc197c8160e01b146113465760405162461bcd60e51b8152602060048201526002602482015261149560f21b6044820152606401610942565b61ffff81161580159061477b57506201000181811614155b15613a055760405163a2a7201360e01b815260048101839052602401610942565b6147a8848484846149fd565b60405184906001600160a01b038516906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a450505050565b60008181526001602052604090205460a081901c60c082901c61480a838383613469565b6000868152600360209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191690556001909152902063ffffffff60a01b60a083901b166001600160c01b031960c086901b1617905592506148669050565b60408051858152600160208201526000916001600160a01b0386169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a450505050565b60008060006148c386610987565b9250925092506148d4868383614544565b8460011480156148f55750876001600160a01b0316836001600160a01b0316145b6149265760405162461bcd60e51b815260206004820152600260248201526124a160f11b6044820152606401610942565b866001600160a01b0316836001600160a01b03160361494757505050612385565b60008681526001602052604090206001600160a01b03881663ffffffff60a01b60a085901b16176001600160c01b031960c084901b1617905560408051878152602081018790526001600160a01b03808a1692908b169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611b09338989898989614a71565b82516000906149e88385615d16565b11156149f357600080fd5b5091016020012090565b614a078483614763565b6000848152600160205260409020546001600160a01b03811615614a6557614a2e856142c0565b6040516000815285907fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49060200160405180910390a25b61238585858585614b41565b6001600160a01b0384163b156139ce5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190614ab59089908990889088908890600401615e9f565b6020604051808303816000875af1925050508015614af0575060408051601f3d908101601f19168201909252614aed91810190615ddc565b60015b614afc5761469b615df9565b6001600160e01b0319811663f23a6e6160e01b146113465760405162461bcd60e51b8152602060048201526002602482015261149560f21b6044820152606401610942565b8360008080614b4f84610987565b9194509250905063ffff0000821667ffffffffffffffff8087169083161115614b76578195505b428267ffffffffffffffff1610614b8c57958617955b6001600160a01b03841615614be35760405162461bcd60e51b815260206004820152600360248201527f4d4f4500000000000000000000000000000000000000000000000000000000006044820152606401610942565b6001600160a01b038816614c395760405162461bcd60e51b815260206004820152600360248201527f4d545a00000000000000000000000000000000000000000000000000000000006044820152606401610942565b306001600160a01b03891603614c915760405162461bcd60e51b815260206004820152600360248201527f4e4f4e00000000000000000000000000000000000000000000000000000000006044820152606401610942565b60008581526001602052604090206001600160a01b03891663ffffffff60a01b60a08a901b16176001600160c01b031960c089901b1617905560408051868152600160208201526001600160a01b038a169160009133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612bbf3360008a88600160405180602001604052806000815250614a71565b6001600160a01b038116811461238a57600080fd5b60008060408385031215614d5a57600080fd5b8235614d6581614d32565b946020939093013593505050565b600060208284031215614d8557600080fd5b5035919050565b6001600160e01b03198116811461238a57600080fd5b600060208284031215614db457600080fd5b8135610a8281614d8c565b60005b83811015614dda578181015183820152602001614dc2565b50506000910152565b60008151808452614dfb816020860160208601614dbf565b601f01601f19169290920160200192915050565b602081526000610a826020830184614de3565b60008060408385031215614e3557600080fd5b823591506020830135614e4781614d32565b809150509250929050565b803567ffffffffffffffff81168114614e6a57600080fd5b919050565b60008060408385031215614e8257600080fd5b82359150614e9260208401614e52565b90509250929050565b60008083601f840112614ead57600080fd5b50813567ffffffffffffffff811115614ec557600080fd5b602083019150836020828501011115614edd57600080fd5b9250929050565b600080600080600060808688031215614efc57600080fd5b8535614f0781614d32565b94506020860135614f1781614d32565b935060408601359250606086013567ffffffffffffffff811115614f3a57600080fd5b614f4688828901614e9b565b969995985093965092949392505050565b600060208284031215614f6957600080fd5b8135610a8281614d32565b600080600060608486031215614f8957600080fd5b8335614f9481614d32565b92506020840135614fa481614d32565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff81118282101715614ff157614ff1614fb5565b6040525050565b600067ffffffffffffffff82111561501257615012614fb5565b50601f01601f191660200190565b600082601f83011261503157600080fd5b813561503c81614ff8565b6040516150498282614fcb565b82815285602084870101111561505e57600080fd5b82602086016020830137600092810160200192909252509392505050565b803563ffffffff81168114614e6a57600080fd5b600080600080600080600060e0888a0312156150ab57600080fd5b87359650602088013567ffffffffffffffff8111156150c957600080fd5b6150d58a828b01615020565b96505060408801356150e681614d32565b945060608801356150f681614d32565b935061510460808901614e52565b925061511260a0890161507c565b915061512060c08901614e52565b905092959891949750929550565b600067ffffffffffffffff82111561514857615148614fb5565b5060051b60200190565b600082601f83011261516357600080fd5b813560206151708261512e565b60405161517d8282614fcb565b83815260059390931b850182019282810191508684111561519d57600080fd5b8286015b848110156120f357803583529183019183016151a1565b600080600080600060a086880312156151d057600080fd5b85356151db81614d32565b945060208601356151eb81614d32565b9350604086013567ffffffffffffffff8082111561520857600080fd5b61521489838a01615152565b9450606088013591508082111561522a57600080fd5b61523689838a01615152565b9350608088013591508082111561524c57600080fd5b5061525988828901615020565b9150509295509295909350565b6000806000806080858703121561527c57600080fd5b84359350602085013592506152936040860161507c565b91506152a160608601614e52565b905092959194509250565b803561ffff81168114614e6a57600080fd5b600080604083850312156152d157600080fd5b82359150614e92602084016152ac565b600080604083850312156152f457600080fd5b823567ffffffffffffffff8082111561530c57600080fd5b818501915085601f83011261532057600080fd5b8135602061532d8261512e565b60405161533a8282614fcb565b83815260059390931b850182019282810191508984111561535a57600080fd5b948201945b8386101561538157853561537281614d32565b8252948201949082019061535f565b9650508601359250508082111561539757600080fd5b5061441685828601615152565b600081518084526020808501945080840160005b838110156153d4578151875295820195908201906001016153b8565b509495945050505050565b602081526000610a8260208301846153a4565b60008060006060848603121561540757600080fd5b833592506020840135915061541e60408501614e52565b90509250925092565b60008060006060848603121561543c57600080fd5b83359250602084013561544e81614d32565b9150604084013561545e81614d32565b809150509250925092565b60008060008060006080868803121561548157600080fd5b853567ffffffffffffffff81111561549857600080fd5b6154a488828901614e9b565b90965094505060208601356154b881614d32565b92506154c6604087016152ac565b915060608601356154d681614d32565b809150509295509295909350565b801515811461238a57600080fd5b6000806040838503121561550557600080fd5b823561551081614d32565b91506020830135614e47816154e4565b60008060008060008060a0878903121561553957600080fd5b863567ffffffffffffffff81111561555057600080fd5b61555c89828a01614e9b565b909750955050602087013561557081614d32565b935060408701359250606087013561558781614d32565b9150615595608088016152ac565b90509295509295509295565b600080604083850312156155b457600080fd5b82359150614e926020840161507c565b600080604083850312156155d757600080fd5b50508035926020909101359150565b60008060008060008060a087890312156155ff57600080fd5b86359550602087013567ffffffffffffffff81111561561d57600080fd5b61562989828a01614e9b565b909650945050604087013561563d81614d32565b925061564b6060880161507c565b915061559560808801614e52565b6000806000806040858703121561566f57600080fd5b843567ffffffffffffffff8082111561568757600080fd5b61569388838901614e9b565b909650945060208701359150808211156156ac57600080fd5b506156b987828801614e9b565b95989497509550505050565b600080600080608085870312156156db57600080fd5b8435935060208501356156ed81614d32565b9250604085013561529381614d32565b60008060006060848603121561571257600080fd5b8335925060208401359150604084013561545e81614d32565b6000806040838503121561573e57600080fd5b823561574981614d32565b91506020830135614e4781614d32565b6000806000806060858703121561576f57600080fd5b843567ffffffffffffffff81111561578657600080fd5b61579287828801614e9b565b90955093505060208501356157a681614d32565b915060408501356157b681614d32565b939692955090935050565b600080600080600060a086880312156157d957600080fd5b85356157e481614d32565b945060208601356157f481614d32565b93506040860135925060608601359150608086013567ffffffffffffffff81111561581e57600080fd5b61525988828901615020565b60006020828403121561583c57600080fd5b815167ffffffffffffffff81111561585357600080fd5b8201601f8101841361586457600080fd5b805161586f81614ff8565b60405161587c8282614fcb565b82815286602084860101111561589157600080fd5b610b5f836020830160208701614dbf565b600080600080608085870312156158b857600080fd5b843567ffffffffffffffff8111156158cf57600080fd5b6158db87828801615020565b94505060208501356158ec81614d32565b92506158fa604086016152ac565b915060608501356157b681614d32565b60006020828403121561591c57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b67ffffffffffffffff81811683821601908082111561595a5761595a615923565b5092915050565b600181811c9082168061597557607f821691505b60208210810361599557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156159c357600080fd5b8151610a8281614d32565b6000600182016159e0576159e0615923565b5060010190565b6000602082840312156159f957600080fd5b8151610a82816154e4565b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60c081526000615a5160c083018a8c615a14565b6001600160a01b03898116602085015263ffffffff8916604085015267ffffffffffffffff881660608501528616608084015282810360a0840152615a97818587615a14565b9b9a5050505050505050505050565b601f821115610aca57600081815260208120601f850160051c81016020861015615acd5750805b601f850160051c820191505b818110156139ce57828155600101615ad9565b67ffffffffffffffff831115615b0457615b04614fb5565b615b1883615b128354615961565b83615aa6565b6000601f841160018114615b4c5760008515615b345750838201355b600019600387901b1c1916600186901b178355612385565b600083815260209020601f19861690835b82811015615b7d5786850135825560209485019460019092019101615b5d565b5086821015615b9a5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b67ffffffffffffffff82811682821603908082111561595a5761595a615923565b815167ffffffffffffffff811115615be757615be7614fb5565b615bfb81615bf58454615961565b84615aa6565b602080601f831160018114615c305760008415615c185750858301515b600019600386901b1c1916600185901b1785556139ce565b600085815260208120601f198616915b82811015615c5f57888601518255948401946001909101908401615c40565b5085821015615c7d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000615ca060408301856153a4565b8281036020840152615cb281856153a4565b95945050505050565b608081526000615cce6080830187614de3565b6001600160a01b039590951660208301525063ffffffff92909216604083015267ffffffffffffffff16606090910152919050565b8181038181111561098157610981615923565b8082018082111561098157610981615923565b7fff000000000000000000000000000000000000000000000000000000000000008460f81b16815260008351615d66816001850160208801614dbf565b835190830190615d7d816001840160208801614dbf565b0160010195945050505050565b60006001600160a01b03808816835280871660208401525060a06040830152615db660a08301866153a4565b8281036060840152615dc881866153a4565b90508281036080840152613a8d8185614de3565b600060208284031215615dee57600080fd5b8151610a8281614d8c565b600060033d1115615e125760046000803e5060005160e01c5b90565b600060443d1015615e235790565b6040516003193d81016004833e81513d67ffffffffffffffff8160248401118184111715615e5357505050505090565b8285019150815181811115615e6b5750505050505090565b843d8701016020828501011115615e855750505050505090565b615e9460208286010187614fcb565b509095945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152615ed760a0830184614de3565b97965050505050505056fe68747470733a2f2f6d657461646174612e6f7074692e646f6d61696e732f636f6c6c656374696f6e2f646f6d61696e732f746f776ea26469706673582212208b551cdf2415d95b129de5adc1af52b884e6dd3d0365ed227c13454b577bf59b64736f6c63430008110033

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

000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b490000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e000000000000000000000000b02eded8502b029aa7f2cb02e1c2a0c45253127900000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000004746f776e00000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _ens (address): 0x888811b3DFC94566Fc8F6aC5e86069981a50B490
Arg [1] : _registrar (address): 0xB02ED512702C46dbDB260053C97f79c3F467E39E
Arg [2] : _metadataService (address): 0xB02EDED8502B029aA7f2CB02e1C2a0c452531279
Arg [3] : _ethNode (string): town

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000888811b3dfc94566fc8f6ac5e86069981a50b490
Arg [1] : 000000000000000000000000b02ed512702c46dbdb260053c97f79c3f467e39e
Arg [2] : 000000000000000000000000b02eded8502b029aa7f2cb02e1c2a0c452531279
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [5] : 746f776e00000000000000000000000000000000000000000000000000000000


[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.