ETH Price: $3,070.48 (-2.71%)
 

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Token Holdings

More Info

Private Name Tags

TokenTracker

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Safe Transfer Fr...1437251022025-11-13 15:49:413 days ago1763048981IN
hns.id: Handshake SLD Token
0 ETH0.0000000290920.0001008
Safe Transfer Fr...1435480502025-11-09 13:27:577 days ago1762694877IN
hns.id: Handshake SLD Token
0 ETH0.000000009350.00010084
Safe Transfer Fr...1434882762025-11-08 4:15:298 days ago1762575329IN
hns.id: Handshake SLD Token
0 ETH0.0000000096970.00010059
Safe Transfer Fr...1434342372025-11-06 22:14:119 days ago1762467251IN
hns.id: Handshake SLD Token
0 ETH0.0000000116280.00010036
Safe Transfer Fr...1434225392025-11-06 15:44:1510 days ago1762443855IN
hns.id: Handshake SLD Token
0 ETH0.0000000589020.00000047
Set Royalty Payo...1433767292025-11-05 14:17:1511 days ago1762352235IN
hns.id: Handshake SLD Token
0 ETH0.0000000178830.00010044
Set Royalty Payo...1420302572025-10-05 10:14:5142 days ago1759659291IN
hns.id: Handshake SLD Token
0 ETH0.0000000081210.00010048
Set Royalty Payo...1412491812025-09-17 8:18:5960 days ago1758097139IN
hns.id: Handshake SLD Token
0 ETH0.0000000030630.00000594
Set Approval For...1402581512025-08-25 9:44:3983 days ago1756115079IN
hns.id: Handshake SLD Token
0 ETH0.0000000060520.00010095
Safe Transfer Fr...1400318512025-08-20 4:01:1988 days ago1755662479IN
hns.id: Handshake SLD Token
0 ETH0.000000011080.00010037
Transfer From1396549682025-08-11 10:38:3397 days ago1754908713IN
hns.id: Handshake SLD Token
0 ETH0.0000000122290.00010039
Safe Transfer Fr...1393465562025-08-04 7:18:09104 days ago1754291889IN
hns.id: Handshake SLD Token
0 ETH0.0000000104670.00010036
Safe Transfer Fr...1389726502025-07-26 15:34:37113 days ago1753544077IN
hns.id: Handshake SLD Token
0 ETH0.0000000042560.00000176
Safe Transfer Fr...1389721442025-07-26 15:17:45113 days ago1753543065IN
hns.id: Handshake SLD Token
0 ETH0.0000000036020.00000178
Safe Transfer Fr...1386187182025-07-18 10:56:53121 days ago1752836213IN
hns.id: Handshake SLD Token
0 ETH0.0000000441710.00010145
Set Approval For...1382067432025-07-08 22:04:23130 days ago1752012263IN
hns.id: Handshake SLD Token
0 ETH0.0000000529290.00100081
Set Approval For...1377196532025-06-27 15:28:03142 days ago1751038083IN
hns.id: Handshake SLD Token
0 ETH0.0000000325960.00011002
Safe Transfer Fr...1377154942025-06-27 13:09:25142 days ago1751029765IN
hns.id: Handshake SLD Token
0 ETH0.0000000231260.00011001
Set Approval For...1374030592025-06-20 7:34:55149 days ago1750404895IN
hns.id: Handshake SLD Token
0 ETH0.0000000542680.0010112
Set Approval For...1373703382025-06-19 13:24:13150 days ago1750339453IN
hns.id: Handshake SLD Token
0 ETH0.0000000198180.00010799
Set Approval For...1373261652025-06-18 12:51:47151 days ago1750251107IN
hns.id: Handshake SLD Token
0 ETH0.0000000128070.00010139
Safe Transfer Fr...1373258272025-06-18 12:40:31151 days ago1750250431IN
hns.id: Handshake SLD Token
0 ETH0.0000000175160.00010139
Set Approval For...1373213092025-06-18 10:09:55151 days ago1750241395IN
hns.id: Handshake SLD Token
0 ETH0.0000000158880.00010241
Set Approval For...1372971432025-06-17 20:44:23152 days ago1750193063IN
hns.id: Handshake SLD Token
0 ETH0.000000014140.000105
Set Approval For...1372785102025-06-17 10:23:17152 days ago1750155797IN
hns.id: Handshake SLD Token
0 ETH0.000000013130.00010062
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
HandshakeSld

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 10000 runs

Other Settings:
london EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "contracts/HandshakeNft.sol";
import {Namehash} from "utils/Namehash.sol";
import "interfaces/IHandshakeSld.sol";
import "interfaces/IHandshakeTld.sol";
import "structs/SldDetail.sol";
import "interfaces/ISldRegistrationManager.sol";

/**
 * @title Decentralised SLD NFTs
 * @author Sam Ward
 * @notice erc721 SLD contract
 */
