ETH Price: $1,971.95 (+0.50%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Addr245104242026-02-22 5:49:472 mins ago1771739387IN
0xF2910098...7B804AC15
0 ETH0.000002230.03408796
Multicall245103982026-02-22 5:44:357 mins ago1771739075IN
0xF2910098...7B804AC15
0 ETH0.000002340.03399069
Multicall245103942026-02-22 5:43:478 mins ago1771739027IN
0xF2910098...7B804AC15
0 ETH0.000002120.03074415
Set Addr245103922026-02-22 5:43:238 mins ago1771739003IN
0xF2910098...7B804AC15
0 ETH0.000005630.09703516
Multicall245103902026-02-22 5:42:599 mins ago1771738979IN
0xF2910098...7B804AC15
0 ETH0.00000230.03343149
Multicall245103872026-02-22 5:42:239 mins ago1771738943IN
0xF2910098...7B804AC15
0 ETH0.00000220.03199643
Set Text245103842026-02-22 5:41:4710 mins ago1771738907IN
0xF2910098...7B804AC15
0 ETH0.000005030.03350224
Multicall245103822026-02-22 5:41:2310 mins ago1771738883IN
0xF2910098...7B804AC15
0 ETH0.000002230.03236516
Multicall245103772026-02-22 5:40:2311 mins ago1771738823IN
0xF2910098...7B804AC15
0 ETH0.000005510.0304416
Set Addr245103552026-02-22 5:35:5916 mins ago1771738559IN
0xF2910098...7B804AC15
0 ETH0.000001680.02870353
Set Addr245103412026-02-22 5:33:1118 mins ago1771738391IN
0xF2910098...7B804AC15
0 ETH0.000001840.03134266
Set Text245101622026-02-22 4:57:2354 mins ago1771736243IN
0xF2910098...7B804AC15
0 ETH0.000004770.03173267
Set Text245101392026-02-22 4:52:471 hr ago1771735967IN
0xF2910098...7B804AC15
0 ETH0.000004910.03267393
Set Text245101182026-02-22 4:48:351 hr ago1771735715IN
0xF2910098...7B804AC15
0 ETH0.00000490.03263244
Multicall245101052026-02-22 4:45:591 hr ago1771735559IN
0xF2910098...7B804AC15
0 ETH0.000005960.03106201
Set Text245100932026-02-22 4:43:351 hr ago1771735415IN
0xF2910098...7B804AC15
0 ETH0.000004930.03277906
Multicall245100762026-02-22 4:40:111 hr ago1771735211IN
0xF2910098...7B804AC15
0 ETH0.000006220.03278799
Set Addr245100692026-02-22 4:38:471 hr ago1771735127IN
0xF2910098...7B804AC15
0 ETH0.000002030.03194493
Set Text245100572026-02-22 4:36:231 hr ago1771734983IN
0xF2910098...7B804AC15
0 ETH0.000004660.03102648
Set Text245100422026-02-22 4:33:231 hr ago1771734803IN
0xF2910098...7B804AC15
0 ETH0.000001330.03185787
Set Text245100092026-02-22 4:26:471 hr ago1771734407IN
0xF2910098...7B804AC15
0 ETH0.000004390.02923434
Set Text245099822026-02-22 4:21:231 hr ago1771734083IN
0xF2910098...7B804AC15
0 ETH0.000005040.03356577
Set Text245099542026-02-22 4:15:471 hr ago1771733747IN
0xF2910098...7B804AC15
0 ETH0.000004690.03122131
Set Addr245099372026-02-22 4:12:231 hr ago1771733543IN
0xF2910098...7B804AC15
0 ETH0.000054110.93136978
Set Text245099292026-02-22 4:10:471 hr ago1771733447IN
0xF2910098...7B804AC15
0 ETH0.000004420.02943955
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PublicResolver

Compiler Version
v0.8.26+commit.8a97fa7a

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
paris EvmVersion, MIT license
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.17 <0.9.0;

import "../registry/ENS.sol";
import "./profiles/ABIResolver.sol";
import "./profiles/AddrResolver.sol";
import "./profiles/ContentHashResolver.sol";
import "./profiles/DNSResolver.sol";
import "./profiles/InterfaceResolver.sol";
import "./profiles/NameResolver.sol";
import "./profiles/PubkeyResolver.sol";
import "./profiles/TextResolver.sol";
import "./Multicallable.sol";
import {ReverseClaimer} from "../reverseRegistrar/ReverseClaimer.sol";
import {INameWrapper} from "../wrapper/INameWrapper.sol";

/// A simple resolver anyone can use; only allows the owner of a node to set its
/// address.
contract PublicResolver is
    Multicallable,
    ABIResolver,
    AddrResolver,
    ContentHashResolver,
    DNSResolver,
    InterfaceResolver,
    NameResolver,
    PubkeyResolver,
    TextResolver,
    ReverseClaimer
{
    ENS immutable ens;
    INameWrapper immutable nameWrapper;
    address immutable trustedETHController;
    address immutable trustedReverseRegistrar;

    /// A mapping of operators. An address that is authorised for an address
    /// may make any changes to the name that the owner could, but may not update
    /// the set of authorisations.
    /// (owner, operator) => approved
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /// A mapping of delegates. A delegate that is authorised by an owner
    /// for a name may make changes to the name's resolver, but may not update
    /// the set of token approvals.
    /// (owner, name, delegate) => approved
    mapping(address => mapping(bytes32 => mapping(address => bool)))
        private _tokenApprovals;

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

    // Logged when a delegate is approved or  an approval is revoked.
    event Approved(
        address owner,
        bytes32 indexed node,
        address indexed delegate,
        bool indexed approved
    );

    constructor(
        ENS _ens,
        INameWrapper wrapperAddress,
        address _trustedETHController,
        address _trustedReverseRegistrar
    ) ReverseClaimer(_ens, msg.sender) {
        ens = _ens;
        nameWrapper = wrapperAddress;
        trustedETHController = _trustedETHController;
        trustedReverseRegistrar = _trustedReverseRegistrar;
    }

    /// @dev See {IERC1155-setApprovalForAll}.
    function setApprovalForAll(address operator, bool approved) external {
        require(
            msg.sender != operator,
            "ERC1155: setting approval status for self"
        );

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

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

    /// @dev Approve a delegate to be able to updated records on a node.
    function approve(bytes32 node, address delegate, bool approved) external {
        require(msg.sender != delegate, "Setting delegate status for self");

        _tokenApprovals[msg.sender][node][delegate] = approved;
        emit Approved(msg.sender, node, delegate, approved);
    }

    /// @dev Check to see if the delegate has been approved by the owner for the node.
    function isApprovedFor(
        address owner,
        bytes32 node,
        address delegate
    ) public view returns (bool) {
        return _tokenApprovals[owner][node][delegate];
    }

    function isAuthorised(bytes32 node) internal view override returns (bool) {
        if (
            msg.sender == trustedETHController ||
            msg.sender == trustedReverseRegistrar
        ) {
            return true;
        }
        address owner = ens.owner(node);
        if (owner == address(nameWrapper)) {
            owner = nameWrapper.ownerOf(uint256(node));
        }
        return
            owner == msg.sender ||
            isApprovedForAll(owner, msg.sender) ||
            isApprovedFor(owner, node, msg.sender);
    }

    function supportsInterface(
        bytes4 interfaceID
    )
        public
        view
        override(
            Multicallable,
            ABIResolver,
            AddrResolver,
            ContentHashResolver,
            DNSResolver,
            InterfaceResolver,
            NameResolver,
            PubkeyResolver,
            TextResolver
        )
        returns (bool)
    {
        return super.supportsInterface(interfaceID);
    }
}

// SPDX-License-Identifier: BSD-2-Clause
pragma solidity ^0.8.4;

/**
* @dev A library for working with mutable byte buffers in Solidity.
*
* Byte buffers are mutable and expandable, and provide a variety of primitives
* for appending to them. At any time you can fetch a bytes object containing the
* current contents of the buffer. The bytes object should not be stored between
* operations, as it may change due to resizing of the buffer.
*/
library Buffer {
    /**
    * @dev Represents a mutable buffer. Buffers have a current value (buf) and
    *      a capacity. The capacity may be longer than the current value, in
    *      which case it can be extended without the need to allocate more memory.
    */
    struct buffer {
        bytes buf;
        uint capacity;
    }

    /**
    * @dev Initializes a buffer with an initial capacity.
    * @param buf The buffer to initialize.
    * @param capacity The number of bytes of space to allocate the buffer.
    * @return The buffer, for chaining.
    */
    function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {
        if (capacity % 32 != 0) {
            capacity += 32 - (capacity % 32);
        }
        // Allocate space for the buffer data
        buf.capacity = capacity;
        assembly {
            let ptr := mload(0x40)
            mstore(buf, ptr)
            mstore(ptr, 0)
            let fpm := add(32, add(ptr, capacity))
            if lt(fpm, ptr) {
                revert(0, 0)
            }
            mstore(0x40, fpm)
        }
        return buf;
    }

    /**
    * @dev Initializes a new buffer from an existing bytes object.
    *      Changes to the buffer may mutate the original value.
    * @param b The bytes object to initialize the buffer with.
    * @return A new buffer.
    */
    function fromBytes(bytes memory b) internal pure returns(buffer memory) {
        buffer memory buf;
        buf.buf = b;
        buf.capacity = b.length;
        return buf;
    }

    function resize(buffer memory buf, uint capacity) private pure {
        bytes memory oldbuf = buf.buf;
        init(buf, capacity);
        append(buf, oldbuf);
    }

    /**
    * @dev Sets buffer length to 0.
    * @param buf The buffer to truncate.
    * @return The original buffer, for chaining..
    */
    function truncate(buffer memory buf) internal pure returns (buffer memory) {
        assembly {
            let bufptr := mload(buf)
            mstore(bufptr, 0)
        }
        return buf;
    }

    /**
    * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed
    *      the capacity of the buffer.
    * @param buf The buffer to append to.
    * @param data The data to append.
    * @param len The number of bytes to copy.
    * @return The original buffer, for chaining.
    */
    function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {
        require(len <= data.length);

        uint off = buf.buf.length;
        uint newCapacity = off + len;
        if (newCapacity > buf.capacity) {
            resize(buf, newCapacity * 2);
        }

        uint dest;
        uint src;
        assembly {
            // Memory address of the buffer data
            let bufptr := mload(buf)
            // Length of existing buffer data
            let buflen := mload(bufptr)
            // Start address = buffer address + offset + sizeof(buffer length)
            dest := add(add(bufptr, 32), off)
            // Update buffer length if we're extending it
            if gt(newCapacity, buflen) {
                mstore(bufptr, newCapacity)
            }
            src := add(data, 32)
        }

        // Copy word-length chunks while possible
        for (; len >= 32; len -= 32) {
            assembly {
                mstore(dest, mload(src))
            }
            dest += 32;
            src += 32;
        }

        // Copy remaining bytes
        unchecked {
            uint mask = (256 ** (32 - len)) - 1;
            assembly {
                let srcpart := and(mload(src), not(mask))
                let destpart := and(mload(dest), mask)
                mstore(dest, or(destpart, srcpart))
            }
        }

        return buf;
    }

    /**
    * @dev Appends a byte string to a buffer. Resizes if doing so would exceed
    *      the capacity of the buffer.
    * @param buf The buffer to append to.
    * @param data The data to append.
    * @return The original buffer, for chaining.
    */
    function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {
        return append(buf, data, data.length);
    }

    /**
    * @dev Appends a byte to the buffer. Resizes if doing so would exceed the
    *      capacity of the buffer.
    * @param buf The buffer to append to.
    * @param data The data to append.
    * @return The original buffer, for chaining.
    */
    function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {
        uint off = buf.buf.length;
        uint offPlusOne = off + 1;
        if (off >= buf.capacity) {
            resize(buf, offPlusOne * 2);
        }

        assembly {
            // Memory address of the buffer data
            let bufptr := mload(buf)
            // Address = buffer address + sizeof(buffer length) + off
            let dest := add(add(bufptr, off), 32)
            mstore8(dest, data)
            // Update buffer length if we extended it
            if gt(offPlusOne, mload(bufptr)) {
                mstore(bufptr, offPlusOne)
            }
        }

        return buf;
    }

    /**
    * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would
    *      exceed the capacity of the buffer.
    * @param buf The buffer to append to.
    * @param data The data to append.
    * @param len The number of bytes to write (left-aligned).
    * @return The original buffer, for chaining.
    */
    function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {
        uint off = buf.buf.length;
        uint newCapacity = len + off;
        if (newCapacity > buf.capacity) {
            resize(buf, newCapacity * 2);
        }

        unchecked {
            uint mask = (256 ** len) - 1;
            // Right-align data
            data = data >> (8 * (32 - len));
            assembly {
                // Memory address of the buffer data
                let bufptr := mload(buf)
                // Address = buffer address + sizeof(buffer length) + newCapacity
                let dest := add(bufptr, newCapacity)
                mstore(dest, or(and(mload(dest), not(mask)), data))
                // Update buffer length if we extended it
                if gt(newCapacity, mload(bufptr)) {
                    mstore(bufptr, newCapacity)
                }
            }
        }
        return buf;
    }

    /**
    * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed
    *      the capacity of the buffer.
    * @param buf The buffer to append to.
    * @param data The data to append.
    * @return The original buffer, for chhaining.
    */
    function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {
        return append(buf, bytes32(data), 20);
    }

    /**
    * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed
    *      the capacity of the buffer.
    * @param buf The buffer to append to.
    * @param data The data to append.
    * @return The original buffer, for chaining.
    */
    function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {
        return append(buf, data, 32);
    }

    /**
     * @dev Appends a byte to the end of the buffer. Resizes if doing so would
     *      exceed the capacity of the buffer.
     * @param buf The buffer to append to.
     * @param data The data to append.
     * @param len The number of bytes to write (right-aligned).
     * @return The original buffer.
     */
    function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {
        uint off = buf.buf.length;
        uint newCapacity = len + off;
        if (newCapacity > buf.capacity) {
            resize(buf, newCapacity * 2);
        }

        uint mask = (256 ** len) - 1;
        assembly {
            // Memory address of the buffer data
            let bufptr := mload(buf)
            // Address = buffer address + sizeof(buffer length) + newCapacity
            let dest := add(bufptr, newCapacity)
            mstore(dest, or(and(mload(dest), not(mask)), data))
            // Update buffer length if we extended it
            if gt(newCapacity, mload(bufptr)) {
                mstore(bufptr, newCapacity)
            }
        }
        return buf;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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);
}

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

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

//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "../utils/BytesUtils.sol";
import "@ensdomains/buffer/contracts/Buffer.sol";

/// @dev RRUtils is a library that provides utilities for parsing DNS resource records.
library RRUtils {
    using BytesUtils for *;
    using Buffer for *;

    /// @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.
    /// @param self The byte array to read a name from.
    /// @param offset The offset to start reading at.
    /// @return The length of the DNS name at 'offset', in bytes.
    function nameLength(
        bytes memory self,
        uint256 offset
    ) internal pure returns (uint256) {
        uint256 idx = offset;
        while (true) {
            assert(idx < self.length);
            uint256 labelLen = self.readUint8(idx);
            idx += labelLen + 1;
            if (labelLen == 0) {
                break;
            }
        }
        return idx - offset;
    }

    /// @dev Returns a DNS format name at the specified offset of self.
    /// @param self The byte array to read a name from.
    /// @param offset The offset to start reading at.
    /// @return ret The name.
    function readName(
        bytes memory self,
        uint256 offset
    ) internal pure returns (bytes memory ret) {
        uint256 len = nameLength(self, offset);
        return self.substring(offset, len);
    }

    /// @dev Returns the number of labels in the DNS name at 'offset' in 'self'.
    /// @param self The byte array to read a name from.
    /// @param offset The offset to start reading at.
    /// @return The number of labels in the DNS name at 'offset', in bytes.
    function labelCount(
        bytes memory self,
        uint256 offset
    ) internal pure returns (uint256) {
        uint256 count = 0;
        while (true) {
            assert(offset < self.length);
            uint256 labelLen = self.readUint8(offset);
            offset += labelLen + 1;
            if (labelLen == 0) {
                break;
            }
            count += 1;
        }
        return count;
    }

    uint256 constant RRSIG_TYPE = 0;
    uint256 constant RRSIG_ALGORITHM = 2;
    uint256 constant RRSIG_LABELS = 3;
    uint256 constant RRSIG_TTL = 4;
    uint256 constant RRSIG_EXPIRATION = 8;
    uint256 constant RRSIG_INCEPTION = 12;
    uint256 constant RRSIG_KEY_TAG = 16;
    uint256 constant RRSIG_SIGNER_NAME = 18;

    struct SignedSet {
        uint16 typeCovered;
        uint8 algorithm;
        uint8 labels;
        uint32 ttl;
        uint32 expiration;
        uint32 inception;
        uint16 keytag;
        bytes signerName;
        bytes data;
        bytes name;
    }

    function readSignedSet(
        bytes memory data
    ) internal pure returns (SignedSet memory self) {
        self.typeCovered = data.readUint16(RRSIG_TYPE);
        self.algorithm = data.readUint8(RRSIG_ALGORITHM);
        self.labels = data.readUint8(RRSIG_LABELS);
        self.ttl = data.readUint32(RRSIG_TTL);
        self.expiration = data.readUint32(RRSIG_EXPIRATION);
        self.inception = data.readUint32(RRSIG_INCEPTION);
        self.keytag = data.readUint16(RRSIG_KEY_TAG);
        self.signerName = readName(data, RRSIG_SIGNER_NAME);
        self.data = data.substring(
            RRSIG_SIGNER_NAME + self.signerName.length,
            data.length - RRSIG_SIGNER_NAME - self.signerName.length
        );
    }

    function rrs(
        SignedSet memory rrset
    ) internal pure returns (RRIterator memory) {
        return iterateRRs(rrset.data, 0);
    }

    /// @dev An iterator over resource records.
    struct RRIterator {
        bytes data;
        uint256 offset;
        uint16 dnstype;
        uint16 class;
        uint32 ttl;
        uint256 rdataOffset;
        uint256 nextOffset;
    }

    /// @dev Begins iterating over resource records.
    /// @param self The byte string to read from.
    /// @param offset The offset to start reading at.
    /// @return ret An iterator object.
    function iterateRRs(
        bytes memory self,
        uint256 offset
    ) internal pure returns (RRIterator memory ret) {
        ret.data = self;
        ret.nextOffset = offset;
        next(ret);
    }

    /// @dev Returns true iff there are more RRs to iterate.
    /// @param iter The iterator to check.
    /// @return True iff the iterator has finished.
    function done(RRIterator memory iter) internal pure returns (bool) {
        return iter.offset >= iter.data.length;
    }

    /// @dev Moves the iterator to the next resource record.
    /// @param iter The iterator to advance.
    function next(RRIterator memory iter) internal pure {
        iter.offset = iter.nextOffset;
        if (iter.offset >= iter.data.length) {
            return;
        }

        // Skip the name
        uint256 off = iter.offset + nameLength(iter.data, iter.offset);

        // Read type, class, and ttl
        iter.dnstype = iter.data.readUint16(off);
        off += 2;
        iter.class = iter.data.readUint16(off);
        off += 2;
        iter.ttl = iter.data.readUint32(off);
        off += 4;

        // Read the rdata
        uint256 rdataLength = iter.data.readUint16(off);
        off += 2;
        iter.rdataOffset = off;
        iter.nextOffset = off + rdataLength;
    }

    /// @dev Returns the name of the current record.
    /// @param iter The iterator.
    /// @return A new bytes object containing the owner name from the RR.
    function name(RRIterator memory iter) internal pure returns (bytes memory) {
        return
            iter.data.substring(
                iter.offset,
                nameLength(iter.data, iter.offset)
            );
    }

    /// @dev Returns the rdata portion of the current record.
    /// @param iter The iterator.
    /// @return A new bytes object containing the RR's RDATA.
    function rdata(
        RRIterator memory iter
    ) internal pure returns (bytes memory) {
        return
            iter.data.substring(
                iter.rdataOffset,
                iter.nextOffset - iter.rdataOffset
            );
    }

    uint256 constant DNSKEY_FLAGS = 0;
    uint256 constant DNSKEY_PROTOCOL = 2;
    uint256 constant DNSKEY_ALGORITHM = 3;
    uint256 constant DNSKEY_PUBKEY = 4;

    struct DNSKEY {
        uint16 flags;
        uint8 protocol;
        uint8 algorithm;
        bytes publicKey;
    }

    function readDNSKEY(
        bytes memory data,
        uint256 offset,
        uint256 length
    ) internal pure returns (DNSKEY memory self) {
        self.flags = data.readUint16(offset + DNSKEY_FLAGS);
        self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);
        self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);
        self.publicKey = data.substring(
            offset + DNSKEY_PUBKEY,
            length - DNSKEY_PUBKEY
        );
    }

    uint256 constant DS_KEY_TAG = 0;
    uint256 constant DS_ALGORITHM = 2;
    uint256 constant DS_DIGEST_TYPE = 3;
    uint256 constant DS_DIGEST = 4;

    struct DS {
        uint16 keytag;
        uint8 algorithm;
        uint8 digestType;
        bytes digest;
    }

    function readDS(
        bytes memory data,
        uint256 offset,
        uint256 length
    ) internal pure returns (DS memory self) {
        self.keytag = data.readUint16(offset + DS_KEY_TAG);
        self.algorithm = data.readUint8(offset + DS_ALGORITHM);
        self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);
        self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);
    }

    function isSubdomainOf(
        bytes memory self,
        bytes memory other
    ) internal pure returns (bool) {
        uint256 off = 0;
        uint256 counts = labelCount(self, 0);
        uint256 othercounts = labelCount(other, 0);

        while (counts > othercounts) {
            off = progress(self, off);
            counts--;
        }

        return self.equals(off, other, 0);
    }

    function compareNames(
        bytes memory self,
        bytes memory other
    ) internal pure returns (int256) {
        if (self.equals(other)) {
            return 0;
        }

        uint256 off;
        uint256 otheroff;
        uint256 prevoff;
        uint256 otherprevoff;
        uint256 counts = labelCount(self, 0);
        uint256 othercounts = labelCount(other, 0);

        // Keep removing labels from the front of the name until both names are equal length
        while (counts > othercounts) {
            prevoff = off;
            off = progress(self, off);
            counts--;
        }

        while (othercounts > counts) {
            otherprevoff = otheroff;
            otheroff = progress(other, otheroff);
            othercounts--;
        }

        // Compare the last nonequal labels to each other
        while (counts > 0 && !self.equals(off, other, otheroff)) {
            prevoff = off;
            off = progress(self, off);
            otherprevoff = otheroff;
            otheroff = progress(other, otheroff);
            counts -= 1;
        }

        if (off == 0) {
            return -1;
        }
        if (otheroff == 0) {
            return 1;
        }

        return
            self.compare(
                prevoff + 1,
                self.readUint8(prevoff),
                other,
                otherprevoff + 1,
                other.readUint8(otherprevoff)
            );
    }

    /// @dev Compares two serial numbers using RFC1982 serial number math.
    function serialNumberGte(
        uint32 i1,
        uint32 i2
    ) internal pure returns (bool) {
        unchecked {
            return int32(i1) - int32(i2) >= 0;
        }
    }

    function progress(
        bytes memory body,
        uint256 off
    ) internal pure returns (uint256) {
        return off + 1 + body.readUint8(off);
    }

    /// @dev Computes the keytag for a chunk of data.
    /// @param data The data to compute a keytag for.
    /// @return The computed key tag.
    function computeKeytag(bytes memory data) internal pure returns (uint16) {
        /* This function probably deserves some explanation.
         * The DNSSEC keytag function is a checksum that relies on summing up individual bytes
         * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:
         *
         *     function computeKeytag(bytes memory data) internal pure returns (uint16) {
         *         uint ac;
         *         for (uint i = 0; i < data.length; i++) {
         *             ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);
         *         }
         *         return uint16(ac + (ac >> 16));
         *     }
         *
         * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;
         * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's
         * large words work in our favour.
         *
         * The code below works by treating the input as a series of 256 bit words. It first masks out
         * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.
         * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're
         * effectively summing 16 different numbers with each EVM ADD opcode.
         *
         * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.
         * It does this using the same trick - mask out every other value, shift to align them, add them together.
         * After the first addition on both accumulators, there's enough room to add the two accumulators together,
         * and the remaining sums can be done just on ac1.
         */
        unchecked {
            require(data.length <= 8192, "Long keys not permitted");
            uint256 ac1;
            uint256 ac2;
            for (uint256 i = 0; i < data.length + 31; i += 32) {
                uint256 word;
                assembly {
                    word := mload(add(add(data, 32), i))
                }
                if (i + 32 > data.length) {
                    uint256 unused = 256 - (data.length - i) * 8;
                    word = (word >> unused) << unused;
                }
                ac1 +=
                    (word &
                        0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>
                    8;
                ac2 += (word &
                    0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);
            }
            ac1 =
                (ac1 &
                    0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +
                ((ac1 &
                    0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>
                    16);
            ac2 =
                (ac2 &
                    0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +
                ((ac2 &
                    0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>
                    16);
            ac1 = (ac1 << 8) + ac2;
            ac1 =
                (ac1 &
                    0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +
                ((ac1 &
                    0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>
                    32);
            ac1 =
                (ac1 &
                    0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +
                ((ac1 &
                    0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>
                    64);
            ac1 =
                (ac1 &
                    0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +
                (ac1 >> 128);
            ac1 += (ac1 >> 16) & 0xFFFF;
            return uint16(ac1);
        }
    }
}

//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "../registry/ENS.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;
}

//SPDX-License-Identifier: MIT
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);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface IMulticallable {
    function multicall(
        bytes[] calldata data
    ) external returns (bytes[] memory results);

    function multicallWithNodeCheck(
        bytes32,
        bytes[] calldata data
    ) external returns (bytes[] memory results);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "./IMulticallable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";

abstract contract Multicallable is IMulticallable, ERC165 {
    function _multicall(
        bytes32 nodehash,
        bytes[] calldata data
    ) internal returns (bytes[] memory results) {
        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            if (nodehash != bytes32(0)) {
                bytes32 txNamehash = bytes32(data[i][4:36]);
                require(
                    txNamehash == nodehash,
                    "multicall: All records must have a matching namehash"
                );
            }
            (bool success, bytes memory result) = address(this).delegatecall(
                data[i]
            );
            require(success);
            results[i] = result;
        }
        return results;
    }

    // This function provides an extra security check when called
    // from priviledged contracts (such as EthRegistrarController)
    // that can set records on behalf of the node owners
    function multicallWithNodeCheck(
        bytes32 nodehash,
        bytes[] calldata data
    ) external returns (bytes[] memory results) {
        return _multicall(nodehash, data);
    }

    function multicall(
        bytes[] calldata data
    ) public override returns (bytes[] memory results) {
        return _multicall(bytes32(0), data);
    }

    function supportsInterface(
        bytes4 interfaceID
    ) public view virtual override returns (bool) {
        return
            interfaceID == type(IMulticallable).interfaceId ||
            super.supportsInterface(interfaceID);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "./profiles/IVersionableResolver.sol";

abstract contract ResolverBase is ERC165, IVersionableResolver {
    mapping(bytes32 => uint64) public recordVersions;

    function isAuthorised(bytes32 node) internal view virtual returns (bool);

    modifier authorised(bytes32 node) {
        require(isAuthorised(node));
        _;
    }

    /// Increments the record version associated with an ENS node.
    /// May only be called by the owner of that node in the ENS registry.
    /// @param node The node to update.
    function clearRecords(bytes32 node) public virtual authorised(node) {
        recordVersions[node]++;
        emit VersionChanged(node, recordVersions[node]);
    }

    function supportsInterface(
        bytes4 interfaceID
    ) public view virtual override returns (bool) {
        return
            interfaceID == type(IVersionableResolver).interfaceId ||
            super.supportsInterface(interfaceID);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

import "./IABIResolver.sol";
import "../ResolverBase.sol";

abstract contract ABIResolver is IABIResolver, ResolverBase {
    mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;

    /// Sets the ABI associated with an ENS node.
    /// Nodes may have one ABI of each content type. To remove an ABI, set it to
    /// the empty string.
    /// @param node The node to update.
    /// @param contentType The content type of the ABI
    /// @param data The ABI data.
    function setABI(
        bytes32 node,
        uint256 contentType,
        bytes calldata data
    ) external virtual authorised(node) {
        // Content types must be powers of 2
        require(((contentType - 1) & contentType) == 0);

        versionable_abis[recordVersions[node]][node][contentType] = data;
        emit ABIChanged(node, contentType);
    }

    /// Returns the ABI associated with an ENS node.
    /// Defined in EIP205.
    /// @param node The ENS node to query
    /// @param contentTypes A bitwise OR of the ABI formats accepted by the caller.
    /// @return contentType The content type of the return value
    /// @return data The ABI data
    function ABI(
        bytes32 node,
        uint256 contentTypes
    ) external view virtual override returns (uint256, bytes memory) {
        mapping(uint256 => bytes) storage abiset = versionable_abis[
            recordVersions[node]
        ][node];

        for (
            uint256 contentType = 1;
            contentType > 0 && contentType <= contentTypes;
            contentType <<= 1
        ) {
            if (
                (contentType & contentTypes) != 0 &&
                abiset[contentType].length > 0
            ) {
                return (contentType, abiset[contentType]);
            }
        }

        return (0, bytes(""));
    }

    function supportsInterface(
        bytes4 interfaceID
    ) public view virtual override returns (bool) {
        return
            interfaceID == type(IABIResolver).interfaceId ||
            super.supportsInterface(interfaceID);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

import {ResolverBase, IERC165} from "../ResolverBase.sol";
import {IAddrResolver} from "./IAddrResolver.sol";
import {IAddressResolver} from "./IAddressResolver.sol";
import {IHasAddressResolver} from "./IHasAddressResolver.sol";
import {ENSIP19, COIN_TYPE_ETH, COIN_TYPE_DEFAULT} from "../../utils/ENSIP19.sol";

abstract contract AddrResolver is
    IAddrResolver,
    IAddressResolver,
    IHasAddressResolver,
    ResolverBase
{
    mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;

    /// @notice The supplied address could not be converted to `address`.
    /// @dev Error selector: `0x8d666f60`
    error InvalidEVMAddress(bytes addressBytes);

    /// @notice Set `addr(60)` of the associated ENS node.
    ///         `address(0)` is stored as `new bytes(20)`.
    /// @param node The node to update.
    /// @param _addr The address to set.
    function setAddr(
        bytes32 node,
        address _addr
    ) external virtual authorised(node) {
        setAddr(node, COIN_TYPE_ETH, abi.encodePacked(_addr));
    }

    /// @notice Get `addr(60)` as `address` of the associated ENS node.
    /// @param node The node to query.
    /// @return The associated address.
    function addr(
        bytes32 node
    ) public view virtual override returns (address payable) {
        return payable(address(bytes20(addr(node, COIN_TYPE_ETH))));
    }

    /// @notice Set the address for coin type of the associated ENS node.
    ///         Reverts `InvalidEVMAddress` if coin type is EVM and not 0 or 20 bytes.
    /// @param node The node to update.
    /// @param coinType The coin type.
    /// @param addressBytes The address to set.
    function setAddr(
        bytes32 node,
        uint256 coinType,
        bytes memory addressBytes
    ) public virtual authorised(node) {
        if (
            addressBytes.length != 0 &&
            addressBytes.length != 20 &&
            ENSIP19.isEVMCoinType(coinType)
        ) {
            revert InvalidEVMAddress(addressBytes);
        }
        emit AddressChanged(node, coinType, addressBytes);
        if (coinType == COIN_TYPE_ETH) {
            emit AddrChanged(node, address(bytes20(addressBytes)));
        }
        versionable_addresses[recordVersions[node]][node][
            coinType
        ] = addressBytes;
    }

    /// @notice Get the address for coin type of the associated ENS node.
    ///         If coin type is EVM and empty, defaults to `addr(COIN_TYPE_DEFAULT)`.
    /// @param node The node to query.
    /// @param coinType The coin type.
    /// @return addressBytes The assocated address.
    function addr(
        bytes32 node,
        uint256 coinType
    ) public view virtual override returns (bytes memory addressBytes) {
        mapping(uint256 => bytes) storage addrs = versionable_addresses[
            recordVersions[node]
        ][node];
        addressBytes = addrs[coinType];
        if (
            addressBytes.length == 0 && ENSIP19.chainFromCoinType(coinType) > 0
        ) {
            addressBytes = addrs[COIN_TYPE_DEFAULT];
        }
    }

    /// @inheritdoc IHasAddressResolver
    function hasAddr(
        bytes32 node,
        uint256 coinType
    ) external view returns (bool) {
        return
            versionable_addresses[recordVersions[node]][node][coinType].length >
            0;
    }

    /// @inheritdoc IERC165
    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override returns (bool) {
        return
            type(IAddrResolver).interfaceId == interfaceId ||
            type(IAddressResolver).interfaceId == interfaceId ||
            type(IHasAddressResolver).interfaceId == interfaceId ||
            super.supportsInterface(interfaceId);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

import "../ResolverBase.sol";
import "./IContentHashResolver.sol";

abstract contract ContentHashResolver is IContentHashResolver, ResolverBase {
    mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;

    /// Sets the contenthash associated with an ENS node.
    /// May only be called by the owner of that node in the ENS registry.
    /// @param node The node to update.
    /// @param hash The contenthash to set
    function setContenthash(
        bytes32 node,
        bytes calldata hash
    ) external virtual authorised(node) {
        versionable_hashes[recordVersions[node]][node] = hash;
        emit ContenthashChanged(node, hash);
    }

    /// Returns the contenthash associated with an ENS node.
    /// @param node The ENS node to query.
    /// @return The associated contenthash.
    function contenthash(
        bytes32 node
    ) external view virtual override returns (bytes memory) {
        return versionable_hashes[recordVersions[node]][node];
    }

    function supportsInterface(
        bytes4 interfaceID
    ) public view virtual override returns (bool) {
        return
            interfaceID == type(IContentHashResolver).interfaceId ||
            super.supportsInterface(interfaceID);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

import "../ResolverBase.sol";
import "../../dnssec-oracle/RRUtils.sol";
import "./IDNSRecordResolver.sol";
import "./IDNSZoneResolver.sol";

abstract contract DNSResolver is
    IDNSRecordResolver,
    IDNSZoneResolver,
    ResolverBase
{
    using RRUtils for *;
    using BytesUtils for bytes;

    // Zone hashes for the domains.
    // A zone hash is an EIP-1577 content hash in binary format that should point to a
    // resource containing a single zonefile.
    // node => contenthash
    mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;

    // The records themselves.  Stored as binary RRSETs
    // node => version => name => resource => data
    mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))
        private versionable_records;

    // Count of number of entries for a given name.  Required for DNS resolvers
    // when resolving wildcards.
    // node => version => name => number of records
    mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))
        private versionable_nameEntriesCount;

    /// Set one or more DNS records.  Records are supplied in wire-format.
    /// Records with the same node/name/resource must be supplied one after the
    /// other to ensure the data is updated correctly. For example, if the data
    /// was supplied:
    ///     a.example.com IN A 1.2.3.4
    ///     a.example.com IN A 5.6.7.8
    ///     www.example.com IN CNAME a.example.com.
    /// then this would store the two A records for a.example.com correctly as a
    /// single RRSET, however if the data was supplied:
    ///     a.example.com IN A 1.2.3.4
    ///     www.example.com IN CNAME a.example.com.
    ///     a.example.com IN A 5.6.7.8
    /// then this would store the first A record, the CNAME, then the second A
    /// record which would overwrite the first.
    ///
    /// @param node the namehash of the node for which to set the records
    /// @param data the DNS wire format records to set
    function setDNSRecords(
        bytes32 node,
        bytes calldata data
    ) external virtual authorised(node) {
        uint16 resource = 0;
        uint256 offset = 0;
        bytes memory name;
        bytes memory value;
        bytes32 nameHash;
        uint64 version = recordVersions[node];
        // Iterate over the data to add the resource records
        for (
            RRUtils.RRIterator memory iter = data.iterateRRs(0);
            !iter.done();
            iter.next()
        ) {
            if (resource == 0) {
                resource = iter.dnstype;
                name = iter.name();
                nameHash = keccak256(abi.encodePacked(name));
                value = bytes(iter.rdata());
            } else {
                bytes memory newName = iter.name();
                if (resource != iter.dnstype || !name.equals(newName)) {
                    setDNSRRSet(
                        node,
                        name,
                        resource,
                        data,
                        offset,
                        iter.offset - offset,
                        value.length == 0,
                        version
                    );
                    resource = iter.dnstype;
                    offset = iter.offset;
                    name = newName;
                    nameHash = keccak256(name);
                    value = bytes(iter.rdata());
                }
            }
        }
        if (name.length > 0) {
            setDNSRRSet(
                node,
                name,
                resource,
                data,
                offset,
                data.length - offset,
                value.length == 0,
                version
            );
        }
    }

    /// Obtain a DNS record.
    /// @param node the namehash of the node for which to fetch the record
    /// @param name the keccak-256 hash of the fully-qualified name for which to fetch the record
    /// @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types
    /// @return the DNS record in wire format if present, otherwise empty
    function dnsRecord(
        bytes32 node,
        bytes32 name,
        uint16 resource
    ) public view virtual override returns (bytes memory) {
        return versionable_records[recordVersions[node]][node][name][resource];
    }

    /// Check if a given node has records.
    /// @param node the namehash of the node for which to check the records
    /// @param name the namehash of the node for which to check the records
    function hasDNSRecords(
        bytes32 node,
        bytes32 name
    ) public view virtual returns (bool) {
        return (versionable_nameEntriesCount[recordVersions[node]][node][
            name
        ] != 0);
    }

    /// setZonehash sets the hash for the zone.
    /// May only be called by the owner of that node in the ENS registry.
    /// @param node The node to update.
    /// @param hash The zonehash to set
    function setZonehash(
        bytes32 node,
        bytes calldata hash
    ) external virtual authorised(node) {
        uint64 currentRecordVersion = recordVersions[node];
        bytes memory oldhash = versionable_zonehashes[currentRecordVersion][
            node
        ];
        versionable_zonehashes[currentRecordVersion][node] = hash;
        emit DNSZonehashChanged(node, oldhash, hash);
    }

    /// zonehash obtains the hash for the zone.
    /// @param node The ENS node to query.
    /// @return The associated contenthash.
    function zonehash(
        bytes32 node
    ) external view virtual override returns (bytes memory) {
        return versionable_zonehashes[recordVersions[node]][node];
    }

    function supportsInterface(
        bytes4 interfaceID
    ) public view virtual override returns (bool) {
        return
            interfaceID == type(IDNSRecordResolver).interfaceId ||
            interfaceID == type(IDNSZoneResolver).interfaceId ||
            super.supportsInterface(interfaceID);
    }

    function setDNSRRSet(
        bytes32 node,
        bytes memory name,
        uint16 resource,
        bytes memory data,
        uint256 offset,
        uint256 size,
        bool deleteRecord,
        uint64 version
    ) private {
        bytes32 nameHash = keccak256(name);
        bytes memory rrData = data.substring(offset, size);
        if (deleteRecord) {
            if (
                versionable_records[version][node][nameHash][resource].length !=
                0
            ) {
                versionable_nameEntriesCount[version][node][nameHash]--;
            }
            delete (versionable_records[version][node][nameHash][resource]);
            emit DNSRecordDeleted(node, name, resource);
        } else {
            if (
                versionable_records[version][node][nameHash][resource].length ==
                0
            ) {
                versionable_nameEntriesCount[version][node][nameHash]++;
            }
            versionable_records[version][node][nameHash][resource] = rrData;
            emit DNSRecordChanged(node, name, resource, rrData);
        }
    }
}

File 17 of 41 : IABIResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

interface IABIResolver {
    event ABIChanged(bytes32 indexed node, uint256 indexed contentType);

    /// Returns the ABI associated with an ENS node.
    /// Defined in EIP205.
    /// @param node The ENS node to query
    /// @param contentTypes A bitwise OR of the ABI formats accepted by the caller.
    /// @return contentType The content type of the return value
    /// @return data The ABI data
    function ABI(
        bytes32 node,
        uint256 contentTypes
    ) external view returns (uint256, bytes memory);
}

File 18 of 41 : IAddrResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

/// Interface for the legacy (ETH-only) addr function.
interface IAddrResolver {
    event AddrChanged(bytes32 indexed node, address a);

    /// Returns the address associated with an ENS node.
    /// @param node The ENS node to query.
    /// @return The associated address.
    function addr(bytes32 node) external view returns (address payable);
}

File 19 of 41 : IAddressResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

/// Interface for the new (multicoin) addr function.
interface IAddressResolver {
    event AddressChanged(
        bytes32 indexed node,
        uint256 coinType,
        bytes newAddress
    );

    function addr(
        bytes32 node,
        uint256 coinType
    ) external view returns (bytes memory);
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

interface IContentHashResolver {
    event ContenthashChanged(bytes32 indexed node, bytes hash);

    /// Returns the contenthash associated with an ENS node.
    /// @param node The ENS node to query.
    /// @return The associated contenthash.
    function contenthash(bytes32 node) external view returns (bytes memory);
}

File 21 of 41 : IDNSRecordResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

interface IDNSRecordResolver {
    // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.
    event DNSRecordChanged(
        bytes32 indexed node,
        bytes name,
        uint16 resource,
        bytes record
    );
    // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.
    event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);

    /// Obtain a DNS record.
    /// @param node the namehash of the node for which to fetch the record
    /// @param name the keccak-256 hash of the fully-qualified name for which to fetch the record
    /// @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types
    /// @return the DNS record in wire format if present, otherwise empty
    function dnsRecord(
        bytes32 node,
        bytes32 name,
        uint16 resource
    ) external view returns (bytes memory);
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

interface IDNSZoneResolver {
    // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.
    event DNSZonehashChanged(
        bytes32 indexed node,
        bytes lastzonehash,
        bytes zonehash
    );

    /// zonehash obtains the hash for the zone.
    /// @param node The ENS node to query.
    /// @return The associated contenthash.
    function zonehash(bytes32 node) external view returns (bytes memory);
}

File 23 of 41 : IHasAddressResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

interface IHasAddressResolver {
    /// @notice Determine if an addresss is stored for the coin type of the associated ENS node.
    /// @param node The node to query.
    /// @param coinType The coin type.
    /// @return True if the associated address is not empty.
    function hasAddr(
        bytes32 node,
        uint256 coinType
    ) external view returns (bool);
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

interface IInterfaceResolver {
    event InterfaceChanged(
        bytes32 indexed node,
        bytes4 indexed interfaceID,
        address implementer
    );

    /// Returns the address of a contract that implements the specified interface for this name.
    /// If an implementer has not been set for this interfaceID and name, the resolver will query
    /// the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that
    /// contract implements EIP165 and returns `true` for the specified interfaceID, its address
    /// will be returned.
    /// @param node The ENS node to query.
    /// @param interfaceID The EIP 165 interface ID to check for.
    /// @return The address that implements this interface, or 0 if the interface is unsupported.
    function interfaceImplementer(
        bytes32 node,
        bytes4 interfaceID
    ) external view returns (address);
}

File 25 of 41 : INameResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

interface INameResolver {
    event NameChanged(bytes32 indexed node, string name);

    /// Returns the name associated with an ENS node, for reverse records.
    /// Defined in EIP181.
    /// @param node The ENS node to query.
    /// @return The associated name.
    function name(bytes32 node) external view returns (string memory);
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

interface IPubkeyResolver {
    event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);

    /// Returns the SECP256k1 public key associated with an ENS node.
    /// Defined in EIP 619.
    /// @param node The ENS node to query
    /// @return x The X coordinate of the curve point for the public key.
    /// @return y The Y coordinate of the curve point for the public key.
    function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);
}

File 27 of 41 : ITextResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

interface ITextResolver {
    event TextChanged(
        bytes32 indexed node,
        string indexed indexedKey,
        string key,
        string value
    );

    /// Returns the text data associated with an ENS node and key.
    /// @param node The ENS node to query.
    /// @param key The text data key to query.
    /// @return The associated text data.
    function text(
        bytes32 node,
        string calldata key
    ) external view returns (string memory);
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

interface IVersionableResolver {
    event VersionChanged(bytes32 indexed node, uint64 newVersion);

    function recordVersions(bytes32 node) external view returns (uint64);
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

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

abstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {
    mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;

    /// Sets an interface associated with a name.
    /// Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.
    /// @param node The node to update.
    /// @param interfaceID The EIP 165 interface ID.
    /// @param implementer The address of a contract that implements this interface for this node.
    function setInterface(
        bytes32 node,
        bytes4 interfaceID,
        address implementer
    ) external virtual authorised(node) {
        versionable_interfaces[recordVersions[node]][node][
            interfaceID
        ] = implementer;
        emit InterfaceChanged(node, interfaceID, implementer);
    }

    /// Returns the address of a contract that implements the specified interface for this name.
    /// If an implementer has not been set for this interfaceID and name, the resolver will query
    /// the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that
    /// contract implements EIP165 and returns `true` for the specified interfaceID, its address
    /// will be returned.
    /// @param node The ENS node to query.
    /// @param interfaceID The EIP 165 interface ID to check for.
    /// @return The address that implements this interface, or 0 if the interface is unsupported.
    function interfaceImplementer(
        bytes32 node,
        bytes4 interfaceID
    ) external view virtual override returns (address) {
        address implementer = versionable_interfaces[recordVersions[node]][
            node
        ][interfaceID];
        if (implementer != address(0)) {
            return implementer;
        }

        address a = addr(node);
        if (a == address(0)) {
            return address(0);
        }

        (bool success, bytes memory returnData) = a.staticcall(
            abi.encodeWithSignature(
                "supportsInterface(bytes4)",
                type(IERC165).interfaceId
            )
        );
        if (!success || returnData.length < 32 || returnData[31] == 0) {
            // EIP 165 not supported by target
            return address(0);
        }

        (success, returnData) = a.staticcall(
            abi.encodeWithSignature("supportsInterface(bytes4)", interfaceID)
        );
        if (!success || returnData.length < 32 || returnData[31] == 0) {
            // Specified interface not supported by target
            return address(0);
        }

        return a;
    }

    function supportsInterface(
        bytes4 interfaceID
    ) public view virtual override returns (bool) {
        return
            interfaceID == type(IInterfaceResolver).interfaceId ||
            super.supportsInterface(interfaceID);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

import "../ResolverBase.sol";
import "./INameResolver.sol";

abstract contract NameResolver is INameResolver, ResolverBase {
    mapping(uint64 => mapping(bytes32 => string)) versionable_names;

    /// Sets the name associated with an ENS node, for reverse records.
    /// May only be called by the owner of that node in the ENS registry.
    /// @param node The node to update.
    function setName(
        bytes32 node,
        string calldata newName
    ) external virtual authorised(node) {
        versionable_names[recordVersions[node]][node] = newName;
        emit NameChanged(node, newName);
    }

    /// Returns the name associated with an ENS node, for reverse records.
    /// Defined in EIP181.
    /// @param node The ENS node to query.
    /// @return The associated name.
    function name(
        bytes32 node
    ) external view virtual override returns (string memory) {
        return versionable_names[recordVersions[node]][node];
    }

    function supportsInterface(
        bytes4 interfaceID
    ) public view virtual override returns (bool) {
        return
            interfaceID == type(INameResolver).interfaceId ||
            super.supportsInterface(interfaceID);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

import "../ResolverBase.sol";
import "./IPubkeyResolver.sol";

abstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {
    struct PublicKey {
        bytes32 x;
        bytes32 y;
    }

    mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;

    /// Sets the SECP256k1 public key associated with an ENS node.
    /// @param node The ENS node to query
    /// @param x the X coordinate of the curve point for the public key.
    /// @param y the Y coordinate of the curve point for the public key.
    function setPubkey(
        bytes32 node,
        bytes32 x,
        bytes32 y
    ) external virtual authorised(node) {
        versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);
        emit PubkeyChanged(node, x, y);
    }

    /// Returns the SECP256k1 public key associated with an ENS node.
    /// Defined in EIP 619.
    /// @param node The ENS node to query
    /// @return x The X coordinate of the curve point for the public key.
    /// @return y The Y coordinate of the curve point for the public key.
    function pubkey(
        bytes32 node
    ) external view virtual override returns (bytes32 x, bytes32 y) {
        uint64 currentRecordVersion = recordVersions[node];
        return (
            versionable_pubkeys[currentRecordVersion][node].x,
            versionable_pubkeys[currentRecordVersion][node].y
        );
    }

    function supportsInterface(
        bytes4 interfaceID
    ) public view virtual override returns (bool) {
        return
            interfaceID == type(IPubkeyResolver).interfaceId ||
            super.supportsInterface(interfaceID);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

import "../ResolverBase.sol";
import "./ITextResolver.sol";

abstract contract TextResolver is ITextResolver, ResolverBase {
    mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;

    /// Sets the text data associated with an ENS node and key.
    /// May only be called by the owner of that node in the ENS registry.
    /// @param node The node to update.
    /// @param key The key to set.
    /// @param value The text data value to set.
    function setText(
        bytes32 node,
        string calldata key,
        string calldata value
    ) external virtual authorised(node) {
        versionable_texts[recordVersions[node]][node][key] = value;
        emit TextChanged(node, key, key, value);
    }

    /// Returns the text data associated with an ENS node and key.
    /// @param node The ENS node to query.
    /// @param key The text data key to query.
    /// @return The associated text data.
    function text(
        bytes32 node,
        string calldata key
    ) external view virtual override returns (string memory) {
        return versionable_texts[recordVersions[node]][node][key];
    }

    function supportsInterface(
        bytes4 interfaceID
    ) public view virtual override returns (bool) {
        return
            interfaceID == type(ITextResolver).interfaceId ||
            super.supportsInterface(interfaceID);
    }
}

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 34 of 41 : 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);
    }
}

//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

library BytesUtils {
    error OffsetOutOfBoundsError(uint256 offset, uint256 length);

    /// @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 ret 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 a positive number if `other` comes lexicographically after
    ///      `self`, a negative number if it comes before, or zero if the
    ///      contents of the two bytes are equal.
    /// @param self The first bytes to compare.
    /// @param other The second bytes to compare.
    /// @return The result of the comparison.
    function compare(
        bytes memory self,
        bytes memory other
    ) internal pure returns (int256) {
        return compare(self, 0, self.length, other, 0, other.length);
    }

    /// @dev Returns a positive number if `other` comes lexicographically after
    ///      `self`, a negative number if it comes before, or zero if the
    ///      contents of the two bytes are equal. Comparison is done per-rune,
    ///      on unicode codepoints.
    /// @param self The first bytes to compare.
    /// @param offset The offset of self.
    /// @param len    The length of self.
    /// @param other The second bytes to compare.
    /// @param otheroffset The offset of the other string.
    /// @param otherlen    The length of the other string.
    /// @return The result of the comparison.
    function compare(
        bytes memory self,
        uint256 offset,
        uint256 len,
        bytes memory other,
        uint256 otheroffset,
        uint256 otherlen
    ) internal pure returns (int256) {
        if (offset + len > self.length) {
            revert OffsetOutOfBoundsError(offset + len, self.length);
        }
        if (otheroffset + otherlen > other.length) {
            revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);
        }

        uint256 shortest = len;
        if (otherlen < len) shortest = otherlen;

        uint256 selfptr;
        uint256 otherptr;

        assembly {
            selfptr := add(self, add(offset, 32))
            otherptr := add(other, add(otheroffset, 32))
        }
        for (uint256 idx = 0; idx < shortest; idx += 32) {
            uint256 a;
            uint256 b;
            assembly {
                a := mload(selfptr)
                b := mload(otherptr)
            }
            if (a != b) {
                uint256 rest = shortest - idx;
                if (rest < 32) {
                    // shift out the irrelevant bits
                    rest = (32 - rest) << 3; // bits to drop
                    a >>= rest;
                    b >>= rest;
                }
                if (a < b) {
                    return -1;
                } else if (a > b) {
                    return 1;
                }
            }
            selfptr += 32;
            otherptr += 32;
        }

        return int256(len) - int256(otherlen);
    }

    /// @dev Returns true if the two byte ranges are equal.
    /// @param self The first byte range to compare.
    /// @param offset The offset into the first byte range.
    /// @param other The second byte range to compare.
    /// @param otherOffset The offset into the second byte range.
    /// @param len The number of bytes to compare
    /// @return True if the byte ranges are equal, false otherwise.
    function equals(
        bytes memory self,
        uint256 offset,
        bytes memory other,
        uint256 otherOffset,
        uint256 len
    ) internal pure returns (bool) {
        return keccak(self, offset, len) == keccak(other, otherOffset, len);
    }

    /// @dev Returns true if the two byte ranges are equal with offsets.
    /// @param self The first byte range to compare.
    /// @param offset The offset into the first byte range.
    /// @param other The second byte range to compare.
    /// @param otherOffset The offset into the second byte range.
    /// @return True if the byte ranges are equal, false otherwise.
    function equals(
        bytes memory self,
        uint256 offset,
        bytes memory other,
        uint256 otherOffset
    ) internal pure returns (bool) {
        return
            keccak(self, offset, self.length - offset) ==
            keccak(other, otherOffset, other.length - otherOffset);
    }

    /// @dev Compares a range of 'self' to all of 'other' and returns True iff
    ///      they are equal.
    /// @param self The first byte range to compare.
    /// @param offset The offset into the first byte range.
    /// @param other The second byte range to compare.
    /// @return True if the byte ranges are equal, false otherwise.
    function equals(
        bytes memory self,
        uint256 offset,
        bytes memory other
    ) internal pure returns (bool) {
        return
            self.length == offset + other.length &&
            equals(self, offset, other, 0, other.length);
    }

    /// @dev Returns true if the two byte ranges are equal.
    /// @param self The first byte range to compare.
    /// @param other The second byte range to compare.
    /// @return True if the byte ranges are equal, false otherwise.
    function equals(
        bytes memory self,
        bytes memory other
    ) internal pure returns (bool) {
        return
            self.length == other.length &&
            equals(self, 0, other, 0, self.length);
    }

    /// @dev Returns the 8-bit number at the specified index of self.
    /// @param self The byte string.
    /// @param idx The index into the bytes
    /// @return ret The specified 8 bits of the string, interpreted as an integer.
    function readUint8(
        bytes memory self,
        uint256 idx
    ) internal pure returns (uint8 ret) {
        return uint8(self[idx]);
    }

    /// @dev Returns the 16-bit number at the specified index of self.
    /// @param self The byte string.
    /// @param idx The index into the bytes
    /// @return ret The specified 16 bits of the string, interpreted as an integer.
    function readUint16(
        bytes memory self,
        uint256 idx
    ) internal pure returns (uint16 ret) {
        require(idx + 2 <= self.length);
        assembly {
            ret := and(mload(add(add(self, 2), idx)), 0xFFFF)
        }
    }

    /// @dev Returns the 32-bit number at the specified index of self.
    /// @param self The byte string.
    /// @param idx The index into the bytes
    /// @return ret The specified 32 bits of the string, interpreted as an integer.
    function readUint32(
        bytes memory self,
        uint256 idx
    ) internal pure returns (uint32 ret) {
        require(idx + 4 <= self.length);
        assembly {
            ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)
        }
    }

    /// @dev Returns the 32 byte value at the specified index of self.
    /// @param self The byte string.
    /// @param idx The index into the bytes
    /// @return ret The specified 32 bytes of the string.
    function readBytes32(
        bytes memory self,
        uint256 idx
    ) internal pure returns (bytes32 ret) {
        require(idx + 32 <= self.length);
        assembly {
            ret := mload(add(add(self, 32), idx))
        }
    }

    /// @dev Returns the 32 byte value at the specified index of self.
    /// @param self The byte string.
    /// @param idx The index into the bytes
    /// @return ret The specified 32 bytes of the string.
    function readBytes20(
        bytes memory self,
        uint256 idx
    ) internal pure returns (bytes20 ret) {
        require(idx + 20 <= self.length);
        assembly {
            ret := and(
                mload(add(add(self, 32), idx)),
                0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000
            )
        }
    }

    /// @dev Returns the n byte value at the specified index of self.
    /// @param self The byte string.
    /// @param idx The index into the bytes.
    /// @param len The number of bytes.
    /// @return ret The specified 32 bytes of the string.
    function readBytesN(
        bytes memory self,
        uint256 idx,
        uint256 len
    ) internal pure returns (bytes32 ret) {
        require(len <= 32);
        require(idx + len <= self.length);
        assembly {
            let mask := not(sub(exp(256, sub(32, len)), 1))
            ret := and(mload(add(add(self, 32), idx)), mask)
        }
    }

    function memcpy(uint256 dest, uint256 src, uint256 len) private pure {
        // Copy word-length chunks while possible
        for (; len >= 32; len -= 32) {
            assembly {
                mstore(dest, mload(src))
            }
            dest += 32;
            src += 32;
        }

        // Copy remaining bytes
        unchecked {
            uint256 mask = (256 ** (32 - len)) - 1;
            assembly {
                let srcpart := and(mload(src), not(mask))
                let destpart := and(mload(dest), mask)
                mstore(dest, or(destpart, srcpart))
            }
        }
    }

    /// @dev Copies a substring into a new byte string.
    /// @param self The byte string to copy from.
    /// @param offset The offset to start copying at.
    /// @param len The number of bytes to copy.
    function substring(
        bytes memory self,
        uint256 offset,
        uint256 len
    ) internal pure returns (bytes memory) {
        require(offset + len <= self.length);

        bytes memory ret = new bytes(len);
        uint256 dest;
        uint256 src;

        assembly {
            dest := add(ret, 32)
            src := add(add(self, 32), offset)
        }
        memcpy(dest, src, len);

        return ret;
    }

    // Maps characters from 0x30 to 0x7A to their base32 values.
    // 0xFF represents invalid characters in that range.
    bytes constant base32HexTable =
        hex"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F";

    /// @dev Decodes unpadded base32 data of up to one word in length.
    /// @param self The data to decode.
    /// @param off Offset into the string to start at.
    /// @param len Number of characters to decode.
    /// @return The decoded data, left aligned.
    function base32HexDecodeWord(
        bytes memory self,
        uint256 off,
        uint256 len
    ) internal pure returns (bytes32) {
        require(len <= 52);

        uint256 ret = 0;
        uint8 decoded;
        for (uint256 i = 0; i < len; i++) {
            bytes1 char = self[off + i];
            require(char >= 0x30 && char <= 0x7A);
            decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);
            require(decoded <= 0x20);
            if (i == len - 1) {
                break;
            }
            ret = (ret << 5) | decoded;
        }

        uint256 bitlen = len * 5;
        if (len % 8 == 0) {
            // Multiple of 8 characters, no padding
            ret = (ret << 5) | decoded;
        } else if (len % 8 == 2) {
            // Two extra characters - 1 byte
            ret = (ret << 3) | (decoded >> 2);
            bitlen -= 2;
        } else if (len % 8 == 4) {
            // Four extra characters - 2 bytes
            ret = (ret << 1) | (decoded >> 4);
            bitlen -= 4;
        } else if (len % 8 == 5) {
            // Five extra characters - 3 bytes
            ret = (ret << 4) | (decoded >> 1);
            bitlen -= 1;
        } else if (len % 8 == 7) {
            // Seven extra characters - 4 bytes
            ret = (ret << 2) | (decoded >> 3);
            bitlen -= 3;
        } else {
            revert();
        }

        return bytes32(ret << (256 - bitlen));
    }

    /// @dev Finds the first occurrence of the byte `needle` in `self`.
    /// @param self The string to search
    /// @param off The offset to start searching at
    /// @param len The number of bytes to search
    /// @param needle The byte to search for
    /// @return The offset of `needle` in `self`, or 2**256-1 if it was not found.
    function find(
        bytes memory self,
        uint256 off,
        uint256 len,
        bytes1 needle
    ) internal pure returns (uint256) {
        for (uint256 idx = off; idx < off + len; idx++) {
            if (self[idx] == needle) {
                return idx;
            }
        }
        return type(uint256).max;
    }
}

//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {HexUtils} from "../utils/HexUtils.sol";
import {NameCoder} from "../utils/NameCoder.sol";

uint32 constant CHAIN_ID_ETH = 1;

uint256 constant COIN_TYPE_ETH = 60;
uint256 constant COIN_TYPE_DEFAULT = 1 << 31; // 0x8000_0000

string constant SLUG_ETH = "addr"; // <=> COIN_TYPE_ETH
string constant SLUG_DEFAULT = "default"; // <=> COIN_TYPE_DEFAULT
string constant TLD_REVERSE = "reverse";

/// @dev Library for generating reverse names according to ENSIP-19.
/// https://docs.ens.domains/ensip/19
library ENSIP19 {
    /// @dev The supplied address was `0x`.
    error EmptyAddress();

    /// @dev Extract Chain ID from `coinType`.
    /// @param coinType The coin type.
    /// @return The Chain ID or 0 if non-EVM Chain.
    function chainFromCoinType(
        uint256 coinType
    ) internal pure returns (uint32) {
        if (coinType == COIN_TYPE_ETH) return CHAIN_ID_ETH;
        coinType ^= COIN_TYPE_DEFAULT;
        return uint32(coinType < COIN_TYPE_DEFAULT ? coinType : 0);
    }

    /// @dev Determine if Coin Type is for an EVM address.
    /// @param coinType The coin type.
    /// @return True if coin type represents an EVM address.
    function isEVMCoinType(uint256 coinType) internal pure returns (bool) {
        return coinType == COIN_TYPE_DEFAULT || chainFromCoinType(coinType) > 0;
    }

    /// @dev Generate Reverse Name from Address + Coin Type.
    ///      Reverts `EmptyAddress` if `addressBytes` is `0x`.
    /// @param addressBytes The input address.
    /// @param coinType The coin type.
    /// @return The ENS reverse name, eg. `1234abcd.addr.reverse`.
    function reverseName(
        bytes memory addressBytes,
        uint256 coinType
    ) internal pure returns (string memory) {
        if (addressBytes.length == 0) {
            revert EmptyAddress();
        }
        return
            string(
                abi.encodePacked(
                    HexUtils.bytesToHex(addressBytes),
                    bytes1("."),
                    coinType == COIN_TYPE_ETH
                        ? SLUG_ETH
                        : coinType == COIN_TYPE_DEFAULT
                            ? SLUG_DEFAULT
                            : HexUtils.unpaddedUintToHex(coinType, true),
                    bytes1("."),
                    TLD_REVERSE
                )
            );
    }

    /// @dev Parse Reverse Name into Address + Coin Type.
    ///      Matches: /^[0-9a-fA-F]+\.([0-9a-f]{1,64}|addr|default)\.reverse$/.
    ///      Reverts `DNSDecodingFailed`.
    /// @param name The DNS-encoded name.
    /// @return addressBytes The address or empty if invalid.
    /// @return coinType The coin type.
    function parse(
        bytes memory name
    ) internal pure returns (bytes memory addressBytes, uint256 coinType) {
        (, uint256 offset) = NameCoder.readLabel(name, 0);
        bool valid;
        (addressBytes, valid) = HexUtils.hexToBytes(name, 1, offset);
        if (!valid || addressBytes.length == 0) return ("", 0); // addressBytes not 1+ hex
        (valid, coinType) = parseNamespace(name, offset);
        if (!valid) return ("", 0); // invalid namespace
    }

    /// @dev Parse Reverse Namespace into Coin Type.
    ///      Matches: /^([0-9a-f]{1,64}|addr|default)\.reverse$/.
    ///      Reverts `DNSDecodingFailed`.
    /// @param name The DNS-encoded name.
    /// @param offset The offset to begin parsing.
    /// @return valid True if a valid reverse namespace.
    /// @return coinType The coin type.
    function parseNamespace(
        bytes memory name,
        uint256 offset
    ) internal pure returns (bool valid, uint256 coinType) {
        (bytes32 labelHash, uint256 offsetTLD) = NameCoder.readLabel(
            name,
            offset
        );
        if (labelHash == keccak256(bytes(SLUG_ETH))) {
            coinType = COIN_TYPE_ETH;
        } else if (labelHash == keccak256(bytes(SLUG_DEFAULT))) {
            coinType = COIN_TYPE_DEFAULT;
        } else if (labelHash == bytes32(0)) {
            return (false, 0); // no slug
        } else {
            (bytes32 word, bool validHex) = HexUtils.hexStringToBytes32(
                name,
                1 + offset,
                offsetTLD
            );
            if (!validHex) return (false, 0); // invalid coinType or too long
            coinType = uint256(word);
        }
        (labelHash, offset) = NameCoder.readLabel(name, offsetTLD);
        if (labelHash != keccak256(bytes(TLD_REVERSE))) return (false, 0); // invalid tld
        (labelHash, ) = NameCoder.readLabel(name, offset);
        if (labelHash != bytes32(0)) return (false, 0); // not tld
        valid = true;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

library HexUtils {
    /// @dev Convert `hexString[pos:end]` to `bytes32`.
    ///      Accepts 0-64 hex-chars.
    ///      Uses right alignment: `1` &rarr; `0000000000000000000000000000000000000000000000000000000000000001`.
    /// @param hexString The string to parse.
    /// @param pos The index to start parsing.
    /// @param end The (exclusive) index to stop parsing.
    /// @return word The parsed bytes32.
    /// @return valid True if the parse was successful.
    function hexStringToBytes32(
        bytes memory hexString,
        uint256 pos,
        uint256 end
    ) internal pure returns (bytes32 word, bool valid) {
        uint256 nibbles = end - pos;
        if (nibbles > 64 || end > hexString.length) {
            return (bytes32(0), false); // too large or out of bounds
        }
        uint256 src;
        assembly {
            src := add(add(hexString, 32), pos)
        }
        valid = unsafeBytes(src, 0, nibbles);
        assembly {
            let pad := sub(32, shr(1, add(nibbles, 1))) // number of bytes
            word := shr(shl(3, pad), mload(0)) // right align
        }
    }

    /// @dev Convert `hexString[pos:end]` to `address`.
    ///      Accepts exactly 40 hex-chars.
    /// @param hexString The string to parse.
    /// @param pos The index to start parsing.
    /// @param end The (exclusive) index to stop parsing.
    /// @return addr The parsed address.
    /// @return valid True if the parse was successful.
    function hexToAddress(
        bytes memory hexString,
        uint256 pos,
        uint256 end
    ) internal pure returns (address addr, bool valid) {
        if (end - pos != 40) return (address(0), false); // wrong length
        bytes32 word;
        (word, valid) = hexStringToBytes32(hexString, pos, end);
        addr = address(uint160(uint256(word)));
    }

    /// @dev Convert `hexString[pos:end]` to `bytes`.
    ///      Accepts 0+ hex-chars.
    /// @param pos The index to start parsing.
    /// @param end The (exclusive) index to stop parsing.
    /// @return v The parsed bytes.
    /// @return valid True if the parse was successful.
    function hexToBytes(
        bytes memory hexString,
        uint256 pos,
        uint256 end
    ) internal pure returns (bytes memory v, bool valid) {
        uint256 nibbles = end - pos;
        v = new bytes((1 + nibbles) >> 1); // round up
        uint256 src;
        uint256 dst;
        assembly {
            src := add(add(hexString, 32), pos)
            dst := add(v, 32)
        }
        valid = unsafeBytes(src, dst, nibbles);
    }

    /// @dev Convert arbitrary hex-encoded memory to bytes.
    ///      If nibbles is odd, leading hex-char is padded, eg. `F` &rarr; `0x0F`.
    ///      Matches: /^[0-9a-f]*$/i.
    /// @param src The memory offset of first hex-char of input.
    /// @param dst The memory offset of first byte of output (cannot alias `src`).
    /// @param nibbles The number of hex-chars to convert.
    /// @return valid True if all characters were hex.
    function unsafeBytes(
        uint256 src,
        uint256 dst,
        uint256 nibbles
    ) internal pure returns (bool valid) {
        assembly {
            function getHex(c, i) -> ascii {
                c := byte(i, c)
                // chars 48-57: 0-9
                if and(gt(c, 47), lt(c, 58)) {
                    ascii := sub(c, 48)
                    leave
                }
                // chars 65-70: A-F
                if and(gt(c, 64), lt(c, 71)) {
                    ascii := add(sub(c, 65), 10)
                    leave
                }
                // chars 97-102: a-f
                if and(gt(c, 96), lt(c, 103)) {
                    ascii := add(sub(c, 97), 10)
                    leave
                }
                // invalid char
                ascii := 0x100
            }
            valid := true
            let end := add(src, nibbles)
            if and(nibbles, 1) {
                let b := getHex(mload(src), 0) // "f" -> 15
                mstore8(dst, b) // write ascii byte
                src := add(src, 1) // update pointers
                dst := add(dst, 1)
                if gt(b, 255) {
                    valid := false
                    src := end // terminate loop
                }
            }
            for {} lt(src, end) {
                src := add(src, 2) // 2 nibbles
                dst := add(dst, 1) // per byte
            } {
                let word := mload(src) // read word (left aligned)
                let b := or(shl(4, getHex(word, 0)), getHex(word, 1)) // "ff" -> 255
                if gt(b, 255) {
                    valid := false
                    break
                }
                mstore8(dst, b) // write ascii byte
            }
        }
    }

    /// @dev Format `address` as a hex string.
    /// @param addr The address to format.
    /// @return hexString The corresponding hex string w/o a 0x-prefix.
    function addressToHex(
        address addr
    ) internal pure returns (string memory hexString) {
        // return bytesToHex(abi.encodePacked(addr));
        hexString = new string(40);
        uint256 dst;
        assembly {
            mstore(0, addr)
            dst := add(hexString, 32)
        }
        unsafeHex(12, dst, 40);
    }

    /// @dev Format `uint256` as a variable-length hex string without zero padding.
    /// * unpaddedUintToHex(0, true)  = "0"
    /// * unpaddedUintToHex(1, true)  = "1"
    /// * unpaddedUintToHex(0, false) = "00"
    /// * unpaddedUintToHex(1, false) = "01"
    /// @param value The number to format.
    /// @param dropZeroNibble If true, the leading byte will use one nibble if less than 16.
    /// @return hexString The corresponding hex string w/o an 0x-prefix.
    function unpaddedUintToHex(
        uint256 value,
        bool dropZeroNibble
    ) internal pure returns (string memory hexString) {
        uint256 temp = value;
        uint256 shift;
        for (uint256 b = 128; b >= 8; b >>= 1) {
            if (temp < (1 << b)) {
                shift += b; // number of zero upper bits
            } else {
                temp >>= b; // shift away lower half
            }
        }
        if (dropZeroNibble && temp < 16) shift += 4;
        uint256 nibbles = 64 - (shift >> 2);
        hexString = new string(nibbles);
        uint256 dst;
        assembly {
            mstore(0, shl(shift, value)) // left-align
            dst := add(hexString, 32)
        }
        unsafeHex(0, dst, nibbles);
    }

    /// @dev Format `bytes` as a hex string.
    /// @param v The bytes to format.
    /// @return hexString The corresponding hex string w/o a 0x-prefix.
    function bytesToHex(
        bytes memory v
    ) internal pure returns (string memory hexString) {
        uint256 nibbles = v.length << 1;
        hexString = new string(nibbles);
        uint256 src;
        uint256 dst;
        assembly {
            src := add(v, 32)
            dst := add(hexString, 32)
        }
        unsafeHex(src, dst, nibbles);
    }

    /// @dev Converts arbitrary memory to a hex string.
    /// @param src The memory offset of first nibble of input.
    /// @param dst The memory offset of first hex-char of output (can alias `src`).
    /// @param nibbles The number of nibbles to convert and the byte-length of the output.
    function unsafeHex(
        uint256 src,
        uint256 dst,
        uint256 nibbles
    ) internal pure {
        unchecked {
            for (uint256 end = dst + nibbles; dst < end; src += 32) {
                uint256 word;
                assembly {
                    word := mload(src)
                }
                for (uint256 shift = 256; dst < end && shift > 0; dst++) {
                    uint256 b = (word >> (shift -= 4)) & 15; // each nibble
                    b = b < 10 ? b + 0x30 : b + 0x57; // ("a" - 10) => 0x57
                    assembly {
                        mstore8(dst, b)
                    }
                }
            }
        }
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {HexUtils} from "../utils/HexUtils.sol";

/// @dev Library for encoding/decoding names.
///
/// An ENS name is stop-separated labels, eg. "aaa.bb.c".
///
/// A DNS-encoded name is composed of byte length-prefixed labels with a terminator byte.
/// eg. "\x03aaa\x02bb\x01c\x00".
/// - maximum label length is 255 bytes.
/// - length = 0 is reserved for the terminator (root).
///
/// To encode a label larger than 255 bytes, use a hashed label.
/// A label of any length can be converted to a hashed label.
///
/// A hashed label is encoded as "[" + toHex(keccak256(label)) + "]".
/// eg. [af2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc] = "vitalik".
/// - always 66 bytes.
/// - matches: `/^\[[0-9a-f]{64}\]$/`.
///
/// w/o hashed labels: `dns.length == 2 + ens.length` and the mapping is injective.
///  w/ hashed labels: `dns.length == 2 + ens.split('.').map(x => x.utf8Length).sum(n => n > 255 ? 66 : n)`.
library NameCoder {
    /// @dev The DNS-encoded name is malformed.
    error DNSDecodingFailed(bytes dns);

    /// @dev A label of the ENS name has an invalid size.
    error DNSEncodingFailed(string ens);

    /// @dev Same as `BytesUtils.readLabel()` but supports hashed labels.
    ///      Only the last labelHash is zero.
    ///      Disallows hashed label of zero (eg. `[0..0]`) to prevent confusion with terminator.
    ///      Reverts `DNSDecodingFailed`.
    /// @param name The DNS-encoded name.
    /// @param idx The offset into `name` to start reading.
    /// @return labelHash The resulting labelhash.
    /// @return newIdx The offset into `name` of the next label.
    function readLabel(
        bytes memory name,
        uint256 idx
    ) internal pure returns (bytes32 labelHash, uint256 newIdx) {
        if (idx >= name.length) revert DNSDecodingFailed(name); // "readLabel: expected length"
        uint256 len = uint256(uint8(name[idx++]));
        newIdx = idx + len;
        if (newIdx > name.length) revert DNSDecodingFailed(name); // "readLabel: expected label"
        if (len == 66 && name[idx] == "[" && name[newIdx - 1] == "]") {
            bool valid;
            (labelHash, valid) = HexUtils.hexStringToBytes32(
                name,
                idx + 1,
                newIdx - 1
            ); // will not revert
            if (!valid || labelHash == bytes32(0)) {
                revert DNSDecodingFailed(name); // "readLabel: malformed" or null literal
            }
        } else if (len > 0) {
            assembly {
                labelHash := keccak256(add(add(name, idx), 32), len)
            }
        }
    }

    /// @dev Same as `BytesUtils.namehash()` but supports hashed labels.
    ///      Reverts `DNSDecodingFailed`.
    /// @param name The DNS-encoded name.
    /// @param idx The offset into name start hashing.
    /// @return hash The resulting namehash.
    function namehash(
        bytes memory name,
        uint256 idx
    ) internal pure returns (bytes32 hash) {
        (hash, idx) = readLabel(name, idx);
        if (hash == bytes32(0)) {
            if (idx != name.length) revert DNSDecodingFailed(name); // "namehash: Junk at end of name"
        } else {
            bytes32 parent = namehash(name, idx);
            assembly {
                mstore(0, parent)
                mstore(32, hash)
                hash := keccak256(0, 64)
            }
        }
    }

    /// @dev Convert DNS-encoded name to ENS name.
    ///      Reverts `DNSDecodingFailed`.
    /// @param dns The DNS-encoded name to convert, eg. `\x03aaa\x02bb\x01c\x00`.
    /// @return ens The equivalent ENS name, eg. `aaa.bb.c`.
    function decode(
        bytes memory dns
    ) internal pure returns (string memory ens) {
        unchecked {
            uint256 n = dns.length;
            if (n == 1 && dns[0] == 0) return ""; // only valid answer is root
            if (n < 3) revert DNSDecodingFailed(dns);
            bytes memory v = new bytes(n - 2); // always 2-shorter
            uint256 src;
            uint256 dst;
            while (src < n) {
                uint8 len = uint8(dns[src++]);
                if (len == 0) break;
                uint256 end = src + len;
                if (end > dns.length) revert DNSDecodingFailed(dns); // overflow
                if (dst > 0) v[dst++] = "."; // skip first stop
                while (src < end) {
                    bytes1 x = dns[src++]; // read byte
                    if (x == ".") revert DNSDecodingFailed(dns); // malicious label
                    v[dst++] = x; // write byte
                }
            }
            if (src != dns.length) revert DNSDecodingFailed(dns); // junk at end
            return string(v);
        }
    }

    /// @dev Convert ENS name to DNS-encoded name.
    ///      Hashes labels longer than 255 bytes.
    ///      Reverts `DNSEncodingFailed`.
    /// @param ens The ENS name to convert, eg. `aaa.bb.c`.
    /// @return dns The corresponding DNS-encoded name, eg. `\x03aaa\x02bb\x01c\x00`.
    function encode(
        string memory ens
    ) internal pure returns (bytes memory dns) {
        unchecked {
            uint256 n = bytes(ens).length;
            if (n == 0) return hex"00"; // root
            dns = new bytes(n + 2);
            uint256 start;
            assembly {
                start := add(dns, 32) // first byte of output
            }
            uint256 end = start; // remember position to write length
            for (uint256 i; i < n; i++) {
                bytes1 x = bytes(ens)[i]; // read byte
                if (x == ".") {
                    start = _createHashedLabel(start, end);
                    if (start == 0) revert DNSEncodingFailed(ens);
                    end = start; // jump to next position
                } else {
                    assembly {
                        end := add(end, 1) // increase length
                        mstore(end, x) // write byte
                    }
                }
            }
            start = _createHashedLabel(start, end);
            if (start == 0) revert DNSEncodingFailed(ens);
            assembly {
                mstore8(start, 0) // terminal byte
                mstore(dns, sub(start, add(dns, 31))) // truncate length
            }
        }
    }

    /// @dev Write the label length.
    ///      If longer than 255, writes a hashed label instead.
    /// @param start The memory offset of the length-prefixed label.
    /// @param end The memory offset at the end of the label.
    /// @return next The memory offset for the next label.
    ///              Returns 0 if label is empty (handled by caller).
    function _createHashedLabel(
        uint256 start,
        uint256 end
    ) internal pure returns (uint256 next) {
        uint256 size = end - start; // length of label
        if (size > 255) {
            assembly {
                mstore(0, keccak256(add(start, 1), size)) // compute hash of label
            }
            HexUtils.unsafeHex(0, start + 2, 64); // override label with hex(hash)
            assembly {
                mstore8(add(start, 1), 0x5B) // "["
                mstore8(add(start, 66), 0x5D) // "]"
            }
            size = 66;
        }
        if (size > 0) {
            assembly {
                mstore8(start, size) // update length
            }
            next = start + 1 + size; // advance
        }
    }
}

File 39 of 41 : IMetadataService.sol
//SPDX-License-Identifier: MIT
pragma solidity ~0.8.17;

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

//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 41 of 41 : 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;
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"contract ENS","name":"_ens","type":"address"},{"internalType":"contract INameWrapper","name":"wrapperAddress","type":"address"},{"internalType":"address","name":"_trustedETHController","type":"address"},{"internalType":"address","name":"_trustedReverseRegistrar","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes","name":"addressBytes","type":"bytes"}],"name":"InvalidEVMAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"contentType","type":"uint256"}],"name":"ABIChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"address","name":"a","type":"address"}],"name":"AddrChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"coinType","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"newAddress","type":"bytes"}],"name":"AddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":true,"internalType":"bool","name":"approved","type":"bool"}],"name":"Approved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"hash","type":"bytes"}],"name":"ContenthashChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"name","type":"bytes"},{"indexed":false,"internalType":"uint16","name":"resource","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"record","type":"bytes"}],"name":"DNSRecordChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"name","type":"bytes"},{"indexed":false,"internalType":"uint16","name":"resource","type":"uint16"}],"name":"DNSRecordDeleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"lastzonehash","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"zonehash","type":"bytes"}],"name":"DNSZonehashChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":true,"internalType":"bytes4","name":"interfaceID","type":"bytes4"},{"indexed":false,"internalType":"address","name":"implementer","type":"address"}],"name":"InterfaceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"string","name":"name","type":"string"}],"name":"NameChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"x","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"y","type":"bytes32"}],"name":"PubkeyChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":true,"internalType":"string","name":"indexedKey","type":"string"},{"indexed":false,"internalType":"string","name":"key","type":"string"},{"indexed":false,"internalType":"string","name":"value","type":"string"}],"name":"TextChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"newVersion","type":"uint64"}],"name":"VersionChanged","type":"event"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint256","name":"contentTypes","type":"uint256"}],"name":"ABI","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"addr","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint256","name":"coinType","type":"uint256"}],"name":"addr","outputs":[{"internalType":"bytes","name":"addressBytes","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"clearRecords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"contenthash","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes32","name":"name","type":"bytes32"},{"internalType":"uint16","name":"resource","type":"uint16"}],"name":"dnsRecord","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint256","name":"coinType","type":"uint256"}],"name":"hasAddr","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes32","name":"name","type":"bytes32"}],"name":"hasDNSRecords","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes4","name":"interfaceID","type":"bytes4"}],"name":"interfaceImplementer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"delegate","type":"address"}],"name":"isApprovedFor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"nodehash","type":"bytes32"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicallWithNodeCheck","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"pubkey","outputs":[{"internalType":"bytes32","name":"x","type":"bytes32"},{"internalType":"bytes32","name":"y","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"recordVersions","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint256","name":"contentType","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"setABI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint256","name":"coinType","type":"uint256"},{"internalType":"bytes","name":"addressBytes","type":"bytes"}],"name":"setAddr","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"_addr","type":"address"}],"name":"setAddr","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":"node","type":"bytes32"},{"internalType":"bytes","name":"hash","type":"bytes"}],"name":"setContenthash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"setDNSRecords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes4","name":"interfaceID","type":"bytes4"},{"internalType":"address","name":"implementer","type":"address"}],"name":"setInterface","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"string","name":"newName","type":"string"}],"name":"setName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes32","name":"x","type":"bytes32"},{"internalType":"bytes32","name":"y","type":"bytes32"}],"name":"setPubkey","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"string","name":"key","type":"string"},{"internalType":"string","name":"value","type":"string"}],"name":"setText","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes","name":"hash","type":"bytes"}],"name":"setZonehash","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":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"string","name":"key","type":"string"}],"name":"text","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"zonehash","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"}]