contract HandshakeSld is HandshakeNft, IHandshakeSld {
    // a map of string labels
    mapping(bytes32 => string) public namehashToLabelMap;
    mapping(bytes32 => uint256) public royaltyPayoutAmountMap;
    mapping(bytes32 => mapping(address => address)) public royaltyPayoutAddressMap;
    mapping(bytes32 => bytes32) public namehashToParentMap;

    IHandshakeTld public immutable handshakeTldContract;

    ISldRegistrationManager public registrationManager;

    event RoyaltyPayoutAmountSet(bytes32 indexed _nftNamehash, uint256 _amount);
    event RoyaltyPayoutAddressSet(bytes32 indexed _nftNamehash, address _payoutAddress);

    constructor(IHandshakeTld _tld) HandshakeNft("SLD", "Handshake SLD") {
        handshakeTldContract = _tld;
    }

    /**
     * @notice Register and mint SLD NFT
     * @dev This function can only be called by the
     *      registration manager contract
     * @param _to The address that the SLD will be minted to.
     *            Zero address will be minted to msg.sender
     * @param _tldNamehash The bytes32 representation of the TLD
     * @param _label The label of the SLD
     */
    function registerSld(address _to, bytes32 _tldNamehash, string calldata _label)
        external
        isRegistrationManager
    {
        bytes32 sldNamehash = Namehash.getNamehash(_tldNamehash, _label);
        if (hasExpired(sldNamehash)) {
            _burn(uint256(sldNamehash));
        }
        _mint(_to, uint256(sldNamehash));

        namehashToParentMap[sldNamehash] = _tldNamehash;
        namehashToLabelMap[sldNamehash] = _label;

        tokenResolverMap[sldNamehash] = defaultResolver;
        emit ResolverSet(sldNamehash, address(defaultResolver));
    }

    function burnSld(bytes32 _namehash) external isRegistrationManager {
        _burn(uint256(_namehash));
        delete namehashToLabelMap[_namehash];
        delete namehashToParentMap[_namehash];
        delete tokenResolverMap[_namehash];
    }

    /**
     * @notice Register and mint SLD NFT
     * @dev This function is custom owner/approved checking function.
     * @param _operator The address that is being checked
     * @param _tokenId The token ID of the SLD NFT to be checked
     * @return _allowed Is the address the owner or on the accepted list
     */
    function isApprovedOrOwner(address _operator, uint256 _tokenId)
        public
        view
        override(HandshakeNft, IHandshakeSld)
        returns (bool _allowed)
    {
        _allowed = HandshakeNft.isApprovedOrOwner(_operator, _tokenId);
    }

    /**
     * @notice Check the owner of a specified token.
     * @dev This function returns back the owner of an NFT. Will revert if the token does
     *      not exist or has expired.
     * @param _tokenId The token ID of the SLD NFT to be checked
     * @return _addr Owner of NFT
     */
    function ownerOf(uint256 _tokenId)
        public
        view
        override(HandshakeNft, IHandshakeSld)
        returns (address _addr)
    {
        require(!hasExpired(bytes32(_tokenId)), "sld expired");
        _addr = HandshakeNft.ownerOf(_tokenId);
    }

    function hasExpired(bytes32 _sldNamehash) internal view override returns (bool _hasExpired) {
        if (_exists(uint256(_sldNamehash))) {
            (uint80 regTime, uint96 regLength, ) = registrationManager.sldRegistrationHistory(
                _sldNamehash
            );
            _hasExpired = regTime + regLength <= block.timestamp;
        }
    }

    /**
     * @notice Get the registration strategy for a TLD
     * @dev This function gets the registration strategy of a top level domain. Will revert if
     *      the strategy is not set.
     * @param _parentNamehash Bytes32 representation of the top level domain
     * @return _strategy Linked registration strategy to the top level domain
     */
    function getRegistrationStrategy(bytes32 _parentNamehash)
        public
        view
        returns (ISldRegistrationStrategy _strategy)
    {
        _strategy = handshakeTldContract.registrationStrategy(_parentNamehash);
    }

    function setRegistrationManager(ISldRegistrationManager _registrationManager) public onlyOwner {
        registrationManager = _registrationManager;
    }

    /**
     * @notice Set the % royalty amount
     * @dev This function sets the royalty percentage for EIP-2981 function. This
     *      function can only be run by the owner of the top level domain.
     * @param _id uint256 representation of the top level domain
     * @param _amount Percentage to be set. Should be between 1-10%.
     */
    function setRoyaltyPayoutAmount(uint256 _id, uint256 _amount)
        public
        onlyParentApprovedOrOwner(_id)
    {
        require(_amount <= 10, "10% maximum royalty on SLD");
        royaltyPayoutAmountMap[bytes32(_id)] = _amount;
        emit RoyaltyPayoutAmountSet(bytes32(_id), _amount);
    }

    /**
     * @notice Set the royalty payout address. This defaults to the owner of the
     *         top level domain in the first instance.
     * @dev This function sets the royalty payout wallet for EIP-2981 function. This
     *      function can only be run by the owner of the top level domain.
     * @param _id uint256 representation of the top level domain
     * @param _addr Address to be set for the on-chain royalties to be sent to.
     */
    function setRoyaltyPayoutAddress(uint256 _id, address _addr)
        public
        onlyParentApprovedOrOwner(_id)
    {
        require(_addr != address(0), "cannot set to zero address");
        royaltyPayoutAddressMap[bytes32(_id)][handshakeTldContract.ownerOf(_id)] = _addr;
        emit RoyaltyPayoutAddressSet(bytes32(_id), _addr);
    }

    function getSingleSldDetails(
        address _recipient,
        uint256 _parentId,
        string calldata _label,
        uint256 _registrationLength
    ) private view returns (SldDetail memory) {
        bytes32 parentHash = bytes32(_parentId);

        ISldRegistrationStrategy priceStrat = getRegistrationStrategy(parentHash);

        uint256 priceInDollars = priceStrat.getPriceInDollars(
            _recipient,
            parentHash,
            _label,
            _registrationLength,
            false
        );

        uint256 royaltyAmount = royaltyPayoutAmountMap[parentHash];

        SldDetail memory detail = SldDetail(
            uint256(Namehash.getNamehash(parentHash, _label)),
            _parentId,
            _label,
            priceInDollars,
            royaltyAmount
        );
        return detail;
    }

    /**
     * @notice Get multiple SLD details, which includes the price and NFT details
     * @dev Input arrays should all be the same length.
     * @param _recipients Array of the recipients. Generally will just be the same address.
     * @param _parentIds Array of the parent IDs
     * @param _labels Array of the SLD labels to be queried.
     * @param _registrationLengths Array of the length of registration (days)
     * @return _details
     */
    function getSldDetails(
        address[] calldata _recipients,
        uint256[] calldata _parentIds,
        string[] calldata _labels,
        uint256[] calldata _registrationLengths
    ) external view returns (SldDetail[] memory) {
        uint256 len = _parentIds.length;
        require(
            (len ^ _recipients.length ^ _labels.length ^ _registrationLengths.length) == 0,
            "array lengths are different"
        );

        SldDetail[] memory _details = new SldDetail[](len);

        _details = new SldDetail[](len);

        for (uint256 i; i < len; ) {
            _details[i] = getSingleSldDetails(
                _recipients[i],
                _parentIds[i],
                _labels[i],
                _registrationLengths[i]
            );

            unchecked {
                ++i;
            }
        }

        return _details;
    }

    /**
     * @notice Gets the fully qualified domain name including TLD
     * @dev This function will get the full domain name sld.tld.
     *      It will revert if the domain does not exist.
     * @param _sldNamehash bytes32 representation of the sub domain
     * @return _fullDomain
     */
    function name(bytes32 _sldNamehash)
        external
        view
        override(HandshakeNft, IHandshakeSld)
        returns (string memory _fullDomain)
    {
        bytes32 tldNamehash = namehashToParentMap[_sldNamehash];
        require(tldNamehash != 0x0, "domain does not exist");
        string memory tldLabel = handshakeTldContract.namehashToLabelMap(tldNamehash);
        string memory sldLabel = namehashToLabelMap[_sldNamehash];

        _fullDomain = string(abi.encodePacked(sldLabel, ".", tldLabel));
    }

    function parent(bytes32 _sldNamehash)
        external
        view
        override(HandshakeNft, IHandshakeSld)
        returns (string memory _parentName)
    {
        bytes32 tldNamehash = namehashToParentMap[_sldNamehash];
        require(tldNamehash != 0x0, "domain does not exist");

        _parentName = handshakeTldContract.namehashToLabelMap(tldNamehash);
    }

    function expiry(bytes32 _namehash)
        public
        view
        override(HandshakeNft, IHandshakeSld)
        returns (uint256 _expiry)
    {
        (uint80 regTime, uint96 regLength, ) = registrationManager.sldRegistrationHistory(
            _namehash
        );

        _expiry = regTime + regLength;
    }

    function exists(uint256 tokenId) public view override returns (bool) {
        return super.exists(tokenId) && !hasExpired(bytes32(tokenId));
    }

    /**
     * @notice Gets the royalty information for a SLD
     * @dev This function will get EIP-2981 royalty information based on the TLD
     * @param tokenId uint256 representation of the SLD
     * @param salePrice this does not link to any specific currency
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount)
    {
        bytes32 parentNamehash = namehashToParentMap[bytes32(tokenId)];
        uint256 parentId = uint256(parentNamehash);

        address owner = handshakeTldContract.ownerOf(parentId);

        receiver = royaltyPayoutAddressMap[parentNamehash][owner] == address(0)
            ? owner
            : royaltyPayoutAddressMap[parentNamehash][owner];

        royaltyAmount = royaltyPayoutAmountMap[parentNamehash] == 0
            ? 0
            : ((salePrice * royaltyPayoutAmountMap[parentNamehash]) / 100);
    }

    modifier onlyParentApprovedOrOwner(uint256 _id) {
        require(handshakeTldContract.isApprovedOrOwner(msg.sender, _id), "not authorised");
        _;
    }

    modifier isRegistrationManager() {
        require(address(registrationManager) == msg.sender, "not authorised");
        _;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: address zero is not a valid owner");
        return _balances[owner];
    }

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

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

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

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

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

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

        _transfer(from, to, tokenId);
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");
        _safeTransfer(from, to, tokenId, data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

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

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

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

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

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

        _balances[to] += 1;
        _owners[tokenId] = to;

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

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

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

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

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

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

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

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

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

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

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

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

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

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

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

// 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 (last updated v4.7.2) (utils/introspection/ERC165Checker.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Library used to query support of an interface declared via {IERC165}.
 *
 * Note that these functions return the actual result of the query: they do not
 * `revert` if an interface is not supported. It is up to the caller to decide
 * what to do in these cases.
 */
library ERC165Checker {
    // As per the EIP-165 spec, no interface should ever match 0xffffffff
    bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;

    /**
     * @dev Returns true if `account` supports the {IERC165} interface,
     */
    function supportsERC165(address account) internal view returns (bool) {
        // Any contract that implements ERC165 must explicitly indicate support of
        // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
        return
            _supportsERC165Interface(account, type(IERC165).interfaceId) &&
            !_supportsERC165Interface(account, _INTERFACE_ID_INVALID);
    }

    /**
     * @dev Returns true if `account` supports the interface defined by
     * `interfaceId`. Support for {IERC165} itself is queried automatically.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
        // query support of both ERC165 as per the spec and support of _interfaceId
        return supportsERC165(account) && _supportsERC165Interface(account, interfaceId);
    }

    /**
     * @dev Returns a boolean array where each value corresponds to the
     * interfaces passed in and whether they're supported or not. This allows
     * you to batch check interfaces for a contract where your expectation
     * is that some interfaces may not be supported.
     *
     * See {IERC165-supportsInterface}.
     *
     * _Available since v3.4._
     */
    function getSupportedInterfaces(address account, bytes4[] memory interfaceIds)
        internal
        view
        returns (bool[] memory)
    {
        // an array of booleans corresponding to interfaceIds and whether they're supported or not
        bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);

        // query support of ERC165 itself
        if (supportsERC165(account)) {
            // query support of each interface in interfaceIds
            for (uint256 i = 0; i < interfaceIds.length; i++) {
                interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]);
            }
        }

        return interfaceIdsSupported;
    }

    /**
     * @dev Returns true if `account` supports all the interfaces defined in
     * `interfaceIds`. Support for {IERC165} itself is queried automatically.
     *
     * Batch-querying can lead to gas savings by skipping repeated checks for
     * {IERC165} support.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
        // query support of ERC165 itself
        if (!supportsERC165(account)) {
            return false;
        }

        // query support of each interface in _interfaceIds
        for (uint256 i = 0; i < interfaceIds.length; i++) {
            if (!_supportsERC165Interface(account, interfaceIds[i])) {
                return false;
            }
        }

        // all interfaces supported
        return true;
    }

    /**
     * @notice Query if a contract implements an interface, does not check ERC165 support
     * @param account The address of the contract to query for support of an interface
     * @param interfaceId The interface identifier, as specified in ERC-165
     * @return true if the contract at account indicates support of the interface with
     * identifier interfaceId, false otherwise
     * @dev Assumes that account contains a contract that supports ERC165, otherwise
     * the behavior of this method is undefined. This precondition can be checked
     * with {supportsERC165}.
     * Interface identification is specified in ERC-165.
     */
    function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {
        // prepare call
        bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);

        // perform static call
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly {
            success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0x00)
        }

        return success && returnSize >= 0x20 && returnValue > 0;
    }
}

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

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "interfaces/IMetadataService.sol";
import "interfaces/IResolver.sol";

// base class for both SLD and TLDs
abstract contract HandshakeNft is ERC721, Ownable {
    using ERC165Checker for address;

    // token uri for metadata service uses namehash as the input value
    bytes4 private constant TOKEN_URI_SELECTOR = IMetadataService.tokenURI.selector;

    mapping(bytes32 => IResolver) public tokenResolverMap;

    IResolver public defaultResolver;
    IMetadataService public metadata;

    event ResolverSet(bytes32 indexed _nftNamehash, address _resolver);

    constructor(string memory _symbol, string memory _name) ERC721(_symbol, _name) {}

    function tokenURI(uint256 _id) public view override returns (string memory) {
        require(address(metadata) != address(0), "Metadata service is not implemented");
        return metadata.tokenURI(bytes32(_id));
    }

    function setMetadataContract(IMetadataService _metadata) external onlyOwner {
        require(
            address(_metadata).supportsInterface(TOKEN_URI_SELECTOR),
            "does not implement tokenUri method"
        );
        metadata = _metadata;
    }

    function setDefaultResolver(IResolver _resolver) external onlyOwner {
        defaultResolver = _resolver;
    }

    function setResolver(bytes32 _namehash, IResolver _resolver)
        public
        virtual
        onlyApprovedOrOwner(uint256(_namehash))
    {
        tokenResolverMap[_namehash] = _resolver;
        emit ResolverSet(_namehash, address(_resolver));
    }

    function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
        return super.supportsInterface(interfaceId) || interfaceId == this.tokenURI.selector;
    }

    /**
     * @dev Gets the owner of the specified token ID. Names become unowned when their registration expires.
     * @param tokenId uint256 ID of the token to query the owner of
     * @return address currently marked as the owner of the given token ID
     */
    function ownerOf(uint256 tokenId) public view virtual override(ERC721) returns (address) {
        return super.ownerOf(tokenId);
    }

    /**
     *
     * @param spender address of the spender to query
     * @param tokenId uint256 ID of the token to be transferred
     * @return bool whether spender is approved for the given token ID, is an operator of the owner, or is the owner of the token
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId)
        internal
        view
        override
        returns (bool)
    {
        if (_exists(tokenId)) {
            address owner = ownerOf(tokenId);

            return (spender == owner ||
                isApprovedForAll(owner, spender) ||
                getApproved(tokenId) == spender);
        } else {
            return false;
        }
    }

    /**
     * @notice public version of _isApprovedOrOwner which calls ownerOf(tokenId)
     * @param spender address of the spender to query
     * @param tokenId uint256 ID of the token to be transferred
     *
     * @return bool whether the spender is approved for the given token ID, is an operator of the owner, or is the owner of the token
     */
    function isApprovedOrOwner(address spender, uint256 tokenId)
        public
        view
        virtual
        returns (bool)
    {
        return _isApprovedOrOwner(spender, tokenId);
    }

    /**
     * @notice returns back the string representation of the name. It makes more sense to have it here than on the resolver as the resolver
     *         can be updated and we will likely use the name string in the metadata class
     * @dev should override this function in the inherited class
     * @param _namehash bytes32 representaion of the domain
     *
     * @return _name fully qualified name of the domain / NFT
     */
    function name(bytes32 _namehash) external view virtual returns (string memory _name) {}

    function parent(bytes32 _namehash) external view virtual returns (string memory _parentName) {}

    function expiry(bytes32 _namehash) public view virtual returns (uint256 _expiry) {}

    function hasExpired(bytes32) internal view virtual returns (bool _expired) {}

    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        require(!hasExpired(bytes32(tokenId)), "cannot transfer expired token");
        super.transferFrom(from, to, tokenId);
    }

    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
        public
        virtual
        override
    {
        require(!hasExpired(bytes32(tokenId)), "cannot transfer expired token");
        super.safeTransferFrom(from, to, tokenId, data);
    }

    function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
        require(!hasExpired(bytes32(tokenId)), "cannot transfer expired token");
        super.safeTransferFrom(from, to, tokenId);
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function exists(uint256 tokenId) public view virtual returns (bool) {
        return ERC721._exists(tokenId);
    }

    /**
     * @dev modifier version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes expiration into consideration instead of ERC721.ownerOf(tokenId);
     * @param tokenId uint256 ID of the token to be transferred
     */
    modifier onlyApprovedOrOwner(uint256 tokenId) {
        require(isApprovedOrOwner(msg.sender, tokenId), "not approved or owner");
        _;
    }
}

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

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

interface IGlobalRegistrationRules is IERC165 {
    function canRegister(
        address _buyingAddress,
        bytes32 _parentNamehash,
        string calldata _label,
        uint256 _registrationLength,
        uint256 _dollarPrice
    ) external view returns (bool);

    function canRenew(
        address _buyingAddress,
        bytes32 _parentNamehash,
        string calldata _label,
        uint256 _registrationLength,
        uint256 _dollarPrice
    ) external view returns (bool);

    function minimumDollarPrice() external view returns (uint256);
}

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

import "interfaces/ISldRegistrationStrategy.sol";
import "interfaces/IResolver.sol";

interface IHandshakeSld {
    function isApprovedOrOwner(address spender, uint256 tokenId) external view returns (bool);

    function registerSld(address _to, bytes32 _tldNamehash, string calldata _label) external;

    function ownerOf(uint256 _id) external view returns (address);

    function getRegistrationStrategy(bytes32 _parentNamehash)
        external
        view
        returns (ISldRegistrationStrategy);

    function namehashToParentMap(bytes32 _childNamehash)
        external
        view
        returns (bytes32 _parentNamehash);

    function name(bytes32 _sldNamehash) external view returns (string memory _fullDomain);

    function expiry(bytes32 _namehash) external view returns (uint256 _expiry);

    function parent(bytes32) external view returns (string memory _parentName);

    function namehashToLabelMap(bytes32 _childNamehash) external view returns (string memory);

    function burnSld(bytes32 _namehash) external;
}

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

import "interfaces/ITldClaimManager.sol";
import "interfaces/IResolver.sol";
import "interfaces/ISldRegistrationStrategy.sol";

interface IHandshakeTld {
    //function register(address _addr, string calldata _domain) external;

    function registerWithResolver(
        address _addr,
        string calldata _domain,
        ISldRegistrationStrategy _strategy
    ) external;

    function ownerOf(uint256 _id) external view returns (address);

    function isApprovedOrOwner(address _operator, uint256 _id) external view returns (bool);

    function setTldClaimManager(ITldClaimManager _manager) external;

    function namehashToLabelMap(bytes32 _namehash) external view returns (string memory);

    function setResolver(bytes32 _namehash, IResolver _resolver) external;

    function registrationStrategy(bytes32 _namehash)
        external
        view
        returns (ISldRegistrationStrategy);
}

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

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

interface IMetadataService is IERC165 {
    function tokenURI(bytes32 _namehash) external view returns (string memory);
}

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

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import "interfaces/resolvers/IAddressResolver.sol";
import "interfaces/resolvers/IAddrResolver.sol";
import "interfaces/resolvers/IContentHashResolver.sol";
import "interfaces/resolvers/IDNSRecordResolver.sol";
import "interfaces/resolvers/IDNSZoneResolver.sol";
import "interfaces/resolvers/INameResolver.sol";
import "interfaces/resolvers/ITextResolver.sol";

/**
 * A generic resolver interface which includes all the functions including the ones deprecated
 */
interface IResolver is
    IERC165,
    IAddressResolver,
    IAddrResolver,
    IContentHashResolver,
    IDNSRecordResolver,
    IDNSZoneResolver,
    INameResolver,
    ITextResolver
{

}

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

import "interfaces/IHandshakeTld.sol";
import "interfaces/IGlobalRegistrationRules.sol";

interface ISldRegistrationManager {
    function registerWithCommit(
        string calldata _label,
        bytes32 _secret,
        uint256 _registrationLength,
        bytes32 _parentNamehash,
        address _recipient
    ) external payable;

    function registerWithSignature(
        string calldata _label,
        uint256 _registrationLength,
        bytes32 _parentNamehash,
        address _recipient,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external payable;

    function renewSld(string calldata _label, bytes32 _parentNamehash, uint80 _registrationLength)
        external
        payable;

    function getRenewalPricePerDay(
        address _addr,
        bytes32 _parentNamehash,
        string calldata _label,
        uint256 _registrationLength
    ) external view returns (uint256);

    function sldRegistrationHistory(bytes32 _sldNamehash)
        external
        view
        returns (uint80, uint80, uint96);

    function tld() external view returns (IHandshakeTld);

    function getRenewalPrice(
        address _addr,
        bytes32 _parentNamehash,
        string calldata _label,
        uint256 _registrationLength
    ) external view returns (uint256 _price);

    function globalStrategy() external view returns (IGlobalRegistrationRules);

    function pricesAtRegistration(bytes32 _sldNamehash, uint256 _index)
        external
        view
        returns (uint80);

    event RegisterSld(
        bytes32 indexed _tldNamehash,
        bytes32 _secret,
        string _label,
        uint256 _expiry
    );

    event RenewSld(bytes32 indexed _tldNamehash, string _label, uint256 _expiry);
}

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

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

interface ISldRegistrationStrategy is IERC165 {
    event PremiumNameSet(bytes32 indexed _tokenNamehash, uint256 _price, string _label);
    event ReservedNameSet(bytes32 indexed _tokenNamehash, address indexed _claimant, string _label);
    event LengthCostSet(bytes32 indexed _tokenNamehash, uint256[] _prices);
    event MultiYearDiscountSet(bytes32 indexed _tokenNamehash, uint256[] _discounts);
    event EnabledSet(bytes32 indexed _tokenNamehash, bool _enabled);

    function isEnabled(bytes32 _parentNamehash) external view returns (bool);

    function getPriceInDollars(
        address _buyingAddress,
        bytes32 _parentNamehash,
        string memory _label,
        uint256 _registrationLength,
        bool _isRenewal
    ) external view returns (uint256);
}

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

import "interfaces/IHandshakeTld.sol";

interface ITldClaimManager {
    function canClaim(address _addr, bytes32 _namehash) external view returns (bool);

    function claimTld(string calldata _domain, address _addr) external payable;

    function setHandshakeTldContract(IHandshakeTld _tld) external;

    function updateAllowedTldManager(address _addr, bool _allowed) external;

    function allowedTldManager(address _addr) external view returns (bool);

    function addTldAndClaimant(address[] calldata _addr, string[] calldata _domain) external;

    function tldExpiry(bytes32 _node) external view returns (uint256);

    event TldClaimed(address indexed _to, uint256 indexed _id, string _label);

    event UpdateAllowedTldManager(address indexed _addr, bool _allowed);

    event AllowedTldMintUpdate(address indexed _claimant, address indexed _manager, string _label);
}

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

/**
 * Includes the interface for the legacy (ETH-only) addr function.
 */

// resolver interface based on ENS
// https://github.com/ensdomains/ens-contracts
interface IAddrResolver {
    event AddrChanged(bytes32 indexed node, address a);

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

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

// resolver interface based on ENS
// https://github.com/ensdomains/ens-contracts
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.17;

// resolver interface based on ENS
// https://github.com/ensdomains/ens-contracts
interface IContentHashResolver {
    event ContenthashChanged(bytes32 indexed node, bytes hash);

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

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

// resolver interface based on ENS
// https://github.com/ensdomains/ens-contracts
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.17;

// resolver interface based on ENS
// https://github.com/ensdomains/ens-contracts
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 node to query.
     * @return The associated contenthash.
     */
    function zonehash(bytes32 node) external view returns (bytes memory);
}

File 27 of 31 : INameResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

// resolver interface based on ENS
// https://github.com/ensdomains/ens-contracts
interface INameResolver {
    event NameChanged(bytes32 indexed node, string name);
    event ReverseClaimed(address indexed _addr, string _domain);

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

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

// resolver interface based on ENS
// https://github.com/ensdomains/ens-contracts
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 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);
}

File 29 of 31 : SldDetail.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

struct SldDetail {
    uint256 Id;
    uint256 ParentId;
    string Label;
    uint256 Price;
    uint256 RoyaltyAmount;
}

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

// slither-disable-start too-many-digits

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

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

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