61010060405234801561001157600080fd5b50604051613af9380380613af98339810160408190526100309161016d565b6040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152849033906000906001600160a01b038416906302571be390602401602060405180830381865afa15801561009b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100bf91906101cc565b604051630f41a04d60e11b81526001600160a01b03848116600483015291925090821690631e83409a906024016020604051808303816000875af115801561010b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061012f91906101f0565b5050506001600160a01b039485166080525091831660a052821660c0521660e052610209565b6001600160a01b038116811461016a57600080fd5b50565b6000806000806080858703121561018357600080fd5b845161018e81610155565b602086015190945061019f81610155565b60408601519093506101b081610155565b60608601519092506101c181610155565b939692955090935050565b6000602082840312156101de57600080fd5b81516101e981610155565b9392505050565b60006020828403121561020257600080fd5b5051919050565b60805160a05160c05160e0516138b06102496000396000611bb101526000611b72015260008181611c960152611d1601526000611c1201526138b06000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c8063773722131161010f578063c8690233116100a2578063e32954eb11610071578063e32954eb1461053c578063e59d895d1461054f578063e985e9c514610562578063f1cb7e06146105ab57600080fd5b8063c86902331461047a578063ce3decdc146104d3578063d5fa2b00146104e6578063d700ff33146104f957600080fd5b8063a8fa5682116100de578063a8fa5682146103e3578063a9784b3e146103f6578063ac9650d814610447578063bc1c58d11461046757600080fd5b806377372213146103975780638b95dd71146103aa578063a22cb465146103bd578063a4b91a01146103d057600080fd5b806332f111d71161018757806359d1d43c1161015657806359d1d43c1461033e5780635c98042b1461035e578063623195b014610371578063691f34311461038457600080fd5b806332f111d7146102b95780633603d758146102cc5780633b3b57de146102df5780634cbf6ba4146102f257600080fd5b8063124a319c116101c3578063124a319c1461023a5780632203ab561461027257806329cd62ea14610293578063304e6ade146102a657600080fd5b806301ffc9a7146101ea5780630af179d71461021257806310f13a8c14610227575b600080fd5b6101fd6101f8366004612b16565b6105be565b60405190151581526020015b60405180910390f35b610225610220366004612b73565b6105cf565b005b610225610235366004612bbf565b6107d9565b61024d610248366004612c3e565b6108a6565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610209565b610285610280366004612c6a565b610c3d565b604051610209929190612cfa565b6102256102a1366004612d13565b610d82565b6102256102b4366004612b73565b610e1d565b6101fd6102c7366004612c6a565b610e99565b6102256102da366004612d3f565b610ee5565b61024d6102ed366004612d3f565b610f88565b6101fd610300366004612c6a565b6000828152602081815260408083205467ffffffffffffffff1683526006825280832094835293815283822092825291909152205461ffff16151590565b61035161034c366004612b73565b610fa7565b6040516102099190612d58565b61035161036c366004612d3f565b611087565b61022561037f366004612d6b565b611146565b610351610392366004612d3f565b6111e3565b6102256103a5366004612b73565b61121d565b6102256103b8366004612ded565b611299565b6102256103cb366004612f28565b6113d8565b6102256103de366004612f54565b611514565b6103516103f1366004612f92565b611633565b6101fd610404366004612fd2565b73ffffffffffffffffffffffffffffffffffffffff9283166000908152600c60209081526040808320948352938152838220929094168152925290205460ff1690565b61045a61045536600461304e565b611681565b6040516102099190613090565b610351610475366004612d3f565b611696565b6104be610488366004612d3f565b6000818152602081815260408083205467ffffffffffffffff168352600982528083209383529290522080546001909101549091565b60408051928352602083019190915201610209565b6102256104e1366004612b73565b6116d0565b6102256104f4366004613113565b611813565b610523610507366004612d3f565b60006020819052908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610209565b61045a61054a366004613143565b61187a565b61022561055d366004613182565b61188f565b6101fd6105703660046131b7565b73ffffffffffffffffffffffffffffffffffffffff9182166000908152600b6020908152604080832093909416825291909152205460ff1690565b6103516105b9366004612c6a565b611973565b60006105c982611b02565b92915050565b826105d981611b58565b6105e257600080fd5b600084815260208181526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff9091169183916106489183918d908d90819084018382808284376000920191909152509293925050611e349050565b90505b80515160208201511015610772578661ffff166000036106b0578060400151965061067581611e95565b94508460405160200161068891906131e5565b6040516020818303038152906040528051906020012092506106a981611eb6565b9350610764565b60006106bb82611e95565b9050816040015161ffff168861ffff161415806106df57506106dd8682611ed2565b155b156107625761073b8c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d9150610732908290613230565b8b51158a611ef0565b81604001519750816020015196508095508580519060200120935061075f82611eb6565b94505b505b61076d8161215d565b61064b565b508351156107cd576107cd8a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92506107c491508290508f613230565b89511588611ef0565b50505050505050505050565b846107e381611b58565b6107ec57600080fd5b6000868152602081815260408083205467ffffffffffffffff168352600a82528083208984529091529081902090518491849161082c9089908990613243565b908152602001604051809103902091826108479291906132ed565b508484604051610858929190613243565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516108969493929190613450565b60405180910390a3505050505050565b6000828152602081815260408083205467ffffffffffffffff1683526007825280832085845282528083207fffffffff000000000000000000000000000000000000000000000000000000008516845290915281205473ffffffffffffffffffffffffffffffffffffffff16801561091f5790506105c9565b600061092a85610f88565b905073ffffffffffffffffffffffffffffffffffffffff8116610952576000925050506105c9565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000006024820152600090819073ffffffffffffffffffffffffffffffffffffffff841690604401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a70000000000000000000000000000000000000000000000000000000017905251610a1c91906131e5565b600060405180830381855afa9150503d8060008114610a57576040519150601f19603f3d011682016040523d82523d6000602084013e610a5c565b606091505b5091509150811580610a6f575060208151105b80610ab1575080601f81518110610a8857610a88613482565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610ac35760009450505050506105c9565b6040517fffffffff000000000000000000000000000000000000000000000000000000008716602482015273ffffffffffffffffffffffffffffffffffffffff841690604401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a70000000000000000000000000000000000000000000000000000000017905251610b8a91906131e5565b600060405180830381855afa9150503d8060008114610bc5576040519150601f19603f3d011682016040523d82523d6000602084013e610bca565b606091505b509092509050811580610bde575060208151105b80610c20575080601f81518110610bf757610bf7613482565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610c325760009450505050506105c9565b509095945050505050565b6000828152602081815260408083205467ffffffffffffffff168352600180835281842086855290925282206060915b600081118015610c7d5750848111155b15610d625780851615801590610cab575060008181526020839052604081208054610ca790613253565b9050115b15610d5a5780826000838152602001908152602001600020808054610ccf90613253565b80601f0160208091040260200160405190810160405280929190818152602001828054610cfb90613253565b8015610d485780601f10610d1d57610100808354040283529160200191610d48565b820191906000526020600020905b815481529060010190602001808311610d2b57829003601f168201915b50505050509050935093505050610d7b565b60011b610c6d565b5060006040518060200160405280600081525092509250505b9250929050565b82610d8c81611b58565b610d9557600080fd5b604080518082018252848152602080820185815260008881528083528481205467ffffffffffffffff1681526009835284812089825283528490209251835551600190920191909155815185815290810184905285917f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4691015b60405180910390a250505050565b82610e2781611b58565b610e3057600080fd5b6000848152602081815260408083205467ffffffffffffffff168352600382528083208784529091529020610e668385836132ed565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610e0f9291906134b1565b6000828152602081815260408083205467ffffffffffffffff16835260028252808320858452825280832084845290915281208054829190610eda90613253565b905011905092915050565b80610eef81611b58565b610ef857600080fd5b6000828152602081905260408120805467ffffffffffffffff1691610f1c836134c5565b82546101009290920a67ffffffffffffffff818102199093169183160217909155600084815260208181526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b6000610f9582603c611973565b610f9e906134f2565b60601c92915050565b6000838152602081815260408083205467ffffffffffffffff168352600a825280832086845290915290819020905160609190610fe79085908590613243565b9081526020016040518091039020805461100090613253565b80601f016020809104026020016040519081016040528092919081815260200182805461102c90613253565b80156110795780601f1061104e57610100808354040283529160200191611079565b820191906000526020600020905b81548152906001019060200180831161105c57829003601f168201915b505050505090509392505050565b6000818152602081815260408083205467ffffffffffffffff1683526004825280832084845290915290208054606091906110c190613253565b80601f01602080910402602001604051908101604052809291908181526020018280546110ed90613253565b801561113a5780601f1061110f5761010080835404028352916020019161113a565b820191906000526020600020905b81548152906001019060200180831161111d57829003601f168201915b50505050509050919050565b8361115081611b58565b61115957600080fd5b83611165600182613230565b161561117057600080fd5b6000858152602081815260408083205467ffffffffffffffff16835260018252808320888452825280832087845290915290206111ae8385836132ed565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b6000818152602081815260408083205467ffffffffffffffff1683526008825280832084845290915290208054606091906110c190613253565b8261122781611b58565b61123057600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526008825280832087845290915290206112668385836132ed565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610e0f9291906134b1565b826112a381611b58565b6112ac57600080fd5b8151158015906112be57508151601414155b80156112ce57506112ce83612245565b1561131057816040517f8d666f600000000000000000000000000000000000000000000000000000000081526004016113079190612d58565b60405180910390fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af7528484604051611342929190612cfa565b60405180910390a2603c830361139457837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd261137d846134f2565b60405160609190911c815260200160405180910390a25b6000848152602081815260408083205467ffffffffffffffff16835260028252808320878452825280832086845290915290206113d1838261355e565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff8216330361147d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c6600000000000000000000000000000000000000000000006064820152608401611307565b336000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82163303611593576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f53657474696e672064656c65676174652073746174757320666f722073656c666044820152606401611307565b336000818152600c60209081526040808320878452825280832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519384529286917ff0ddb3b04746704017f9aa8bd728fcc2c1d11675041205350018915f5e4750a0910160405180910390a4505050565b6000838152602081815260408083205467ffffffffffffffff168352600582528083208684528252808320858452825280832061ffff85168452909152902080546060919061100090613253565b606061168f6000848461226c565b9392505050565b6000818152602081815260408083205467ffffffffffffffff1683526003825280832084845290915290208054606091906110c190613253565b826116da81611b58565b6116e357600080fd5b6000848152602081815260408083205467ffffffffffffffff16808452600483528184208885529092528220805491929161171d90613253565b80601f016020809104026020016040519081016040528092919081815260200182805461174990613253565b80156117965780601f1061176b57610100808354040283529160200191611796565b820191906000526020600020905b81548152906001019060200180831161177957829003601f168201915b5050505067ffffffffffffffff841660009081526004602090815260408083208b845290915290209192506117ce90508587836132ed565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f8582878760405161180393929190613677565b60405180910390a2505050505050565b8161181d81611b58565b61182657600080fd5b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606084901b166020820152611875908490603c90603401604051602081830303815290604052611299565b505050565b606061188784848461226c565b949350505050565b8261189981611b58565b6118a257600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526007825280832087845282528083207fffffffff0000000000000000000000000000000000000000000000000000000087168085529083529281902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b6000828152602081815260408083205467ffffffffffffffff16835260028252808320858452825280832084845291829052909120805460609291906119b890613253565b80601f01602080910402602001604051908101604052809291908181526020018280546119e490613253565b8015611a315780601f10611a0657610100808354040283529160200191611a31565b820191906000526020600020905b815481529060010190602001808311611a1457829003601f168201915b5050505050915081516000148015611a5757506000611a4f84612454565b63ffffffff16115b15611afb57638000000060009081526020829052604090208054611a7a90613253565b80601f0160208091040260200160405190810160405280929190818152602001828054611aa690613253565b8015611af35780601f10611ac857610100808354040283529160200191611af3565b820191906000526020600020905b815481529060010190602001808311611ad657829003601f168201915b505050505091505b5092915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f59d1d43c0000000000000000000000000000000000000000000000000000000014806105c957506105c982612480565b60003373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161480611bd357503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016145b15611be057506001919050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018390526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906302571be390602401602060405180830381865afa158015611c6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c9291906136a7565b90507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611d99576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690636352211e90602401602060405180830381865afa158015611d72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d9691906136a7565b90505b73ffffffffffffffffffffffffffffffffffffffff8116331480611ded575073ffffffffffffffffffffffffffffffffffffffff81166000908152600b6020908152604080832033845290915290205460ff165b8061168f575073ffffffffffffffffffffffffffffffffffffffff81166000908152600c60209081526040808320868452825280832033845290915290205460ff1661168f565b611e826040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526105c98161215d565b602081015181516060916105c991611ead90826124d6565b84519190612530565b60a081015160c08201516060916105c991611ead908290613230565b60008151835114801561168f575061168f83600084600087516125a7565b865160208801206000611f04878787612530565b9050831561202e5767ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611f4f90613253565b159050611fae5767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611f92836136c4565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091528120611fef91612a8f565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a604051612021929190613700565b60405180910390a26107cd565b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020805461207190613253565b90506000036120d25767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff16916120b683613726565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020612114828261355e565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a846040516121499392919061373e565b60405180910390a250505050505050505050565b60c081015160208201819052815151116121745750565b6000612188826000015183602001516124d6565b8260200151612197919061376d565b82519091506121a690826125ca565b61ffff1660408301526121ba60028261376d565b82519091506121c990826125ca565b61ffff1660608301526121dd60028261376d565b82519091506121ec90826125f2565b63ffffffff16608083015261220260048261376d565b825190915060009061221490836125ca565b61ffff16905061222560028361376d565b60a084018190529150612238818361376d565b60c0909301929092525050565b600063800000008214806105c95750600061225f83612454565b63ffffffff161192915050565b60608167ffffffffffffffff81111561228757612287612dbe565b6040519080825280602002602001820160405280156122ba57816020015b60608152602001906001900390816122a55790505b50905060005b8281101561244c57841561239f5760008484838181106122e2576122e2613482565b90506020028101906122f49190613780565b612303916024916004916137e5565b61230c9161380f565b905085811461239d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603460248201527f6d756c746963616c6c3a20416c6c207265636f726473206d757374206861766560448201527f2061206d61746368696e67206e616d65686173680000000000000000000000006064820152608401611307565b505b600080308686858181106123b5576123b5613482565b90506020028101906123c79190613780565b6040516123d5929190613243565b600060405180830381855af49150503d8060008114612410576040519150601f19603f3d011682016040523d82523d6000602084013e612415565b606091505b50915091508161242457600080fd5b8084848151811061243757612437613482565b602090810291909101015250506001016122c0565b509392505050565b6000603c820361246657506001919050565b638000000091821891821061247c5760006105c9565b5090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fc86902330000000000000000000000000000000000000000000000000000000014806105c957506105c98261261c565b6000815b835181106124ea576124ea61384b565b60006124f68583612672565b60ff16905061250681600161376d565b612510908361376d565b9150806000036125205750612526565b506124da565b6118878382613230565b825160609061253f838561376d565b111561254a57600080fd5b60008267ffffffffffffffff81111561256557612565612dbe565b6040519080825280601f01601f19166020018201604052801561258f576020820181803683370190505b50905060208082019086860101610c32828287612696565b60006125b484848461270a565b6125bf87878561270a565b149695505050505050565b81516000906125da83600261376d565b11156125e557600080fd5b50016002015161ffff1690565b815160009061260283600461376d565b111561260d57600080fd5b50016004015163ffffffff1690565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f691f34310000000000000000000000000000000000000000000000000000000014806105c957506105c98261272e565b600082828151811061268657612686613482565b016020015160f81c905092915050565b602081106126ce57815183526126ad60208461376d565b92506126ba60208361376d565b91506126c7602082613230565b9050612696565b905182516020929092036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199091169116179052565b8251600090612719838561376d565b111561272457600080fd5b5091016020012090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f124a319c0000000000000000000000000000000000000000000000000000000014806105c957506105c98260007fffffffff0000000000000000000000000000000000000000000000000000000082167fa8fa568200000000000000000000000000000000000000000000000000000000148061281257507fffffffff0000000000000000000000000000000000000000000000000000000082167f5c98042b00000000000000000000000000000000000000000000000000000000145b806105c957506105c98260007fffffffff0000000000000000000000000000000000000000000000000000000082167fbc1c58d10000000000000000000000000000000000000000000000000000000014806105c957506105c98260007f3b3b57de000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316148061290057507ff1cb7e06000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b8061294c57507f32f111d7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b806105c957506105c98260007fffffffff0000000000000000000000000000000000000000000000000000000082167f2203ab560000000000000000000000000000000000000000000000000000000014806105c957506105c98260007fffffffff0000000000000000000000000000000000000000000000000000000082167fd700ff330000000000000000000000000000000000000000000000000000000014806105c957506105c98260007fffffffff0000000000000000000000000000000000000000000000000000000082167f4fbf04330000000000000000000000000000000000000000000000000000000014806105c957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146105c9565b508054612a9b90613253565b6000825580601f10612aab575050565b601f016020900490600052602060002090810190612ac99190612acc565b50565b5b8082111561247c5760008155600101612acd565b80357fffffffff0000000000000000000000000000000000000000000000000000000081168114612b1157600080fd5b919050565b600060208284031215612b2857600080fd5b61168f82612ae1565b60008083601f840112612b4357600080fd5b50813567ffffffffffffffff811115612b5b57600080fd5b602083019150836020828501011115610d7b57600080fd5b600080600060408486031215612b8857600080fd5b83359250602084013567ffffffffffffffff811115612ba657600080fd5b612bb286828701612b31565b9497909650939450505050565b600080600080600060608688031215612bd757600080fd5b85359450602086013567ffffffffffffffff811115612bf557600080fd5b612c0188828901612b31565b909550935050604086013567ffffffffffffffff811115612c2157600080fd5b612c2d88828901612b31565b969995985093965092949392505050565b60008060408385031215612c5157600080fd5b82359150612c6160208401612ae1565b90509250929050565b60008060408385031215612c7d57600080fd5b50508035926020909101359150565b60005b83811015612ca7578181015183820152602001612c8f565b50506000910152565b60008151808452612cc8816020860160208601612c8c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b8281526040602082015260006118876040830184612cb0565b600080600060608486031215612d2857600080fd5b505081359360208301359350604090920135919050565b600060208284031215612d5157600080fd5b5035919050565b60208152600061168f6020830184612cb0565b60008060008060608587031215612d8157600080fd5b8435935060208501359250604085013567ffffffffffffffff811115612da657600080fd5b612db287828801612b31565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080600060608486031215612e0257600080fd5b8335925060208401359150604084013567ffffffffffffffff811115612e2757600080fd5b8401601f81018613612e3857600080fd5b803567ffffffffffffffff811115612e5257612e52612dbe565b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160116810181811067ffffffffffffffff82111715612ebe57612ebe612dbe565b604052818152828201602001881015612ed657600080fd5b816020840160208301376000602083830101528093505050509250925092565b73ffffffffffffffffffffffffffffffffffffffff81168114612ac957600080fd5b80358015158114612b1157600080fd5b60008060408385031215612f3b57600080fd5b8235612f4681612ef6565b9150612c6160208401612f18565b600080600060608486031215612f6957600080fd5b833592506020840135612f7b81612ef6565b9150612f8960408501612f18565b90509250925092565b600080600060608486031215612fa757600080fd5b8335925060208401359150604084013561ffff81168114612fc757600080fd5b809150509250925092565b600080600060608486031215612fe757600080fd5b8335612ff281612ef6565b9250602084013591506040840135612fc781612ef6565b60008083601f84011261301b57600080fd5b50813567ffffffffffffffff81111561303357600080fd5b6020830191508360208260051b8501011115610d7b57600080fd5b6000806020838503121561306157600080fd5b823567ffffffffffffffff81111561307857600080fd5b61308485828601613009565b90969095509350505050565b6000602082016020835280845180835260408501915060408160051b86010192506020860160005b82811015613107577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08786030184526130f2858351612cb0565b945060209384019391909101906001016130b8565b50929695505050505050565b6000806040838503121561312657600080fd5b82359150602083013561313881612ef6565b809150509250929050565b60008060006040848603121561315857600080fd5b83359250602084013567ffffffffffffffff81111561317657600080fd5b612bb286828701613009565b60008060006060848603121561319757600080fd5b833592506131a760208501612ae1565b91506040840135612fc781612ef6565b600080604083850312156131ca57600080fd5b82356131d581612ef6565b9150602083013561313881612ef6565b600082516131f7818460208701612c8c565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818103818111156105c9576105c9613201565b8183823760009101908152919050565b600181811c9082168061326757607f821691505b6020821081036132a0577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b601f82111561187557806000526020600020601f840160051c810160208510156132cd5750805b601f840160051c820191505b818110156113d157600081556001016132d9565b67ffffffffffffffff83111561330557613305612dbe565b613319836133138354613253565b836132a6565b6000601f84116001811461336b57600085156133355750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b1783556113d1565b6000838152602090207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0861690835b828110156133ba578685013582556020948501946001909201910161339a565b50868210156133f5577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555050505050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b604081526000613464604083018688613407565b8281036020840152613477818587613407565b979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602081526000611887602083018486613407565b600067ffffffffffffffff821667ffffffffffffffff81036134e9576134e9613201565b60010192915050565b805160208201517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000811691906014821015613557577fffffffffffffffffffffffffffffffffffffffff000000000000000000000000808360140360031b1b82161692505b5050919050565b815167ffffffffffffffff81111561357857613578612dbe565b61358c816135868454613253565b846132a6565b6020601f8211600181146135de57600083156135a85750848201515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600385901b1c1916600184901b1784556113d1565b6000848152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08516915b8281101561362c578785015182556020948501946001909201910161360c565b508482101561366857868401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b60f8161c191681555b50505050600190811b01905550565b60408152600061368a6040830186612cb0565b828103602084015261369d818587613407565b9695505050505050565b6000602082840312156136b957600080fd5b815161168f81612ef6565b600061ffff8216806136d8576136d8613201565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0192915050565b6040815260006137136040830185612cb0565b905061ffff831660208301529392505050565b600061ffff821661ffff81036134e9576134e9613201565b6060815260006137516060830186612cb0565b61ffff85166020840152828103604084015261369d8185612cb0565b808201808211156105c9576105c9613201565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126137b557600080fd5b83018035915067ffffffffffffffff8211156137d057600080fd5b602001915036819003821315610d7b57600080fd5b600080858511156137f557600080fd5b8386111561380257600080fd5b5050820193919092039150565b803560208310156105c9577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff602084900360031b1b1692915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fdfea264697066735822122075a7658084d4def9f6cce391e839ba4adcd596c5ae93e2d00f29a82163695c2f64736f6c634300081a003300000000000000000000000000000000000c2e074ec69a0dfb2997ba6c7d2e1e000000000000000000000000d4416b13d2b3a9abae7acd5d6c2bbdbe2568640100000000000000000000000059e16fccd424cc24e280be16e11bcd56fb0ce547000000000000000000000000a58e81fe9b61b5c3fe2afd33cf304c454abfc7cb

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101e55760003560e01c8063773722131161010f578063c8690233116100a2578063e32954eb11610071578063e32954eb1461053c578063e59d895d1461054f578063e985e9c514610562578063f1cb7e06146105ab57600080fd5b8063c86902331461047a578063ce3decdc146104d3578063d5fa2b00146104e6578063d700ff33146104f957600080fd5b8063a8fa5682116100de578063a8fa5682146103e3578063a9784b3e146103f6578063ac9650d814610447578063bc1c58d11461046757600080fd5b806377372213146103975780638b95dd71146103aa578063a22cb465146103bd578063a4b91a01146103d057600080fd5b806332f111d71161018757806359d1d43c1161015657806359d1d43c1461033e5780635c98042b1461035e578063623195b014610371578063691f34311461038457600080fd5b806332f111d7146102b95780633603d758146102cc5780633b3b57de146102df5780634cbf6ba4146102f257600080fd5b8063124a319c116101c3578063124a319c1461023a5780632203ab561461027257806329cd62ea14610293578063304e6ade146102a657600080fd5b806301ffc9a7146101ea5780630af179d71461021257806310f13a8c14610227575b600080fd5b6101fd6101f8366004612b16565b6105be565b60405190151581526020015b60405180910390f35b610225610220366004612b73565b6105cf565b005b610225610235366004612bbf565b6107d9565b61024d610248366004612c3e565b6108a6565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610209565b610285610280366004612c6a565b610c3d565b604051610209929190612cfa565b6102256102a1366004612d13565b610d82565b6102256102b4366004612b73565b610e1d565b6101fd6102c7366004612c6a565b610e99565b6102256102da366004612d3f565b610ee5565b61024d6102ed366004612d3f565b610f88565b6101fd610300366004612c6a565b6000828152602081815260408083205467ffffffffffffffff1683526006825280832094835293815283822092825291909152205461ffff16151590565b61035161034c366004612b73565b610fa7565b6040516102099190612d58565b61035161036c366004612d3f565b611087565b61022561037f366004612d6b565b611146565b610351610392366004612d3f565b6111e3565b6102256103a5366004612b73565b61121d565b6102256103b8366004612ded565b611299565b6102256103cb366004612f28565b6113d8565b6102256103de366004612f54565b611514565b6103516103f1366004612f92565b611633565b6101fd610404366004612fd2565b73ffffffffffffffffffffffffffffffffffffffff9283166000908152600c60209081526040808320948352938152838220929094168152925290205460ff1690565b61045a61045536600461304e565b611681565b6040516102099190613090565b610351610475366004612d3f565b611696565b6104be610488366004612d3f565b6000818152602081815260408083205467ffffffffffffffff168352600982528083209383529290522080546001909101549091565b60408051928352602083019190915201610209565b6102256104e1366004612b73565b6116d0565b6102256104f4366004613113565b611813565b610523610507366004612d3f565b60006020819052908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610209565b61045a61054a366004613143565b61187a565b61022561055d366004613182565b61188f565b6101fd6105703660046131b7565b73ffffffffffffffffffffffffffffffffffffffff9182166000908152600b6020908152604080832093909416825291909152205460ff1690565b6103516105b9366004612c6a565b611973565b60006105c982611b02565b92915050565b826105d981611b58565b6105e257600080fd5b600084815260208181526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff9091169183916106489183918d908d90819084018382808284376000920191909152509293925050611e349050565b90505b80515160208201511015610772578661ffff166000036106b0578060400151965061067581611e95565b94508460405160200161068891906131e5565b6040516020818303038152906040528051906020012092506106a981611eb6565b9350610764565b60006106bb82611e95565b9050816040015161ffff168861ffff161415806106df57506106dd8682611ed2565b155b156107625761073b8c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d9150610732908290613230565b8b51158a611ef0565b81604001519750816020015196508095508580519060200120935061075f82611eb6565b94505b505b61076d8161215d565b61064b565b508351156107cd576107cd8a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92506107c491508290508f613230565b89511588611ef0565b50505050505050505050565b846107e381611b58565b6107ec57600080fd5b6000868152602081815260408083205467ffffffffffffffff168352600a82528083208984529091529081902090518491849161082c9089908990613243565b908152602001604051809103902091826108479291906132ed565b508484604051610858929190613243565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516108969493929190613450565b60405180910390a3505050505050565b6000828152602081815260408083205467ffffffffffffffff1683526007825280832085845282528083207fffffffff000000000000000000000000000000000000000000000000000000008516845290915281205473ffffffffffffffffffffffffffffffffffffffff16801561091f5790506105c9565b600061092a85610f88565b905073ffffffffffffffffffffffffffffffffffffffff8116610952576000925050506105c9565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000006024820152600090819073ffffffffffffffffffffffffffffffffffffffff841690604401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a70000000000000000000000000000000000000000000000000000000017905251610a1c91906131e5565b600060405180830381855afa9150503d8060008114610a57576040519150601f19603f3d011682016040523d82523d6000602084013e610a5c565b606091505b5091509150811580610a6f575060208151105b80610ab1575080601f81518110610a8857610a88613482565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610ac35760009450505050506105c9565b6040517fffffffff000000000000000000000000000000000000000000000000000000008716602482015273ffffffffffffffffffffffffffffffffffffffff841690604401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a70000000000000000000000000000000000000000000000000000000017905251610b8a91906131e5565b600060405180830381855afa9150503d8060008114610bc5576040519150601f19603f3d011682016040523d82523d6000602084013e610bca565b606091505b509092509050811580610bde575060208151105b80610c20575080601f81518110610bf757610bf7613482565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610c325760009450505050506105c9565b509095945050505050565b6000828152602081815260408083205467ffffffffffffffff168352600180835281842086855290925282206060915b600081118015610c7d5750848111155b15610d625780851615801590610cab575060008181526020839052604081208054610ca790613253565b9050115b15610d5a5780826000838152602001908152602001600020808054610ccf90613253565b80601f0160208091040260200160405190810160405280929190818152602001828054610cfb90613253565b8015610d485780601f10610d1d57610100808354040283529160200191610d48565b820191906000526020600020905b815481529060010190602001808311610d2b57829003601f168201915b50505050509050935093505050610d7b565b60011b610c6d565b5060006040518060200160405280600081525092509250505b9250929050565b82610d8c81611b58565b610d9557600080fd5b604080518082018252848152602080820185815260008881528083528481205467ffffffffffffffff1681526009835284812089825283528490209251835551600190920191909155815185815290810184905285917f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4691015b60405180910390a250505050565b82610e2781611b58565b610e3057600080fd5b6000848152602081815260408083205467ffffffffffffffff168352600382528083208784529091529020610e668385836132ed565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610e0f9291906134b1565b6000828152602081815260408083205467ffffffffffffffff16835260028252808320858452825280832084845290915281208054829190610eda90613253565b905011905092915050565b80610eef81611b58565b610ef857600080fd5b6000828152602081905260408120805467ffffffffffffffff1691610f1c836134c5565b82546101009290920a67ffffffffffffffff818102199093169183160217909155600084815260208181526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b6000610f9582603c611973565b610f9e906134f2565b60601c92915050565b6000838152602081815260408083205467ffffffffffffffff168352600a825280832086845290915290819020905160609190610fe79085908590613243565b9081526020016040518091039020805461100090613253565b80601f016020809104026020016040519081016040528092919081815260200182805461102c90613253565b80156110795780601f1061104e57610100808354040283529160200191611079565b820191906000526020600020905b81548152906001019060200180831161105c57829003601f168201915b505050505090509392505050565b6000818152602081815260408083205467ffffffffffffffff1683526004825280832084845290915290208054606091906110c190613253565b80601f01602080910402602001604051908101604052809291908181526020018280546110ed90613253565b801561113a5780601f1061110f5761010080835404028352916020019161113a565b820191906000526020600020905b81548152906001019060200180831161111d57829003601f168201915b50505050509050919050565b8361115081611b58565b61115957600080fd5b83611165600182613230565b161561117057600080fd5b6000858152602081815260408083205467ffffffffffffffff16835260018252808320888452825280832087845290915290206111ae8385836132ed565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b6000818152602081815260408083205467ffffffffffffffff1683526008825280832084845290915290208054606091906110c190613253565b8261122781611b58565b61123057600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526008825280832087845290915290206112668385836132ed565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610e0f9291906134b1565b826112a381611b58565b6112ac57600080fd5b8151158015906112be57508151601414155b80156112ce57506112ce83612245565b1561131057816040517f8d666f600000000000000000000000000000000000000000000000000000000081526004016113079190612d58565b60405180910390fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af7528484604051611342929190612cfa565b60405180910390a2603c830361139457837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd261137d846134f2565b60405160609190911c815260200160405180910390a25b6000848152602081815260408083205467ffffffffffffffff16835260028252808320878452825280832086845290915290206113d1838261355e565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff8216330361147d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c6600000000000000000000000000000000000000000000006064820152608401611307565b336000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82163303611593576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f53657474696e672064656c65676174652073746174757320666f722073656c666044820152606401611307565b336000818152600c60209081526040808320878452825280832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519384529286917ff0ddb3b04746704017f9aa8bd728fcc2c1d11675041205350018915f5e4750a0910160405180910390a4505050565b6000838152602081815260408083205467ffffffffffffffff168352600582528083208684528252808320858452825280832061ffff85168452909152902080546060919061100090613253565b606061168f6000848461226c565b9392505050565b6000818152602081815260408083205467ffffffffffffffff1683526003825280832084845290915290208054606091906110c190613253565b826116da81611b58565b6116e357600080fd5b6000848152602081815260408083205467ffffffffffffffff16808452600483528184208885529092528220805491929161171d90613253565b80601f016020809104026020016040519081016040528092919081815260200182805461174990613253565b80156117965780601f1061176b57610100808354040283529160200191611796565b820191906000526020600020905b81548152906001019060200180831161177957829003601f168201915b5050505067ffffffffffffffff841660009081526004602090815260408083208b845290915290209192506117ce90508587836132ed565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f8582878760405161180393929190613677565b60405180910390a2505050505050565b8161181d81611b58565b61182657600080fd5b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606084901b166020820152611875908490603c90603401604051602081830303815290604052611299565b505050565b606061188784848461226c565b949350505050565b8261189981611b58565b6118a257600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526007825280832087845282528083207fffffffff0000000000000000000000000000000000000000000000000000000087168085529083529281902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b6000828152602081815260408083205467ffffffffffffffff16835260028252808320858452825280832084845291829052909120805460609291906119b890613253565b80601f01602080910402602001604051908101604052809291908181526020018280546119e490613253565b8015611a315780601f10611a0657610100808354040283529160200191611a31565b820191906000526020600020905b815481529060010190602001808311611a1457829003601f168201915b5050505050915081516000148015611a5757506000611a4f84612454565b63ffffffff16115b15611afb57638000000060009081526020829052604090208054611a7a90613253565b80601f0160208091040260200160405190810160405280929190818152602001828054611aa690613253565b8015611af35780601f10611ac857610100808354040283529160200191611af3565b820191906000526020600020905b815481529060010190602001808311611ad657829003601f168201915b505050505091505b5092915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f59d1d43c0000000000000000000000000000000000000000000000000000000014806105c957506105c982612480565b60003373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000059e16fccd424cc24e280be16e11bcd56fb0ce547161480611bd357503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000a58e81fe9b61b5c3fe2afd33cf304c454abfc7cb16145b15611be057506001919050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018390526000907f00000000000000000000000000000000000c2e074ec69a0dfb2997ba6c7d2e1e73ffffffffffffffffffffffffffffffffffffffff16906302571be390602401602060405180830381865afa158015611c6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c9291906136a7565b90507f000000000000000000000000d4416b13d2b3a9abae7acd5d6c2bbdbe2568640173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611d99576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490527f000000000000000000000000d4416b13d2b3a9abae7acd5d6c2bbdbe2568640173ffffffffffffffffffffffffffffffffffffffff1690636352211e90602401602060405180830381865afa158015611d72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d9691906136a7565b90505b73ffffffffffffffffffffffffffffffffffffffff8116331480611ded575073ffffffffffffffffffffffffffffffffffffffff81166000908152600b6020908152604080832033845290915290205460ff165b8061168f575073ffffffffffffffffffffffffffffffffffffffff81166000908152600c60209081526040808320868452825280832033845290915290205460ff1661168f565b611e826040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526105c98161215d565b602081015181516060916105c991611ead90826124d6565b84519190612530565b60a081015160c08201516060916105c991611ead908290613230565b60008151835114801561168f575061168f83600084600087516125a7565b865160208801206000611f04878787612530565b9050831561202e5767ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611f4f90613253565b159050611fae5767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611f92836136c4565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091528120611fef91612a8f565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a604051612021929190613700565b60405180910390a26107cd565b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020805461207190613253565b90506000036120d25767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff16916120b683613726565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020612114828261355e565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a846040516121499392919061373e565b60405180910390a250505050505050505050565b60c081015160208201819052815151116121745750565b6000612188826000015183602001516124d6565b8260200151612197919061376d565b82519091506121a690826125ca565b61ffff1660408301526121ba60028261376d565b82519091506121c990826125ca565b61ffff1660608301526121dd60028261376d565b82519091506121ec90826125f2565b63ffffffff16608083015261220260048261376d565b825190915060009061221490836125ca565b61ffff16905061222560028361376d565b60a084018190529150612238818361376d565b60c0909301929092525050565b600063800000008214806105c95750600061225f83612454565b63ffffffff161192915050565b60608167ffffffffffffffff81111561228757612287612dbe565b6040519080825280602002602001820160405280156122ba57816020015b60608152602001906001900390816122a55790505b50905060005b8281101561244c57841561239f5760008484838181106122e2576122e2613482565b90506020028101906122f49190613780565b612303916024916004916137e5565b61230c9161380f565b905085811461239d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603460248201527f6d756c746963616c6c3a20416c6c207265636f726473206d757374206861766560448201527f2061206d61746368696e67206e616d65686173680000000000000000000000006064820152608401611307565b505b600080308686858181106123b5576123b5613482565b90506020028101906123c79190613780565b6040516123d5929190613243565b600060405180830381855af49150503d8060008114612410576040519150601f19603f3d011682016040523d82523d6000602084013e612415565b606091505b50915091508161242457600080fd5b8084848151811061243757612437613482565b602090810291909101015250506001016122c0565b509392505050565b6000603c820361246657506001919050565b638000000091821891821061247c5760006105c9565b5090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fc86902330000000000000000000000000000000000000000000000000000000014806105c957506105c98261261c565b6000815b835181106124ea576124ea61384b565b60006124f68583612672565b60ff16905061250681600161376d565b612510908361376d565b9150806000036125205750612526565b506124da565b6118878382613230565b825160609061253f838561376d565b111561254a57600080fd5b60008267ffffffffffffffff81111561256557612565612dbe565b6040519080825280601f01601f19166020018201604052801561258f576020820181803683370190505b50905060208082019086860101610c32828287612696565b60006125b484848461270a565b6125bf87878561270a565b149695505050505050565b81516000906125da83600261376d565b11156125e557600080fd5b50016002015161ffff1690565b815160009061260283600461376d565b111561260d57600080fd5b50016004015163ffffffff1690565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f691f34310000000000000000000000000000000000000000000000000000000014806105c957506105c98261272e565b600082828151811061268657612686613482565b016020015160f81c905092915050565b602081106126ce57815183526126ad60208461376d565b92506126ba60208361376d565b91506126c7602082613230565b9050612696565b905182516020929092036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199091169116179052565b8251600090612719838561376d565b111561272457600080fd5b5091016020012090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f124a319c0000000000000000000000000000000000000000000000000000000014806105c957506105c98260007fffffffff0000000000000000000000000000000000000000000000000000000082167fa8fa568200000000000000000000000000000000000000000000000000000000148061281257507fffffffff0000000000000000000000000000000000000000000000000000000082167f5c98042b00000000000000000000000000000000000000000000000000000000145b806105c957506105c98260007fffffffff0000000000000000000000000000000000000000000000000000000082167fbc1c58d10000000000000000000000000000000000000000000000000000000014806105c957506105c98260007f3b3b57de000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316148061290057507ff1cb7e06000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b8061294c57507f32f111d7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b806105c957506105c98260007fffffffff0000000000000000000000000000000000000000000000000000000082167f2203ab560000000000000000000000000000000000000000000000000000000014806105c957506105c98260007fffffffff0000000000000000000000000000000000000000000000000000000082167fd700ff330000000000000000000000000000000000000000000000000000000014806105c957506105c98260007fffffffff0000000000000000000000000000000000000000000000000000000082167f4fbf04330000000000000000000000000000000000000000000000000000000014806105c957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146105c9565b508054612a9b90613253565b6000825580601f10612aab575050565b601f016020900490600052602060002090810190612ac99190612acc565b50565b5b8082111561247c5760008155600101612acd565b80357fffffffff0000000000000000000000000000000000000000000000000000000081168114612b1157600080fd5b919050565b600060208284031215612b2857600080fd5b61168f82612ae1565b60008083601f840112612b4357600080fd5b50813567ffffffffffffffff811115612b5b57600080fd5b602083019150836020828501011115610d7b57600080fd5b600080600060408486031215612b8857600080fd5b83359250602084013567ffffffffffffffff811115612ba657600080fd5b612bb286828701612b31565b9497909650939450505050565b600080600080600060608688031215612bd757600080fd5b85359450602086013567ffffffffffffffff811115612bf557600080fd5b612c0188828901612b31565b909550935050604086013567ffffffffffffffff811115612c2157600080fd5b612c2d88828901612b31565b969995985093965092949392505050565b60008060408385031215612c5157600080fd5b82359150612c6160208401612ae1565b90509250929050565b60008060408385031215612c7d57600080fd5b50508035926020909101359150565b60005b83811015612ca7578181015183820152602001612c8f565b50506000910152565b60008151808452612cc8816020860160208601612c8c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b8281526040602082015260006118876040830184612cb0565b600080600060608486031215612d2857600080fd5b505081359360208301359350604090920135919050565b600060208284031215612d5157600080fd5b5035919050565b60208152600061168f6020830184612cb0565b60008060008060608587031215612d8157600080fd5b8435935060208501359250604085013567ffffffffffffffff811115612da657600080fd5b612db287828801612b31565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080600060608486031215612e0257600080fd5b8335925060208401359150604084013567ffffffffffffffff811115612e2757600080fd5b8401601f81018613612e3857600080fd5b803567ffffffffffffffff811115612e5257612e52612dbe565b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160116810181811067ffffffffffffffff82111715612ebe57612ebe612dbe565b604052818152828201602001881015612ed657600080fd5b816020840160208301376000602083830101528093505050509250925092565b73ffffffffffffffffffffffffffffffffffffffff81168114612ac957600080fd5b80358015158114612b1157600080fd5b60008060408385031215612f3b57600080fd5b8235612f4681612ef6565b9150612c6160208401612f18565b600080600060608486031215612f6957600080fd5b833592506020840135612f7b81612ef6565b9150612f8960408501612f18565b90509250925092565b600080600060608486031215612fa757600080fd5b8335925060208401359150604084013561ffff81168114612fc757600080fd5b809150509250925092565b600080600060608486031215612fe757600080fd5b8335612ff281612ef6565b9250602084013591506040840135612fc781612ef6565b60008083601f84011261301b57600080fd5b50813567ffffffffffffffff81111561303357600080fd5b6020830191508360208260051b8501011115610d7b57600080fd5b6000806020838503121561306157600080fd5b823567ffffffffffffffff81111561307857600080fd5b61308485828601613009565b90969095509350505050565b6000602082016020835280845180835260408501915060408160051b86010192506020860160005b82811015613107577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08786030184526130f2858351612cb0565b945060209384019391909101906001016130b8565b50929695505050505050565b6000806040838503121561312657600080fd5b82359150602083013561313881612ef6565b809150509250929050565b60008060006040848603121561315857600080fd5b83359250602084013567ffffffffffffffff81111561317657600080fd5b612bb286828701613009565b60008060006060848603121561319757600080fd5b833592506131a760208501612ae1565b91506040840135612fc781612ef6565b600080604083850312156131ca57600080fd5b82356131d581612ef6565b9150602083013561313881612ef6565b600082516131f7818460208701612c8c565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818103818111156105c9576105c9613201565b8183823760009101908152919050565b600181811c9082168061326757607f821691505b6020821081036132a0577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b601f82111561187557806000526020600020601f840160051c810160208510156132cd5750805b601f840160051c820191505b818110156113d157600081556001016132d9565b67ffffffffffffffff83111561330557613305612dbe565b613319836133138354613253565b836132a6565b6000601f84116001811461336b57600085156133355750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b1783556113d1565b6000838152602090207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0861690835b828110156133ba578685013582556020948501946001909201910161339a565b50868210156133f5577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555050505050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b604081526000613464604083018688613407565b8281036020840152613477818587613407565b979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602081526000611887602083018486613407565b600067ffffffffffffffff821667ffffffffffffffff81036134e9576134e9613201565b60010192915050565b805160208201517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000811691906014821015613557577fffffffffffffffffffffffffffffffffffffffff000000000000000000000000808360140360031b1b82161692505b5050919050565b815167ffffffffffffffff81111561357857613578612dbe565b61358c816135868454613253565b846132a6565b6020601f8211600181146135de57600083156135a85750848201515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600385901b1c1916600184901b1784556113d1565b6000848152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08516915b8281101561362c578785015182556020948501946001909201910161360c565b508482101561366857868401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b60f8161c191681555b50505050600190811b01905550565b60408152600061368a6040830186612cb0565b828103602084015261369d818587613407565b9695505050505050565b6000602082840312156136b957600080fd5b815161168f81612ef6565b600061ffff8216806136d8576136d8613201565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0192915050565b6040815260006137136040830185612cb0565b905061ffff831660208301529392505050565b600061ffff821661ffff81036134e9576134e9613201565b6060815260006137516060830186612cb0565b61ffff85166020840152828103604084015261369d8185612cb0565b808201808211156105c9576105c9613201565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126137b557600080fd5b83018035915067ffffffffffffffff8211156137d057600080fd5b602001915036819003821315610d7b57600080fd5b600080858511156137f557600080fd5b8386111561380257600080fd5b5050820193919092039150565b803560208310156105c9577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff602084900360031b1b1692915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fdfea264697066735822122075a7658084d4def9f6cce391e839ba4adcd596c5ae93e2d00f29a82163695c2f64736f6c634300081a0033

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

00000000000000000000000000000000000c2e074ec69a0dfb2997ba6c7d2e1e000000000000000000000000d4416b13d2b3a9abae7acd5d6c2bbdbe2568640100000000000000000000000059e16fccd424cc24e280be16e11bcd56fb0ce547000000000000000000000000a58e81fe9b61b5c3fe2afd33cf304c454abfc7cb

-----Decoded View---------------
Arg [0] : _ens (address): 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e
Arg [1] : wrapperAddress (address): 0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401
Arg [2] : _trustedETHController (address): 0x59E16fcCd424Cc24e280Be16E11Bcd56fb0CE547
Arg [3] : _trustedReverseRegistrar (address): 0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000c2e074ec69a0dfb2997ba6c7d2e1e
Arg [1] : 000000000000000000000000d4416b13d2b3a9abae7acd5d6c2bbdbe25686401
Arg [2] : 00000000000000000000000059e16fccd424cc24e280be16e11bcd56fb0ce547
Arg [3] : 000000000000000000000000a58e81fe9b61b5c3fe2afd33cf304c454abfc7cb


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.