    /*
     * @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) {
        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) {
                // Mask out irrelevant bytes and check again
                uint256 mask;
                if (shortest > 32) {
                    mask = type(uint256).max;
                } else {
                    mask = ~(2**(8 * (32 - shortest + idx)) - 1);
                }
                int256 diff = int256(a & mask) - int256(b & mask);
                if (diff != 0) return diff;
            }
            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 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 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 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 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 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 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));
    }
}

// slither-disable-end too-many-digits

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

import "utils/BytesUtils.sol";

library Namehash {
    using BytesUtils for bytes;

    function getLabelhash(string memory _label) public pure returns (bytes32) {
        return keccak256(abi.encodePacked(_label));
    }

    function getNamehash(bytes32 _parentHash, string memory _label) public pure returns (bytes32) {
        bytes32 labelhash = keccak256(abi.encodePacked(_label));
        return keccak256(abi.encodePacked(_parentHash, labelhash));
    }

    function getTldNamehash(string memory _label) public pure returns (bytes32) {
        return getNamehash(bytes32(0), _label);
    }

    function getDomainNamehash(string calldata _domain) public pure returns (bytes32) {
        bytes memory bytesDomain = bytes(_domain);
        uint256 length = bytesDomain.length;
        bytes32 node = 0;
        uint8 labelLength = 0;

        // use unchecked to save gas since we check for an underflow
        // and we check for the length before the loop
        unchecked {
            for (uint256 i = length - 1; i >= 0; i--) {
                if (bytesDomain[i] == ".") {
                    node = keccak256(
                        abi.encodePacked(node, bytesDomain.keccak(i + 1, labelLength))
                    );
                    labelLength = 0;
                } else {
                    labelLength += 1;
                }
                if (i == 0) {
                    break;
                }
            }
        }

        node = keccak256(abi.encodePacked(node, bytesDomain.keccak(0, labelLength)));

        return node;
    }
}

Settings
{
  "remappings": [
    "@chainlink/=node_modules/@chainlink/",
    "@ensdomains/=node_modules/@ensdomains/",
    "@ensdomains/buffer/contracts/=node_modules/@ensdomains/buffer/contracts/",
    "@ensdomains/ens-contracts/contracts/=node_modules/@ensdomains/ens-contracts/contracts/",
    "@eth-optimism/=node_modules/@eth-optimism/",
    "@openzeppelin/=node_modules/@openzeppelin/",
    "contracts/=src/contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "foundry-upgrades/=lib/foundry-upgrades/src/",
    "hardhat/=node_modules/hardhat/",
    "interfaces/=src/interfaces/",
    "mocks/=test/mocks/",
    "openzeppelin-contracts/=lib/foundry-upgrades/lib/openzeppelin-contracts/",
    "openzeppelin/=lib/foundry-upgrades/lib/openzeppelin-contracts/contracts/",
    "proxy/=lib/foundry-upgrades/src/utils/",
    "solmate/=lib/solmate/src/",
    "structs/=src/structs/",
    "test/=test/",
    "utils/=src/utils/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 10000
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {
    "src/utils/Namehash.sol": {
      "Namehash": "0xc4eae802bd84c01e15dd9930761a6985912b995c"
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"contract IHandshakeTld","name":"_tld","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_nftNamehash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"_resolver","type":"address"}],"name":"ResolverSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_nftNamehash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"_payoutAddress","type":"address"}],"name":"RoyaltyPayoutAddressSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_nftNamehash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"RoyaltyPayoutAmountSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_namehash","type":"bytes32"}],"name":"burnSld","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"defaultResolver","outputs":[{"internalType":"contract IResolver","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_namehash","type":"bytes32"}],"name":"expiry","outputs":[{"internalType":"uint256","name":"_expiry","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_parentNamehash","type":"bytes32"}],"name":"getRegistrationStrategy","outputs":[{"internalType":"contract ISldRegistrationStrategy","name":"_strategy","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_recipients","type":"address[]"},{"internalType":"uint256[]","name":"_parentIds","type":"uint256[]"},{"internalType":"string[]","name":"_labels","type":"string[]"},{"internalType":"uint256[]","name":"_registrationLengths","type":"uint256[]"}],"name":"getSldDetails","outputs":[{"components":[{"internalType":"uint256","name":"Id","type":"uint256"},{"internalType":"uint256","name":"ParentId","type":"uint256"},{"internalType":"string","name":"Label","type":"string"},{"internalType":"uint256","name":"Price","type":"uint256"},{"internalType":"uint256","name":"RoyaltyAmount","type":"uint256"}],"internalType":"struct SldDetail[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"handshakeTldContract","outputs":[{"internalType":"contract IHandshakeTld","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isApprovedOrOwner","outputs":[{"internalType":"bool","name":"_allowed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metadata","outputs":[{"internalType":"contract IMetadataService","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_sldNamehash","type":"bytes32"}],"name":"name","outputs":[{"internalType":"string","name":"_fullDomain","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"namehashToLabelMap","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"namehashToParentMap","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"_addr","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_sldNamehash","type":"bytes32"}],"name":"parent","outputs":[{"internalType":"string","name":"_parentName","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"bytes32","name":"_tldNamehash","type":"bytes32"},{"internalType":"string","name":"_label","type":"string"}],"name":"registerSld","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"registrationManager","outputs":[{"internalType":"contract ISldRegistrationManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"address","name":"","type":"address"}],"name":"royaltyPayoutAddressMap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"royaltyPayoutAmountMap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IResolver","name":"_resolver","type":"address"}],"name":"setDefaultResolver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IMetadataService","name":"_metadata","type":"address"}],"name":"setMetadataContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISldRegistrationManager","name":"_registrationManager","type":"address"}],"name":"setRegistrationManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_namehash","type":"bytes32"},{"internalType":"contract IResolver","name":"_resolver","type":"address"}],"name":"setResolver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address","name":"_addr","type":"address"}],"name":"setRoyaltyPayoutAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setRoyaltyPayoutAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"tokenResolverMap","outputs":[{"internalType":"contract IResolver","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a06040523480156200001157600080fd5b5060405162003d2838038062003d2883398101604081905262000034916200011f565b6040518060400160405280600381526020016214d31160ea1b8152506040518060400160405280600d81526020016c12185b991cda185ad94814d311609a1b81525081818160009081620000899190620001f6565b506001620000988282620001f6565b505050620000b5620000af620000c960201b60201c565b620000cd565b50506001600160a01b0316608052620002c2565b3390565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000602082840312156200013257600080fd5b81516001600160a01b03811681146200014a57600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200017c57607f821691505b6020821081036200019d57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001f157600081815260208120601f850160051c81016020861015620001cc5750805b601f850160051c820191505b81811015620001ed57828155600101620001d8565b5050505b505050565b81516001600160401b0381111562000212576200021262000151565b6200022a8162000223845462000167565b84620001a3565b602080601f831160018114620002625760008415620002495750858301515b600019600386901b1c1916600185901b178555620001ed565b600085815260208120601f198616915b82811015620002935788860151825594840194600190910190840162000272565b5085821015620002b25787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608051613a196200030f6000396000818161041901528181610aa901528181610dea015281816110cd0152818161137a01528181611b9001528181611ce50152611e060152613a196000f3fe608060405234801561001057600080fd5b50600436106102d35760003560e01c80637eda417511610186578063c3d5fdf1116100e3578063e985e9c511610097578063f2fde38b11610071578063f2fde38b1461068b578063f6aea5b71461069e578063f8559dc7146106b157600080fd5b8063e985e9c51461061c578063eae12cb614610658578063f18daeb91461066b57600080fd5b8063c87b56dd116100c8578063c87b56dd146105e3578063d2ec5fca146105f6578063e5187f431461060957600080fd5b8063c3d5fdf1146105bd578063c66485b2146105d057600080fd5b80639a6c67e91161013a578063adaa0acc1161011f578063adaa0acc14610584578063b88d4fde14610597578063be6d17cd146105aa57600080fd5b80639a6c67e914610551578063a22cb4651461057157600080fd5b806384f7d0121161016b57806384f7d0121461050f5780638da5cb5b1461053857806395d89b411461054957600080fd5b80637eda4175146104c8578063828eab0e146104fc57600080fd5b8063430c208111610234578063691f3431116101e857806370a08231116101cd57806370a082311461049a578063715018a6146104ad5780637b831505146104b557600080fd5b8063691f343114610474578063708e83321461048757600080fd5b80634f558e79116102195780634f558e791461043b5780636352211e1461044e57806365d39e0b1461046157600080fd5b8063430c20811461040157806343ee0c011461041457600080fd5b80631896f70a1161028b5780632a55205a116102705780632a55205a146103a9578063392f37e9146103db57806342842e0e146103ee57600080fd5b80631896f70a1461038357806323b872dd1461039657600080fd5b8063081812fc116102bc578063081812fc14610315578063095ea7b3146103405780630dd64ae21461035557600080fd5b806301ffc9a7146102d857806306fdde0314610300575b600080fd5b6102eb6102e6366004612ef2565b6106c4565b60405190151581526020015b60405180910390f35b610308610721565b6040516102f79190612f5f565b610328610323366004612f72565b6107b3565b6040516001600160a01b0390911681526020016102f7565b61035361034e366004612fa0565b6107da565b005b610375610363366004612f72565b600b6020526000908152604090205481565b6040519081526020016102f7565b610353610391366004612fcc565b61092e565b6103536103a4366004612ffc565b610a03565b6103bc6103b736600461303d565b610a64565b604080516001600160a01b0390931683526020830191909152016102f7565b600954610328906001600160a01b031681565b6103536103fc366004612ffc565b610bc6565b6102eb61040f366004612fa0565b610c27565b6103287f000000000000000000000000000000000000000000000000000000000000000081565b6102eb610449366004612f72565b610c3a565b61032861045c366004612f72565b610c5c565b61030861046f366004612f72565b610cbd565b610308610482366004612f72565b610d57565b610353610495366004612f72565b610f2b565b6103756104a836600461305f565b610fe8565b610353611082565b6103536104c336600461303d565b611096565b6103286104d6366004612fcc565b600c6020908152600092835260408084209091529082529020546001600160a01b031681565b600854610328906001600160a01b031681565b61032861051d366004612f72565b6007602052600090815260409020546001600160a01b031681565b6006546001600160a01b0316610328565b610308611222565b61037561055f366004612f72565b600d6020526000908152604090205481565b61035361057f36600461308a565b611231565b61035361059236600461305f565b611240565b6103536105a5366004613140565b611282565b6103086105b8366004612f72565b6112ea565b600e54610328906001600160a01b031681565b6103536105de36600461305f565b6113f1565b6103086105f1366004612f72565b611433565b610375610604366004612f72565b61153e565b61035361061736600461305f565b611608565b6102eb61062a3660046131ef565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61035361066636600461321d565b6116ef565b61067e6106793660046132f2565b6118af565b6040516102f791906133b6565b61035361069936600461305f565b611ac9565b6103536106ac366004612fcc565b611b59565b6103286106bf366004612f72565b611dd4565b60006106cf82611e79565b8061071b57507fffffffff0000000000000000000000000000000000000000000000000000000082167fc87b56dd00000000000000000000000000000000000000000000000000000000145b92915050565b60606000805461073090613469565b80601f016020809104026020016040519081016040528092919081815260200182805461075c90613469565b80156107a95780601f1061077e576101008083540402835291602001916107a9565b820191906000526020600020905b81548152906001019060200180831161078c57829003601f168201915b5050505050905090565b60006107be82611f5c565b506000908152600460205260409020546001600160a01b031690565b60006107e582611fc0565b9050806001600160a01b0316836001600160a01b0316036108735760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b03821614806108ad57506001600160a01b038116600090815260056020908152604080832033845290915290205460ff165b61091f5760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161086a565b6109298383612025565b505050565b816109393382610c27565b6109855760405162461bcd60e51b815260206004820152601560248201527f6e6f7420617070726f766564206f72206f776e65720000000000000000000000604482015260640161086a565b60008381526007602090815260409182902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038616908117909155915191825284917f8351f08b866373e36a5512f940b7609da3d55dfef07a9002049549d40c23a14691015b60405180910390a2505050565b610a0c816120ab565b15610a595760405162461bcd60e51b815260206004820152601d60248201527f63616e6e6f74207472616e73666572206578706972656420746f6b656e000000604482015260640161086a565b610929838383612197565b6000828152600d60205260408082205490517f6352211e00000000000000000000000000000000000000000000000000000000815260048101829052829190819083907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015610af8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1c91906134bc565b6000848152600c602090815260408083206001600160a01b0380861685529252909120549192501615610b73576000838152600c602090815260408083206001600160a01b03808616855292529091205416610b75565b805b6000848152600b602052604090205490955015610bb7576000838152600b6020526040902054606490610ba89088613508565b610bb2919061351f565b610bba565b60005b93505050509250929050565b610bcf816120ab565b15610c1c5760405162461bcd60e51b815260206004820152601d60248201527f63616e6e6f74207472616e73666572206578706972656420746f6b656e000000604482015260640161086a565b61092983838361221e565b6000610c338383612239565b9392505050565b6000610c4582612245565b801561071b5750610c55826120ab565b1592915050565b6000610c67826120ab565b15610cb45760405162461bcd60e51b815260206004820152600b60248201527f736c642065787069726564000000000000000000000000000000000000000000604482015260640161086a565b61071b82612264565b600a6020526000908152604090208054610cd690613469565b80601f0160208091040260200160405190810160405280929190818152602001828054610d0290613469565b8015610d4f5780601f10610d2457610100808354040283529160200191610d4f565b820191906000526020600020905b815481529060010190602001808311610d3257829003601f168201915b505050505081565b6000818152600d6020526040812054606091819003610db85760405162461bcd60e51b815260206004820152601560248201527f646f6d61696e20646f6573206e6f742065786973740000000000000000000000604482015260640161086a565b6040517f65d39e0b000000000000000000000000000000000000000000000000000000008152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906365d39e0b90602401600060405180830381865afa158015610e39573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e61919081019061355a565b6000858152600a6020526040812080549293509091610e7f90613469565b80601f0160208091040260200160405190810160405280929190818152602001828054610eab90613469565b8015610ef85780601f10610ecd57610100808354040283529160200191610ef8565b820191906000526020600020905b815481529060010190602001808311610edb57829003601f168201915b505050505090508082604051602001610f129291906135d1565b6040516020818303038152906040529350505050919050565b600e546001600160a01b03163314610f855760405162461bcd60e51b815260206004820152600e60248201527f6e6f7420617574686f7269736564000000000000000000000000000000000000604482015260640161086a565b610f8e8161226f565b6000818152600a60205260408120610fa591612e76565b6000908152600d602090815260408083208390556007909152902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60006001600160a01b0382166110665760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e65720000000000000000000000000000000000000000000000606482015260840161086a565b506001600160a01b031660009081526003602052604090205490565b61108a612322565b611094600061237c565b565b6040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810183905282907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063430c208190604401602060405180830381865afa15801561111c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111409190613629565b61118c5760405162461bcd60e51b815260206004820152600e60248201527f6e6f7420617574686f7269736564000000000000000000000000000000000000604482015260640161086a565b600a8211156111dd5760405162461bcd60e51b815260206004820152601a60248201527f313025206d6178696d756d20726f79616c7479206f6e20534c44000000000000604482015260640161086a565b6000838152600b6020526040908190208390555183907f5d5032bbdc28085a268053c7d7b778a53655fb6d4d9c98083360bf8eb4968393906109f69085815260200190565b60606001805461073090613469565b61123c3383836123e6565b5050565b611248612322565b600e80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b61128b826120ab565b156112d85760405162461bcd60e51b815260206004820152601d60248201527f63616e6e6f74207472616e73666572206578706972656420746f6b656e000000604482015260640161086a565b6112e4848484846124d2565b50505050565b6000818152600d602052604081205460609181900361134b5760405162461bcd60e51b815260206004820152601560248201527f646f6d61696e20646f6573206e6f742065786973740000000000000000000000604482015260640161086a565b6040517f65d39e0b000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906365d39e0b90602401600060405180830381865afa1580156113c9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c33919081019061355a565b6113f9612322565b600880547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6009546060906001600160a01b03166114b45760405162461bcd60e51b815260206004820152602360248201527f4d657461646174612073657276696365206973206e6f7420696d706c656d656e60448201527f7465640000000000000000000000000000000000000000000000000000000000606482015260840161086a565b6009546040517fafbb8d51000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b039091169063afbb8d5190602401600060405180830381865afa158015611516573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261071b919081019061355a565b600e546040517fc407d6c700000000000000000000000000000000000000000000000000000000815260048101839052600091829182916001600160a01b03169063c407d6c790602401606060405180830381865afa1580156115a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c99190613660565b5069ffffffffffffffffffff1691509150808269ffffffffffffffffffff166115f291906136b8565b6bffffffffffffffffffffffff16949350505050565b611610612322565b6116436001600160a01b0382167fafbb8d510000000000000000000000000000000000000000000000000000000061255a565b6116b55760405162461bcd60e51b815260206004820152602260248201527f646f6573206e6f7420696d706c656d656e7420746f6b656e557269206d65746860448201527f6f64000000000000000000000000000000000000000000000000000000000000606482015260840161086a565b600980547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b600e546001600160a01b031633146117495760405162461bcd60e51b815260206004820152600e60248201527f6e6f7420617574686f7269736564000000000000000000000000000000000000604482015260640161086a565b6040517fa4db003f00000000000000000000000000000000000000000000000000000000815260009073c4eae802bd84c01e15dd9930761a6985912b995c9063a4db003f906117a09087908790879060040161370f565b602060405180830381865af41580156117bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117e19190613729565b90506117ec816120ab565b156117fa576117fa8161226f565b6118048582612576565b6000818152600d60209081526040808320879055600a909152902061182a838583613790565b506008805460008381526007602090815260409182902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03948516179055925490519116815282917f8351f08b866373e36a5512f940b7609da3d55dfef07a9002049549d40c23a146910160405180910390a25050505050565b606085888118851883146119055760405162461bcd60e51b815260206004820152601b60248201527f6172726179206c656e677468732061726520646966666572656e740000000000604482015260640161086a565b60008167ffffffffffffffff811115611920576119206130b8565b60405190808252806020026020018201604052801561198357816020015b6119706040518060a0016040528060008152602001600081526020016060815260200160008152602001600081525090565b81526020019060019003908161193e5790505b5090508167ffffffffffffffff81111561199f5761199f6130b8565b604051908082528060200260200182016040528015611a0257816020015b6119ef6040518060a0016040528060008152602001600081526020016060815260200160008152602001600081525090565b8152602001906001900390816119bd5790505b50905060005b82811015611aba57611a958c8c83818110611a2557611a2561388d565b9050602002016020810190611a3a919061305f565b8b8b84818110611a4c57611a4c61388d565b905060200201358a8a85818110611a6557611a6561388d565b9050602002810190611a7791906138bc565b8a8a87818110611a8957611a8961388d565b905060200201356126d0565b828281518110611aa757611aa761388d565b6020908102919091010152600101611a08565b509a9950505050505050505050565b611ad1612322565b6001600160a01b038116611b4d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161086a565b611b568161237c565b50565b6040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810183905282907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063430c208190604401602060405180830381865afa158015611bdf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c039190613629565b611c4f5760405162461bcd60e51b815260206004820152600e60248201527f6e6f7420617574686f7269736564000000000000000000000000000000000000604482015260640161086a565b6001600160a01b038216611ca55760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f742073657420746f207a65726f2061646472657373000000000000604482015260640161086a565b6000838152600c602052604080822090517f6352211e000000000000000000000000000000000000000000000000000000008152600481018690528492907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611d34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d5891906134bc565b6001600160a01b039081168252602080830193909352604091820160002080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169482169490941790935551918416825284917f33a4c2d58716fff2a09d132f60be73bcaefd65302212a57e798693dd510f729091016109f6565b6040517febe0db6e000000000000000000000000000000000000000000000000000000008152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ebe0db6e90602401602060405180830381865afa158015611e55573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071b91906134bc565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd000000000000000000000000000000000000000000000000000000001480611f0c57507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061071b57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461071b565b6000818152600260205260409020546001600160a01b0316611b565760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161086a565b6000818152600260205260408120546001600160a01b03168061071b5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161086a565b600081815260046020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038416908117909155819061207282611fc0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03161561219257600e546040517fc407d6c70000000000000000000000000000000000000000000000000000000081526004810184905260009182916001600160a01b039091169063c407d6c790602401606060405180830381865afa15801561212f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121539190613660565b5069ffffffffffffffffffff169150915042818369ffffffffffffffffffff1661217d91906136b8565b6bffffffffffffffffffffffff161115925050505b919050565b6121a1338261289b565b6122135760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f766564000000000000000000000000000000000000606482015260840161086a565b61092983838361293e565b61092983838360405180602001604052806000815250611282565b6000610c33838361289b565b6000818152600260205260408120546001600160a01b0316151561071b565b600061071b82611fc0565b600061227a82611fc0565b9050612287600083612025565b6001600160a01b03811660009081526003602052604081208054600192906122b0908490613921565b909155505060008281526002602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6006546001600160a01b031633146110945760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086a565b600680546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316036124475760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161086a565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6124dc338361289b565b61254e5760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f766564000000000000000000000000000000000000606482015260840161086a565b6112e484848484612b23565b600061256583612bac565b8015610c335750610c338383612c05565b6001600160a01b0382166125cc5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161086a565b6000818152600260205260409020546001600160a01b0316156126315760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161086a565b6001600160a01b038216600090815260036020526040812080546001929061265a908490613934565b909155505060008181526002602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6127026040518060a0016040528060008152602001600081526020016060815260200160008152602001600081525090565b84600061270e82611dd4565b90506000816001600160a01b031663a4ebb10b8a858a8a8a60006040518763ffffffff1660e01b815260040161274996959493929190613947565b602060405180830381865afa158015612766573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061278a9190613729565b6000848152600b602052604080822054815160a08101928390527fa4db003f000000000000000000000000000000000000000000000000000000009092529293508073c4eae802bd84c01e15dd9930761a6985912b995c63a4db003f6127f5898e8e60a4870161370f565b602060405180830381865af4158015612812573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128369190613729565b60001c81526020018b81526020018a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060208101949094526040909301919091525098975050505050505050565b6000818152600260205260408120546001600160a01b0316156129365760006128c383610c5c565b9050806001600160a01b0316846001600160a01b0316148061290a57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b8061292e5750836001600160a01b0316612923846107b3565b6001600160a01b0316145b91505061071b565b50600061071b565b826001600160a01b031661295182611fc0565b6001600160a01b0316146129cd5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e6572000000000000000000000000000000000000000000000000000000606482015260840161086a565b6001600160a01b038216612a485760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161086a565b612a53600082612025565b6001600160a01b0383166000908152600360205260408120805460019290612a7c908490613921565b90915550506001600160a01b0382166000908152600360205260408120805460019290612aaa908490613934565b909155505060008181526002602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b612b2e84848461293e565b612b3a84848484612cd4565b6112e45760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161086a565b6000612bd8827f01ffc9a700000000000000000000000000000000000000000000000000000000612c05565b801561071b5750610c55827fffffffff000000000000000000000000000000000000000000000000000000005b604080517fffffffff000000000000000000000000000000000000000000000000000000008316602480830191909152825180830390910181526044909101909152602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a700000000000000000000000000000000000000000000000000000000178152825160009392849283928392918391908a617530fa92503d91506000519050828015612cbd575060208210155b8015612cc95750600081115b979650505050505050565b60006001600160a01b0384163b15612e6a576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063150b7a0290612d3190339089908890889060040161398a565b6020604051808303816000875af1925050508015612d6c575060408051601f3d908101601f19168201909252612d69918101906139c6565b60015b612e1f573d808015612d9a576040519150601f19603f3d011682016040523d82523d6000602084013e612d9f565b606091505b508051600003612e175760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161086a565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a0200000000000000000000000000000000000000000000000000000000149050612e6e565b5060015b949350505050565b508054612e8290613469565b6000825580601f10612e92575050565b601f016020900490600052602060002090810190611b5691905b80821115612ec05760008155600101612eac565b5090565b7fffffffff0000000000000000000000000000000000000000000000000000000081168114611b5657600080fd5b600060208284031215612f0457600080fd5b8135610c3381612ec4565b60005b83811015612f2a578181015183820152602001612f12565b50506000910152565b60008151808452612f4b816020860160208601612f0f565b601f01601f19169290920160200192915050565b602081526000610c336020830184612f33565b600060208284031215612f8457600080fd5b5035919050565b6001600160a01b0381168114611b5657600080fd5b60008060408385031215612fb357600080fd5b8235612fbe81612f8b565b946020939093013593505050565b60008060408385031215612fdf57600080fd5b823591506020830135612ff181612f8b565b809150509250929050565b60008060006060848603121561301157600080fd5b833561301c81612f8b565b9250602084013561302c81612f8b565b929592945050506040919091013590565b6000806040838503121561305057600080fd5b50508035926020909101359150565b60006020828403121561307157600080fd5b8135610c3381612f8b565b8015158114611b5657600080fd5b6000806040838503121561309d57600080fd5b82356130a881612f8b565b91506020830135612ff18161307c565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613110576131106130b8565b604052919050565b600067ffffffffffffffff821115613132576131326130b8565b50601f01601f191660200190565b6000806000806080858703121561315657600080fd5b843561316181612f8b565b9350602085013561317181612f8b565b925060408501359150606085013567ffffffffffffffff81111561319457600080fd5b8501601f810187136131a557600080fd5b80356131b86131b382613118565b6130e7565b8181528860208385010111156131cd57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6000806040838503121561320257600080fd5b823561320d81612f8b565b91506020830135612ff181612f8b565b6000806000806060858703121561323357600080fd5b843561323e81612f8b565b935060208501359250604085013567ffffffffffffffff8082111561326257600080fd5b818701915087601f83011261327657600080fd5b81358181111561328557600080fd5b88602082850101111561329757600080fd5b95989497505060200194505050565b60008083601f8401126132b857600080fd5b50813567ffffffffffffffff8111156132d057600080fd5b6020830191508360208260051b85010111156132eb57600080fd5b9250929050565b6000806000806000806000806080898b03121561330e57600080fd5b883567ffffffffffffffff8082111561332657600080fd5b6133328c838d016132a6565b909a50985060208b013591508082111561334b57600080fd5b6133578c838d016132a6565b909850965060408b013591508082111561337057600080fd5b61337c8c838d016132a6565b909650945060608b013591508082111561339557600080fd5b506133a28b828c016132a6565b999c989b5096995094979396929594505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561345b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0898403018552815160a081518552888201518986015287820151818987015261343182870182612f33565b606084810151908801526080938401519390960192909252505093860193908601906001016133dd565b509098975050505050505050565b600181811c9082168061347d57607f821691505b6020821081036134b6577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b6000602082840312156134ce57600080fd5b8151610c3381612f8b565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761071b5761071b6134d9565b600082613555577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60006020828403121561356c57600080fd5b815167ffffffffffffffff81111561358357600080fd5b8201601f8101841361359457600080fd5b80516135a26131b382613118565b8181528560208385010111156135b757600080fd5b6135c8826020830160208601612f0f565b95945050505050565b600083516135e3818460208801612f0f565b7f2e00000000000000000000000000000000000000000000000000000000000000908301908152835161361d816001840160208801612f0f565b01600101949350505050565b60006020828403121561363b57600080fd5b8151610c338161307c565b805169ffffffffffffffffffff8116811461219257600080fd5b60008060006060848603121561367557600080fd5b61367e84613646565b925061368c60208501613646565b915060408401516bffffffffffffffffffffffff811681146136ad57600080fd5b809150509250925092565b6bffffffffffffffffffffffff8181168382160190808211156136dd576136dd6134d9565b5092915050565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b8381526040602082015260006135c86040830184866136e4565b60006020828403121561373b57600080fd5b5051919050565b601f82111561092957600081815260208120601f850160051c810160208610156137695750805b601f850160051c820191505b8181101561378857828155600101613775565b505050505050565b67ffffffffffffffff8311156137a8576137a86130b8565b6137bc836137b68354613469565b83613742565b6000601f84116001811461380e57600085156137d85750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b178355613886565b600083815260209020601f19861690835b8281101561383f578685013582556020948501946001909201910161381f565b508682101561387a577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126138f157600080fd5b83018035915067ffffffffffffffff82111561390c57600080fd5b6020019150368190038213156132eb57600080fd5b8181038181111561071b5761071b6134d9565b8082018082111561071b5761071b6134d9565b6001600160a01b038716815285602082015260a06040820152600061397060a0830186886136e4565b606083019490945250901515608090910152949350505050565b60006001600160a01b038087168352808616602084015250836040830152608060608301526139bc6080830184612f33565b9695505050505050565b6000602082840312156139d857600080fd5b8151610c3381612ec456fea2646970667358221220d29f52c639a054fd3be457456e61ec17e8813d680bca29b8fd671caa335580e264736f6c6343000811003300000000000000000000000001ebcf32e4b5da0167eaacea1050b2be63122b6f

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102d35760003560e01c80637eda417511610186578063c3d5fdf1116100e3578063e985e9c511610097578063f2fde38b11610071578063f2fde38b1461068b578063f6aea5b71461069e578063f8559dc7146106b157600080fd5b8063e985e9c51461061c578063eae12cb614610658578063f18daeb91461066b57600080fd5b8063c87b56dd116100c8578063c87b56dd146105e3578063d2ec5fca146105f6578063e5187f431461060957600080fd5b8063c3d5fdf1146105bd578063c66485b2146105d057600080fd5b80639a6c67e91161013a578063adaa0acc1161011f578063adaa0acc14610584578063b88d4fde14610597578063be6d17cd146105aa57600080fd5b80639a6c67e914610551578063a22cb4651461057157600080fd5b806384f7d0121161016b57806384f7d0121461050f5780638da5cb5b1461053857806395d89b411461054957600080fd5b80637eda4175146104c8578063828eab0e146104fc57600080fd5b8063430c208111610234578063691f3431116101e857806370a08231116101cd57806370a082311461049a578063715018a6146104ad5780637b831505146104b557600080fd5b8063691f343114610474578063708e83321461048757600080fd5b80634f558e79116102195780634f558e791461043b5780636352211e1461044e57806365d39e0b1461046157600080fd5b8063430c20811461040157806343ee0c011461041457600080fd5b80631896f70a1161028b5780632a55205a116102705780632a55205a146103a9578063392f37e9146103db57806342842e0e146103ee57600080fd5b80631896f70a1461038357806323b872dd1461039657600080fd5b8063081812fc116102bc578063081812fc14610315578063095ea7b3146103405780630dd64ae21461035557600080fd5b806301ffc9a7146102d857806306fdde0314610300575b600080fd5b6102eb6102e6366004612ef2565b6106c4565b60405190151581526020015b60405180910390f35b610308610721565b6040516102f79190612f5f565b610328610323366004612f72565b6107b3565b6040516001600160a01b0390911681526020016102f7565b61035361034e366004612fa0565b6107da565b005b610375610363366004612f72565b600b6020526000908152604090205481565b6040519081526020016102f7565b610353610391366004612fcc565b61092e565b6103536103a4366004612ffc565b610a03565b6103bc6103b736600461303d565b610a64565b604080516001600160a01b0390931683526020830191909152016102f7565b600954610328906001600160a01b031681565b6103536103fc366004612ffc565b610bc6565b6102eb61040f366004612fa0565b610c27565b6103287f00000000000000000000000001ebcf32e4b5da0167eaacea1050b2be63122b6f81565b6102eb610449366004612f72565b610c3a565b61032861045c366004612f72565b610c5c565b61030861046f366004612f72565b610cbd565b610308610482366004612f72565b610d57565b610353610495366004612f72565b610f2b565b6103756104a836600461305f565b610fe8565b610353611082565b6103536104c336600461303d565b611096565b6103286104d6366004612fcc565b600c6020908152600092835260408084209091529082529020546001600160a01b031681565b600854610328906001600160a01b031681565b61032861051d366004612f72565b6007602052600090815260409020546001600160a01b031681565b6006546001600160a01b0316610328565b610308611222565b61037561055f366004612f72565b600d6020526000908152604090205481565b61035361057f36600461308a565b611231565b61035361059236600461305f565b611240565b6103536105a5366004613140565b611282565b6103086105b8366004612f72565b6112ea565b600e54610328906001600160a01b031681565b6103536105de36600461305f565b6113f1565b6103086105f1366004612f72565b611433565b610375610604366004612f72565b61153e565b61035361061736600461305f565b611608565b6102eb61062a3660046131ef565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61035361066636600461321d565b6116ef565b61067e6106793660046132f2565b6118af565b6040516102f791906133b6565b61035361069936600461305f565b611ac9565b6103536106ac366004612fcc565b611b59565b6103286106bf366004612f72565b611dd4565b60006106cf82611e79565b8061071b57507fffffffff0000000000000000000000000000000000000000000000000000000082167fc87b56dd00000000000000000000000000000000000000000000000000000000145b92915050565b60606000805461073090613469565b80601f016020809104026020016040519081016040528092919081815260200182805461075c90613469565b80156107a95780601f1061077e576101008083540402835291602001916107a9565b820191906000526020600020905b81548152906001019060200180831161078c57829003601f168201915b5050505050905090565b60006107be82611f5c565b506000908152600460205260409020546001600160a01b031690565b60006107e582611fc0565b9050806001600160a01b0316836001600160a01b0316036108735760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b03821614806108ad57506001600160a01b038116600090815260056020908152604080832033845290915290205460ff165b61091f5760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161086a565b6109298383612025565b505050565b816109393382610c27565b6109855760405162461bcd60e51b815260206004820152601560248201527f6e6f7420617070726f766564206f72206f776e65720000000000000000000000604482015260640161086a565b60008381526007602090815260409182902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038616908117909155915191825284917f8351f08b866373e36a5512f940b7609da3d55dfef07a9002049549d40c23a14691015b60405180910390a2505050565b610a0c816120ab565b15610a595760405162461bcd60e51b815260206004820152601d60248201527f63616e6e6f74207472616e73666572206578706972656420746f6b656e000000604482015260640161086a565b610929838383612197565b6000828152600d60205260408082205490517f6352211e00000000000000000000000000000000000000000000000000000000815260048101829052829190819083907f00000000000000000000000001ebcf32e4b5da0167eaacea1050b2be63122b6f6001600160a01b031690636352211e90602401602060405180830381865afa158015610af8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1c91906134bc565b6000848152600c602090815260408083206001600160a01b0380861685529252909120549192501615610b73576000838152600c602090815260408083206001600160a01b03808616855292529091205416610b75565b805b6000848152600b602052604090205490955015610bb7576000838152600b6020526040902054606490610ba89088613508565b610bb2919061351f565b610bba565b60005b93505050509250929050565b610bcf816120ab565b15610c1c5760405162461bcd60e51b815260206004820152601d60248201527f63616e6e6f74207472616e73666572206578706972656420746f6b656e000000604482015260640161086a565b61092983838361221e565b6000610c338383612239565b9392505050565b6000610c4582612245565b801561071b5750610c55826120ab565b1592915050565b6000610c67826120ab565b15610cb45760405162461bcd60e51b815260206004820152600b60248201527f736c642065787069726564000000000000000000000000000000000000000000604482015260640161086a565b61071b82612264565b600a6020526000908152604090208054610cd690613469565b80601f0160208091040260200160405190810160405280929190818152602001828054610d0290613469565b8015610d4f5780601f10610d2457610100808354040283529160200191610d4f565b820191906000526020600020905b815481529060010190602001808311610d3257829003601f168201915b505050505081565b6000818152600d6020526040812054606091819003610db85760405162461bcd60e51b815260206004820152601560248201527f646f6d61696e20646f6573206e6f742065786973740000000000000000000000604482015260640161086a565b6040517f65d39e0b000000000000000000000000000000000000000000000000000000008152600481018290526000907f00000000000000000000000001ebcf32e4b5da0167eaacea1050b2be63122b6f6001600160a01b0316906365d39e0b90602401600060405180830381865afa158015610e39573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e61919081019061355a565b6000858152600a6020526040812080549293509091610e7f90613469565b80601f0160208091040260200160405190810160405280929190818152602001828054610eab90613469565b8015610ef85780601f10610ecd57610100808354040283529160200191610ef8565b820191906000526020600020905b815481529060010190602001808311610edb57829003601f168201915b505050505090508082604051602001610f129291906135d1565b6040516020818303038152906040529350505050919050565b600e546001600160a01b03163314610f855760405162461bcd60e51b815260206004820152600e60248201527f6e6f7420617574686f7269736564000000000000000000000000000000000000604482015260640161086a565b610f8e8161226f565b6000818152600a60205260408120610fa591612e76565b6000908152600d602090815260408083208390556007909152902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60006001600160a01b0382166110665760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e65720000000000000000000000000000000000000000000000606482015260840161086a565b506001600160a01b031660009081526003602052604090205490565b61108a612322565b611094600061237c565b565b6040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810183905282907f00000000000000000000000001ebcf32e4b5da0167eaacea1050b2be63122b6f6001600160a01b03169063430c208190604401602060405180830381865afa15801561111c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111409190613629565b61118c5760405162461bcd60e51b815260206004820152600e60248201527f6e6f7420617574686f7269736564000000000000000000000000000000000000604482015260640161086a565b600a8211156111dd5760405162461bcd60e51b815260206004820152601a60248201527f313025206d6178696d756d20726f79616c7479206f6e20534c44000000000000604482015260640161086a565b6000838152600b6020526040908190208390555183907f5d5032bbdc28085a268053c7d7b778a53655fb6d4d9c98083360bf8eb4968393906109f69085815260200190565b60606001805461073090613469565b61123c3383836123e6565b5050565b611248612322565b600e80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b61128b826120ab565b156112d85760405162461bcd60e51b815260206004820152601d60248201527f63616e6e6f74207472616e73666572206578706972656420746f6b656e000000604482015260640161086a565b6112e4848484846124d2565b50505050565b6000818152600d602052604081205460609181900361134b5760405162461bcd60e51b815260206004820152601560248201527f646f6d61696e20646f6573206e6f742065786973740000000000000000000000604482015260640161086a565b6040517f65d39e0b000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000001ebcf32e4b5da0167eaacea1050b2be63122b6f6001600160a01b0316906365d39e0b90602401600060405180830381865afa1580156113c9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c33919081019061355a565b6113f9612322565b600880547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6009546060906001600160a01b03166114b45760405162461bcd60e51b815260206004820152602360248201527f4d657461646174612073657276696365206973206e6f7420696d706c656d656e60448201527f7465640000000000000000000000000000000000000000000000000000000000606482015260840161086a565b6009546040517fafbb8d51000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b039091169063afbb8d5190602401600060405180830381865afa158015611516573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261071b919081019061355a565b600e546040517fc407d6c700000000000000000000000000000000000000000000000000000000815260048101839052600091829182916001600160a01b03169063c407d6c790602401606060405180830381865afa1580156115a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c99190613660565b5069ffffffffffffffffffff1691509150808269ffffffffffffffffffff166115f291906136b8565b6bffffffffffffffffffffffff16949350505050565b611610612322565b6116436001600160a01b0382167fafbb8d510000000000000000000000000000000000000000000000000000000061255a565b6116b55760405162461bcd60e51b815260206004820152602260248201527f646f6573206e6f7420696d706c656d656e7420746f6b656e557269206d65746860448201527f6f64000000000000000000000000000000000000000000000000000000000000606482015260840161086a565b600980547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b600e546001600160a01b031633146117495760405162461bcd60e51b815260206004820152600e60248201527f6e6f7420617574686f7269736564000000000000000000000000000000000000604482015260640161086a565b6040517fa4db003f00000000000000000000000000000000000000000000000000000000815260009073c4eae802bd84c01e15dd9930761a6985912b995c9063a4db003f906117a09087908790879060040161370f565b602060405180830381865af41580156117bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117e19190613729565b90506117ec816120ab565b156117fa576117fa8161226f565b6118048582612576565b6000818152600d60209081526040808320879055600a909152902061182a838583613790565b506008805460008381526007602090815260409182902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03948516179055925490519116815282917f8351f08b866373e36a5512f940b7609da3d55dfef07a9002049549d40c23a146910160405180910390a25050505050565b606085888118851883146119055760405162461bcd60e51b815260206004820152601b60248201527f6172726179206c656e677468732061726520646966666572656e740000000000604482015260640161086a565b60008167ffffffffffffffff811115611920576119206130b8565b60405190808252806020026020018201604052801561198357816020015b6119706040518060a0016040528060008152602001600081526020016060815260200160008152602001600081525090565b81526020019060019003908161193e5790505b5090508167ffffffffffffffff81111561199f5761199f6130b8565b604051908082528060200260200182016040528015611a0257816020015b6119ef6040518060a0016040528060008152602001600081526020016060815260200160008152602001600081525090565b8152602001906001900390816119bd5790505b50905060005b82811015611aba57611a958c8c83818110611a2557611a2561388d565b9050602002016020810190611a3a919061305f565b8b8b84818110611a4c57611a4c61388d565b905060200201358a8a85818110611a6557611a6561388d565b9050602002810190611a7791906138bc565b8a8a87818110611a8957611a8961388d565b905060200201356126d0565b828281518110611aa757611aa761388d565b6020908102919091010152600101611a08565b509a9950505050505050505050565b611ad1612322565b6001600160a01b038116611b4d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161086a565b611b568161237c565b50565b6040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810183905282907f00000000000000000000000001ebcf32e4b5da0167eaacea1050b2be63122b6f6001600160a01b03169063430c208190604401602060405180830381865afa158015611bdf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c039190613629565b611c4f5760405162461bcd60e51b815260206004820152600e60248201527f6e6f7420617574686f7269736564000000000000000000000000000000000000604482015260640161086a565b6001600160a01b038216611ca55760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f742073657420746f207a65726f2061646472657373000000000000604482015260640161086a565b6000838152600c602052604080822090517f6352211e000000000000000000000000000000000000000000000000000000008152600481018690528492907f00000000000000000000000001ebcf32e4b5da0167eaacea1050b2be63122b6f6001600160a01b031690636352211e90602401602060405180830381865afa158015611d34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d5891906134bc565b6001600160a01b039081168252602080830193909352604091820160002080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169482169490941790935551918416825284917f33a4c2d58716fff2a09d132f60be73bcaefd65302212a57e798693dd510f729091016109f6565b6040517febe0db6e000000000000000000000000000000000000000000000000000000008152600481018290526000907f00000000000000000000000001ebcf32e4b5da0167eaacea1050b2be63122b6f6001600160a01b03169063ebe0db6e90602401602060405180830381865afa158015611e55573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071b91906134bc565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd000000000000000000000000000000000000000000000000000000001480611f0c57507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061071b57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461071b565b6000818152600260205260409020546001600160a01b0316611b565760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161086a565b6000818152600260205260408120546001600160a01b03168061071b5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161086a565b600081815260046020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038416908117909155819061207282611fc0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03161561219257600e546040517fc407d6c70000000000000000000000000000000000000000000000000000000081526004810184905260009182916001600160a01b039091169063c407d6c790602401606060405180830381865afa15801561212f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121539190613660565b5069ffffffffffffffffffff169150915042818369ffffffffffffffffffff1661217d91906136b8565b6bffffffffffffffffffffffff161115925050505b919050565b6121a1338261289b565b6122135760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f766564000000000000000000000000000000000000606482015260840161086a565b61092983838361293e565b61092983838360405180602001604052806000815250611282565b6000610c33838361289b565b6000818152600260205260408120546001600160a01b0316151561071b565b600061071b82611fc0565b600061227a82611fc0565b9050612287600083612025565b6001600160a01b03811660009081526003602052604081208054600192906122b0908490613921565b909155505060008281526002602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6006546001600160a01b031633146110945760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086a565b600680546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316036124475760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161086a565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6124dc338361289b565b61254e5760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f766564000000000000000000000000000000000000606482015260840161086a565b6112e484848484612b23565b600061256583612bac565b8015610c335750610c338383612c05565b6001600160a01b0382166125cc5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161086a565b6000818152600260205260409020546001600160a01b0316156126315760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161086a565b6001600160a01b038216600090815260036020526040812080546001929061265a908490613934565b909155505060008181526002602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6127026040518060a0016040528060008152602001600081526020016060815260200160008152602001600081525090565b84600061270e82611dd4565b90506000816001600160a01b031663a4ebb10b8a858a8a8a60006040518763ffffffff1660e01b815260040161274996959493929190613947565b602060405180830381865afa158015612766573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061278a9190613729565b6000848152600b602052604080822054815160a08101928390527fa4db003f000000000000000000000000000000000000000000000000000000009092529293508073c4eae802bd84c01e15dd9930761a6985912b995c63a4db003f6127f5898e8e60a4870161370f565b602060405180830381865af4158015612812573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128369190613729565b60001c81526020018b81526020018a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060208101949094526040909301919091525098975050505050505050565b6000818152600260205260408120546001600160a01b0316156129365760006128c383610c5c565b9050806001600160a01b0316846001600160a01b0316148061290a57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b8061292e5750836001600160a01b0316612923846107b3565b6001600160a01b0316145b91505061071b565b50600061071b565b826001600160a01b031661295182611fc0565b6001600160a01b0316146129cd5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e6572000000000000000000000000000000000000000000000000000000606482015260840161086a565b6001600160a01b038216612a485760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161086a565b612a53600082612025565b6001600160a01b0383166000908152600360205260408120805460019290612a7c908490613921565b90915550506001600160a01b0382166000908152600360205260408120805460019290612aaa908490613934565b909155505060008181526002602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b612b2e84848461293e565b612b3a84848484612cd4565b6112e45760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161086a565b6000612bd8827f01ffc9a700000000000000000000000000000000000000000000000000000000612c05565b801561071b5750610c55827fffffffff000000000000000000000000000000000000000000000000000000005b604080517fffffffff000000000000000000000000000000000000000000000000000000008316602480830191909152825180830390910181526044909101909152602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a700000000000000000000000000000000000000000000000000000000178152825160009392849283928392918391908a617530fa92503d91506000519050828015612cbd575060208210155b8015612cc95750600081115b979650505050505050565b60006001600160a01b0384163b15612e6a576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063150b7a0290612d3190339089908890889060040161398a565b6020604051808303816000875af1925050508015612d6c575060408051601f3d908101601f19168201909252612d69918101906139c6565b60015b612e1f573d808015612d9a576040519150601f19603f3d011682016040523d82523d6000602084013e612d9f565b606091505b508051600003612e175760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161086a565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a0200000000000000000000000000000000000000000000000000000000149050612e6e565b5060015b949350505050565b508054612e8290613469565b6000825580601f10612e92575050565b601f016020900490600052602060002090810190611b5691905b80821115612ec05760008155600101612eac565b5090565b7fffffffff0000000000000000000000000000000000000000000000000000000081168114611b5657600080fd5b600060208284031215612f0457600080fd5b8135610c3381612ec4565b60005b83811015612f2a578181015183820152602001612f12565b50506000910152565b60008151808452612f4b816020860160208601612f0f565b601f01601f19169290920160200192915050565b602081526000610c336020830184612f33565b600060208284031215612f8457600080fd5b5035919050565b6001600160a01b0381168114611b5657600080fd5b60008060408385031215612fb357600080fd5b8235612fbe81612f8b565b946020939093013593505050565b60008060408385031215612fdf57600080fd5b823591506020830135612ff181612f8b565b809150509250929050565b60008060006060848603121561301157600080fd5b833561301c81612f8b565b9250602084013561302c81612f8b565b929592945050506040919091013590565b6000806040838503121561305057600080fd5b50508035926020909101359150565b60006020828403121561307157600080fd5b8135610c3381612f8b565b8015158114611b5657600080fd5b6000806040838503121561309d57600080fd5b82356130a881612f8b565b91506020830135612ff18161307c565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613110576131106130b8565b604052919050565b600067ffffffffffffffff821115613132576131326130b8565b50601f01601f191660200190565b6000806000806080858703121561315657600080fd5b843561316181612f8b565b9350602085013561317181612f8b565b925060408501359150606085013567ffffffffffffffff81111561319457600080fd5b8501601f810187136131a557600080fd5b80356131b86131b382613118565b6130e7565b8181528860208385010111156131cd57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6000806040838503121561320257600080fd5b823561320d81612f8b565b91506020830135612ff181612f8b565b6000806000806060858703121561323357600080fd5b843561323e81612f8b565b935060208501359250604085013567ffffffffffffffff8082111561326257600080fd5b818701915087601f83011261327657600080fd5b81358181111561328557600080fd5b88602082850101111561329757600080fd5b95989497505060200194505050565b60008083601f8401126132b857600080fd5b50813567ffffffffffffffff8111156132d057600080fd5b6020830191508360208260051b85010111156132eb57600080fd5b9250929050565b6000806000806000806000806080898b03121561330e57600080fd5b883567ffffffffffffffff8082111561332657600080fd5b6133328c838d016132a6565b909a50985060208b013591508082111561334b57600080fd5b6133578c838d016132a6565b909850965060408b013591508082111561337057600080fd5b61337c8c838d016132a6565b909650945060608b013591508082111561339557600080fd5b506133a28b828c016132a6565b999c989b5096995094979396929594505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561345b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0898403018552815160a081518552888201518986015287820151818987015261343182870182612f33565b606084810151908801526080938401519390960192909252505093860193908601906001016133dd565b509098975050505050505050565b600181811c9082168061347d57607f821691505b6020821081036134b6577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b6000602082840312156134ce57600080fd5b8151610c3381612f8b565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761071b5761071b6134d9565b600082613555577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60006020828403121561356c57600080fd5b815167ffffffffffffffff81111561358357600080fd5b8201601f8101841361359457600080fd5b80516135a26131b382613118565b8181528560208385010111156135b757600080fd5b6135c8826020830160208601612f0f565b95945050505050565b600083516135e3818460208801612f0f565b7f2e00000000000000000000000000000000000000000000000000000000000000908301908152835161361d816001840160208801612f0f565b01600101949350505050565b60006020828403121561363b57600080fd5b8151610c338161307c565b805169ffffffffffffffffffff8116811461219257600080fd5b60008060006060848603121561367557600080fd5b61367e84613646565b925061368c60208501613646565b915060408401516bffffffffffffffffffffffff811681146136ad57600080fd5b809150509250925092565b6bffffffffffffffffffffffff8181168382160190808211156136dd576136dd6134d9565b5092915050565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b8381526040602082015260006135c86040830184866136e4565b60006020828403121561373b57600080fd5b5051919050565b601f82111561092957600081815260208120601f850160051c810160208610156137695750805b601f850160051c820191505b8181101561378857828155600101613775565b505050505050565b67ffffffffffffffff8311156137a8576137a86130b8565b6137bc836137b68354613469565b83613742565b6000601f84116001811461380e57600085156137d85750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b178355613886565b600083815260209020601f19861690835b8281101561383f578685013582556020948501946001909201910161381f565b508682101561387a577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126138f157600080fd5b83018035915067ffffffffffffffff82111561390c57600080fd5b6020019150368190038213156132eb57600080fd5b8181038181111561071b5761071b6134d9565b8082018082111561071b5761071b6134d9565b6001600160a01b038716815285602082015260a06040820152600061397060a0830186886136e4565b606083019490945250901515608090910152949350505050565b60006001600160a01b038087168352808616602084015250836040830152608060608301526139bc6080830184612f33565b9695505050505050565b6000602082840312156139d857600080fd5b8151610c3381612ec456fea2646970667358221220d29f52c639a054fd3be457456e61ec17e8813d680bca29b8fd671caa335580e264736f6c63430008110033

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

00000000000000000000000001ebcf32e4b5da0167eaacea1050b2be63122b6f

-----Decoded View---------------
Arg [0] : _tld (address): 0x01eBCf32e4b5da0167eaacEA1050B2be63122B6f

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000001ebcf32e4b5da0167eaacea1050b2be63122b6f


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading

OVERVIEW

hns.id wraps Handshake domains and tokenizes them on the Optimism blockchain, enabling decentralized ownership, trading, and integration with EVM-compatible applications.

Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.