ETH Price: $2,005.73 (-0.24%)

Contract

0x5212224D065d427ad2C2294462c3C51753365A1A
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Approve Registra...166789022023-02-21 19:17:59765 days ago1677007079IN
0x5212224D...753365A1A
0 ETH0.0019034331.23560567
Withdraw159760342022-11-15 14:28:47863 days ago1668522527IN
0x5212224D...753365A1A
0 ETH0.0005420316.5556498
Claim158582092022-10-30 3:32:35879 days ago1667100755IN
0x5212224D...753365A1A
0.06491298 ETH0.001422987.76411023
Lock With Proof158492762022-10-28 21:33:59880 days ago1666992839IN
0x5212224D...753365A1A
0 ETH0.0023256529.00575903
Lock With Proof158480392022-10-28 17:25:35881 days ago1666977935IN
0x5212224D...753365A1A
0 ETH0.0028500735.55706852
Lock With Proof158439892022-10-28 3:51:47881 days ago1666929107IN
0x5212224D...753365A1A
0 ETH0.0008192910.21829797
Claim158407152022-10-27 16:50:47882 days ago1666889447IN
0x5212224D...753365A1A
0.06796593 ETH0.0035416619.33465152
Claim158401352022-10-27 14:53:59882 days ago1666882439IN
0x5212224D...753365A1A
0.06762009 ETH0.0039082621.33273144
Lock With Proof158378562022-10-27 7:15:35882 days ago1666854935IN
0x5212224D...753365A1A
0 ETH0.0009757712.1730064
Claim158331492022-10-26 15:29:23883 days ago1666798163IN
0x5212224D...753365A1A
0.06649939 ETH0.005492329.97571936
Claim158300712022-10-26 5:11:11883 days ago1666761071IN
0x5212224D...753365A1A
0.07077188 ETH0.0021997912.01124634
Claim158158302022-10-24 5:18:47885 days ago1666588727IN
0x5212224D...753365A1A
0.07796818 ETH0.0023494612.82870665
Lock With Proof158091232022-10-23 6:49:11886 days ago1666507751IN
0x5212224D...753365A1A
0 ETH0.0010150812.66345109
Lock With Proof158069212022-10-22 23:26:47886 days ago1666481207IN
0x5212224D...753365A1A
0 ETH0.0011305914.10868967
Claim158060262022-10-22 20:26:23887 days ago1666470383IN
0x5212224D...753365A1A
0.07992926 ETH0.0032818517.91945616
Claim157923922022-10-20 22:47:35888 days ago1666306055IN
0x5212224D...753365A1A
0.08201664 ETH0.0051219627.95269412
Claim157913652022-10-20 19:21:23889 days ago1666293683IN
0x5212224D...753365A1A
0.08159712 ETH0.0057597531.42719038
Lock With Proof157887592022-10-20 10:37:23889 days ago1666262243IN
0x5212224D...753365A1A
0 ETH0.0015795619.70050141
Claim157860292022-10-20 1:28:35889 days ago1666229315IN
0x5212224D...753365A1A
0.08228257 ETH0.0039078521.33375306
Claim157731602022-10-18 6:19:59891 days ago1666073999IN
0x5212224D...753365A1A
0.07868707 ETH0.0023261112.70009047
Claim157692862022-10-17 17:22:23892 days ago1666027343IN
0x5212224D...753365A1A
0.07948445 ETH0.0053675829.3046506
Claim157489482022-10-14 21:10:47894 days ago1665781847IN
0x5212224D...753365A1A
0.08066421 ETH0.0031372517.11868982
Claim157410792022-10-13 18:47:59896 days ago1665686879IN
0x5212224D...753365A1A
0.08227808 ETH0.0035057719.13705653
Claim157406982022-10-13 17:30:59896 days ago1665682259IN
0x5212224D...753365A1A
0.08246629 ETH0.0056595530.89798103
Claim157136352022-10-09 22:51:11899 days ago1665355871IN
0x5212224D...753365A1A
0.07943893 ETH0.005526930.17179867
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
From
To
Transfer159760342022-11-15 14:28:47863 days ago1668522527
0x5212224D...753365A1A
3.55628781 ETH
Transfer158582092022-10-30 3:32:35879 days ago1667100755
0x5212224D...753365A1A
0.00309109 ETH
Transfer158407152022-10-27 16:50:47882 days ago1666889447
0x5212224D...753365A1A
0.00323647 ETH
Transfer158401352022-10-27 14:53:59882 days ago1666882439
0x5212224D...753365A1A
0.00322 ETH
Transfer158331492022-10-26 15:29:23883 days ago1666798163
0x5212224D...753365A1A
0.00316663 ETH
Transfer158300712022-10-26 5:11:11883 days ago1666761071
0x5212224D...753365A1A
0.00337008 ETH
Transfer158158302022-10-24 5:18:47885 days ago1666588727
0x5212224D...753365A1A
0.00371277 ETH
Transfer158060262022-10-22 20:26:23887 days ago1666470383
0x5212224D...753365A1A
0.00380615 ETH
Transfer157923922022-10-20 22:47:35888 days ago1666306055
0x5212224D...753365A1A
0.00390555 ETH
Transfer157913652022-10-20 19:21:23889 days ago1666293683
0x5212224D...753365A1A
0.00388557 ETH
Transfer157860292022-10-20 1:28:35889 days ago1666229315
0x5212224D...753365A1A
0.00391821 ETH
Transfer157731602022-10-18 6:19:59891 days ago1666073999
0x5212224D...753365A1A
0.003747 ETH
Transfer157692862022-10-17 17:22:23892 days ago1666027343
0x5212224D...753365A1A
0.00378497 ETH
Transfer157489482022-10-14 21:10:47894 days ago1665781847
0x5212224D...753365A1A
0.00384115 ETH
Transfer157410792022-10-13 18:47:59896 days ago1665686879
0x5212224D...753365A1A
0.003918 ETH
Transfer157406982022-10-13 17:30:59896 days ago1665682259
0x5212224D...753365A1A
0.00392696 ETH
Transfer157136352022-10-09 22:51:11899 days ago1665355871
0x5212224D...753365A1A
0.0037828 ETH
Transfer157135612022-10-09 22:36:11899 days ago1665354971
0x5212224D...753365A1A
0.0037828 ETH
Transfer157132252022-10-09 21:28:23899 days ago1665350903
0x5212224D...753365A1A
0.00378605 ETH
Transfer157046562022-10-08 16:46:11901 days ago1665247571
0x5212224D...753365A1A
0.00377364 ETH
Transfer156995832022-10-07 23:47:23901 days ago1665186443
0x5212224D...753365A1A
0.00374621 ETH
Transfer156901132022-10-06 16:00:47903 days ago1665072047
0x5212224D...753365A1A
0.00365502 ETH
Transfer156859202022-10-06 1:56:23903 days ago1665021383
0x5212224D...753365A1A
0.0036266 ETH
Transfer156398592022-09-29 15:21:23910 days ago1664464883
0x5212224D...753365A1A
0.00376683 ETH
Transfer156354092022-09-29 0:26:23910 days ago1664411183
0x5212224D...753365A1A
0.00374155 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
UniversalRootController

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion, MIT license
File 1 of 25 : UniversalRootController.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "../root/SimpleHNSOracle.sol";
import "../root/Root.sol";
import "./UniversalRegistrar.sol";
import "../common/SinglePriceOracle.sol";

contract UniversalRootController is Ownable {
    Root public root;
    UniversalRegistrar public registrar;
    SimpleHNSOracle public oracle;
    SinglePriceOracle public priceOracle;

    event NewClaim(string name, address indexed registrar, address indexed controller);

    constructor(Root _root, UniversalRegistrar _registrar, SimpleHNSOracle _oracle, SinglePriceOracle _priceOracle) {
        root = _root;
        registrar = _registrar;
        oracle = _oracle;
        priceOracle = _priceOracle;
    }

    function approveRegistrarController(address registrarController, bool approved) public onlyOwner {
        registrar.approveController(registrarController, approved);
    }

    function approveRegistrarControllerForNode(bytes32 node, address registrarController, bool approved) public onlyOwner {
        registrar.approveControllerForNode(node, registrarController, approved);
    }

    /**
     * @param name the top level name.
     * @param locked whether the TLD is locked on Handshake
     * @param expire signature expire time
     * @param signature oracle proof
     * @param controller the controller address (must be approved by registry)
     */
    function claim(string memory name, bool locked, uint256 expire, bytes memory signature, address controller) external payable {
        uint256 cost = priceOracle.price();
        require(msg.value >= cost, "insufficient funds");

        bytes32 label = keccak256(bytes(name));
        require(oracle.verify(label, address(root.ens()), msg.sender, locked, expire, signature), "bad claim");

        // Add TLD to registrar temporarily setting |this| as the owner
        bytes32 node = registrar.setSubnodeOwner(label, address(this));

        // Only owner of the node can add a controller
        // Since we own the node temporarily we can add a
        // controller.
        registrar.addController(node, controller);

        // Give ownership of TLD in the registrar back to sender
        registrar.transferNodeOwnership(node, msg.sender);

        // Add the registrar contract as the owner of this TLD in the ENS registry
        // optionally locking it (oracle must prove it's locked on handshake)
        root.setSubnodeOwner(label, address(registrar));
        if (locked) {
            root.lock(label);
        }

        emit NewClaim(name, address(registrar), address(controller));

        // Refund any extra payment
        if (msg.value > cost) {
            payable(msg.sender).transfer(msg.value - cost);
        }
    }

    // Registry can change ownership of non-locked TLDs
    function setSubnodeOwner(bytes32 label, address owner) external onlyOwner
    {
        root.setSubnodeOwner(label, owner);
    }

    // Permanently lock a name in the ENS registry with an oracle proof
    function lockWithProof(bytes32 label, address claim, uint256 expire, bytes memory signature) external {
        require(!root.locked(label), "name already locked");
        require(oracle.verify(label, address(root.ens()), claim, true, expire, signature), "bad proof");
        bytes32 node = keccak256(abi.encodePacked(bytes32(0), label));
        require(registrar.ownerOfNode(node) == msg.sender, "sender is not owner of node");
        root.lock(label);
    }

    // Permanently lock a name in the ENS registry
    function lock(bytes32 label) external onlyOwner
    {
        root.lock(label);
    }

    function withdraw() public {
        payable(owner()).transfer(address(this).balance);
    }
}

File 2 of 25 : ENS.sol
pragma solidity >=0.8.4;

interface ENS {

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

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

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

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

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

    function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual;
    function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual;
    function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external virtual returns(bytes32);
    function setResolver(bytes32 node, address resolver) external virtual;
    function setOwner(bytes32 node, address owner) external virtual;
    function setTTL(bytes32 node, uint64 ttl) external virtual;
    function setApprovalForAll(address operator, bool approved) external virtual;
    function owner(bytes32 node) external virtual view returns (address);
    function resolver(bytes32 node) external virtual view returns (address);
    function ttl(bytes32 node) external virtual view returns (uint64);
    function recordExists(bytes32 node) external virtual view returns (bool);
    function isApprovedForAll(address owner, address operator) external virtual view returns (bool);
}

File 3 of 25 : ENSRegistry.sol
pragma solidity >=0.8.4;

import "./ENS.sol";

/**
 * The ENS registry contract.
 */
contract ENSRegistry is ENS {

    struct Record {
        address owner;
        address resolver;
        uint64 ttl;
    }

    mapping (bytes32 => Record) records;
    mapping (address => mapping(address => bool)) operators;

    // Permits modifications only by the owner of the specified node.
    modifier authorised(bytes32 node) {
        address owner = records[node].owner;
        require(owner == msg.sender || operators[owner][msg.sender]);
        _;
    }

    /**
     * @dev Constructs a new ENS registrar.
     */
    constructor() public {
        records[0x0].owner = msg.sender;
    }

    /**
     * @dev Sets the record for a node.
     * @param node The node to update.
     * @param owner The address of the new owner.
     * @param resolver The address of the resolver.
     * @param ttl The TTL in seconds.
     */
    function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual override {
        setOwner(node, owner);
        _setResolverAndTTL(node, resolver, ttl);
    }

    /**
     * @dev Sets the record for a subnode.
     * @param node The parent node.
     * @param label The hash of the label specifying the subnode.
     * @param owner The address of the new owner.
     * @param resolver The address of the resolver.
     * @param ttl The TTL in seconds.
     */
    function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual override {
        bytes32 subnode = setSubnodeOwner(node, label, owner);
        _setResolverAndTTL(subnode, resolver, ttl);
    }

    /**
     * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.
     * @param node The node to transfer ownership of.
     * @param owner The address of the new owner.
     */
    function setOwner(bytes32 node, address owner) public virtual override authorised(node) {
        _setOwner(node, owner);
        emit Transfer(node, owner);
    }

    /**
     * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.
     * @param node The parent node.
     * @param label The hash of the label specifying the subnode.
     * @param owner The address of the new owner.
     */
    function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public virtual override authorised(node) returns(bytes32) {
        bytes32 subnode = keccak256(abi.encodePacked(node, label));
        _setOwner(subnode, owner);
        emit NewOwner(node, label, owner);
        return subnode;
    }

    /**
     * @dev Sets the resolver address for the specified node.
     * @param node The node to update.
     * @param resolver The address of the resolver.
     */
    function setResolver(bytes32 node, address resolver) public virtual override authorised(node) {
        emit NewResolver(node, resolver);
        records[node].resolver = resolver;
    }

    /**
     * @dev Sets the TTL for the specified node.
     * @param node The node to update.
     * @param ttl The TTL in seconds.
     */
    function setTTL(bytes32 node, uint64 ttl) public virtual override authorised(node) {
        emit NewTTL(node, ttl);
        records[node].ttl = ttl;
    }

    /**
     * @dev Enable or disable approval for a third party ("operator") to manage
     *  all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.
     * @param operator Address to add to the set of authorized operators.
     * @param approved True if the operator is approved, false to revoke approval.
     */
    function setApprovalForAll(address operator, bool approved) external virtual override {
        operators[msg.sender][operator] = approved;
        emit ApprovalForAll(msg.sender, operator, approved);
    }

    /**
     * @dev Returns the address that owns the specified node.
     * @param node The specified node.
     * @return address of the owner.
     */
    function owner(bytes32 node) public virtual override view returns (address) {
        address addr = records[node].owner;
        if (addr == address(this)) {
            return address(0x0);
        }

        return addr;
    }

    /**
     * @dev Returns the address of the resolver for the specified node.
     * @param node The specified node.
     * @return address of the resolver.
     */
    function resolver(bytes32 node) public virtual override view returns (address) {
        return records[node].resolver;
    }

    /**
     * @dev Returns the TTL of a node, and any records associated with it.
     * @param node The specified node.
     * @return ttl of the node.
     */
    function ttl(bytes32 node) public virtual override view returns (uint64) {
        return records[node].ttl;
    }

    /**
     * @dev Returns whether a record has been imported to the registry.
     * @param node The specified node.
     * @return Bool if record exists
     */
    function recordExists(bytes32 node) public virtual override view returns (bool) {
        return records[node].owner != address(0x0);
    }

    /**
     * @dev Query if an address is an authorized operator for another address.
     * @param owner The address that owns the records.
     * @param operator The address that acts on behalf of the owner.
     * @return True if `operator` is an approved operator for `owner`, false otherwise.
     */
    function isApprovedForAll(address owner, address operator) external virtual override view returns (bool) {
        return operators[owner][operator];
    }

    function _setOwner(bytes32 node, address owner) internal virtual {
        records[node].owner = owner;
    }

    function _setResolverAndTTL(bytes32 node, address resolver, uint64 ttl) internal {
        if(resolver != records[node].resolver) {
            records[node].resolver = resolver;
            emit NewResolver(node, resolver);
        }

        if(ttl != records[node].ttl) {
            records[node].ttl = ttl;
            emit NewTTL(node, ttl);
        }
    }
}

File 4 of 25 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

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

File 5 of 25 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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: balance query for the zero address");
        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: owner query for nonexistent token");
        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) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        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 owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        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: transfer caller is not 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: transfer caller is not 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) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        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 a {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 a {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 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 {
                    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 {}
}

File 6 of 25 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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 be 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 7 of 25 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 9 of 25 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

File 11 of 25 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

File 12 of 25 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 13 of 25 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 14 of 25 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 15 of 25 : IPriceOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.4;

interface IPriceOracle {
    /**
     * @dev Returns the price to register or renew a name.
     * @param name The name being registered or renewed.
     * @param expires When the name presently expires (0 if this is a new registration).
     * @param duration How long the name is being registered or extended for, in seconds.
     * @return The price of this renewal or registration, in wei.
     */
    function price(string calldata name, uint expires, uint duration) external view returns(uint);
}

File 16 of 25 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.4;

/**
 * @title SafeMath
 * @dev Unsigned math operations with safety checks that revert on error
 */
library SafeMath {
    /**
    * @dev Multiplies two unsigned integers, reverts on overflow.
    */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b);

        return c;
    }

    /**
    * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
    */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
    * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
    */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a);
        uint256 c = a - b;

        return c;
    }

    /**
    * @dev Adds two unsigned integers, reverts on overflow.
    */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a);

        return c;
    }

    /**
    * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
    * reverts when dividing by zero.
    */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b != 0);
        return a % b;
    }
}

File 17 of 25 : SinglePriceOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "./SafeMath.sol";
import "./StablePriceOracle.sol";
import "@openzeppelin/contracts/access/Ownable.sol";


// SinglePriceOracle sets a price in USD, based on an oracle.
contract SinglePriceOracle is Ownable {
    using SafeMath for *;

    //  price in attodollars (1e-18 USD).
    uint256 public usdPrice;

    // Oracle address
    AggregatorInterface public immutable usdOracle;

    event OracleChanged(address oracle);
    event PriceChanged(uint256 price);

    bytes4 private constant INTERFACE_META_ID = bytes4(keccak256("supportsInterface(bytes4)"));
    bytes4 private constant ORACLE_ID = bytes4(keccak256("price()"));

    constructor(AggregatorInterface _usdOracle, uint256 _usdPrice) {
        usdOracle = _usdOracle;
        setPrice(_usdPrice);
    }

    function price() external view returns (uint256) {
        return attoUSDToWei(usdPrice);
    }

    /**
     * @dev Sets price.
     * @param _usdPrice The price in attodollars.
     */
    function setPrice(uint256 _usdPrice) public onlyOwner {
        usdPrice = _usdPrice;
        emit PriceChanged(usdPrice);
    }

    function attoUSDToWei(uint256 amount) internal view returns (uint256) {
        uint256 ethPrice = uint256(usdOracle.latestAnswer());
        return amount.mul(1e8).div(ethPrice);
    }

    function supportsInterface(bytes4 interfaceID) public view virtual returns (bool)
    {
        return interfaceID == INTERFACE_META_ID || interfaceID == ORACLE_ID;
    }
}

File 18 of 25 : StablePriceOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "./IPriceOracle.sol";
import "./SafeMath.sol";
import "./StringUtils.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

interface AggregatorInterface {
    function latestAnswer() external view returns (int256);
}

// StablePriceOracle sets a price in USD, based on an oracle.
contract StablePriceOracle is Ownable, IPriceOracle {
    using SafeMath for *;
    using StringUtils for *;

    // Rent in base price units by length. Element 0 is for 1-length names, and so on.
    uint256[] public rentPrices;

    // Oracle address
    AggregatorInterface public immutable usdOracle;

    event OracleChanged(address oracle);

    event RentPriceChanged(uint256[] prices);

    bytes4 private constant INTERFACE_META_ID =
    bytes4(keccak256("supportsInterface(bytes4)"));
    bytes4 private constant ORACLE_ID =
    bytes4(
        keccak256("price(string,uint256,uint256)") ^
        keccak256("premium(string,uint256,uint256)")
    );

    constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {
        usdOracle = _usdOracle;
        setPrices(_rentPrices);
    }

    function price(string calldata name, uint256 expires, uint256 duration) external view override returns (uint256) {
        uint256 len = name.strlen();
        if (len > rentPrices.length) {
            len = rentPrices.length;
        }
        require(len > 0);

        uint256 basePrice = rentPrices[len - 1].mul(duration);
        basePrice = basePrice.add(_premium(name, expires, duration));

        return attoUSDToWei(basePrice);
    }

    /**
     * @dev Sets rent prices.
     * @param _rentPrices The price array. Each element corresponds to a specific
     *                    name length; names longer than the length of the array
     *                    default to the price of the last element. Values are
     *                    in base price units, equal to one attodollar (1e-18
     *                    dollar) each.
     */
    function setPrices(uint256[] memory _rentPrices) public onlyOwner {
        rentPrices = _rentPrices;
        emit RentPriceChanged(_rentPrices);
    }

    /**
     * @dev Returns the pricing premium in wei.
     */
    function premium(
        string calldata name,
        uint256 expires,
        uint256 duration
    ) external view returns (uint256) {
        uint256 weiPrice = attoUSDToWei(_premium(name, expires, duration));
        return weiPrice;
    }

    /**
     * @dev Returns the pricing premium in internal base units.
     */
    function _premium(
        string memory name,
        uint256 expires,
        uint256 duration
    ) internal view virtual returns (uint256) {
        return 0;
    }

    function attoUSDToWei(uint256 amount) internal view returns (uint256) {
        uint256 ethPrice = uint256(usdOracle.latestAnswer()); //2
        return amount.mul(1e8).div(ethPrice);
    }

    function weiToAttoUSD(uint256 amount) internal view returns (uint256) {
        uint256 ethPrice = uint256(usdOracle.latestAnswer());
        return amount.mul(ethPrice).div(1e8);
    }

    function supportsInterface(bytes4 interfaceID) public view virtual returns (bool)
    {
        return interfaceID == INTERFACE_META_ID || interfaceID == ORACLE_ID;
    }
}

File 19 of 25 : StringUtils.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.4;

library StringUtils {
    /**
     * @dev Returns the length of a given string
     *
     * @param s The string to measure the length of
     * @return The length of the input string
     */
    function strlen(string memory s) internal pure returns (uint) {
        uint len;
        uint i = 0;
        uint bytelength = bytes(s).length;
        for(len = 0; i < bytelength; len++) {
            bytes1 b = bytes(s)[i];
            if(b < 0x80) {
                i += 1;
            } else if (b < 0xE0) {
                i += 2;
            } else if (b < 0xF0) {
                i += 3;
            } else if (b < 0xF8) {
                i += 4;
            } else if (b < 0xFC) {
                i += 5;
            } else {
                i += 6;
            }
        }
        return len;
    }
}

File 20 of 25 : Controllable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/access/Ownable.sol";

contract Controllable is Ownable {
    mapping(address => bool) public controllers;

    event ControllerChanged(address indexed controller, bool enabled);

    modifier onlyController {
        require(
            controllers[msg.sender],
            "Controllable: Caller is not a controller"
        );
        _;
    }

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

File 21 of 25 : Root.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@ensdomains/ens-contracts/contracts/registry/ENS.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./Controllable.sol";

contract Root is Ownable, Controllable {
    bytes32 private constant ROOT_NODE = bytes32(0);

    bytes4 private constant INTERFACE_META_ID =
    bytes4(keccak256("supportsInterface(bytes4)"));

    event TLDLocked(bytes32 indexed label);

    ENS public ens;
    mapping(bytes32 => bool) public locked;

    constructor(ENS _ens) {
        ens = _ens;
    }

    function setSubnodeOwner(bytes32 label, address owner) external onlyController
    {
        require(!locked[label], "name locked");
        ens.setSubnodeOwner(ROOT_NODE, label, owner);
    }

    function setResolver(address resolver) external onlyController {
        ens.setResolver(ROOT_NODE, resolver);
    }

    function lock(bytes32 label) external onlyController {
        emit TLDLocked(label);
        locked[label] = true;
    }

    function supportsInterface(bytes4 interfaceID) external pure returns (bool) {
        return interfaceID == INTERFACE_META_ID;
    }
}

File 22 of 25 : SimpleHNSOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract SimpleHNSOracle is Ownable {
    using ECDSA for bytes32;
    address public notary;
    event NotaryChanged(address indexed oldNotary, address indexed newNotary);

    constructor(address _notary) {
        notary = _notary;
    }

    function setNotary(address _notary) external onlyOwner {
        emit NotaryChanged(notary, _notary);
        notary = _notary;
    }

    function verify(bytes32 nodeID, address registryAddress, address ownerAddress, bool locked,
        uint256 expire, bytes memory signature) public view returns (bool) {
        require(expire > block.timestamp, "proof expired");

        // must recover notary address
        return _hashMessage(nodeID, registryAddress, ownerAddress, locked, expire).recover(signature) == notary;
    }

    function _hashMessage(bytes32 nodeID, address registryAddress,
        address ownerAddress, bool locked, uint256 expire) internal pure returns(bytes32) {
        return keccak256(abi.encode(nodeID, registryAddress, ownerAddress, locked, expire))
               .toEthSignedMessageHash();
    }
}

File 23 of 25 : IUniversalRegistrar.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

interface IUniversalRegistrar is IERC721 {
    event ControllerAdded(bytes32 node, address indexed controller);
    event ControllerRemoved(bytes32 node, address indexed controller);

    event NameRegistered(
        bytes32 node,
        bytes32 indexed label,
        address indexed owner,
        uint256 expires
    );
    event NameRenewed(bytes32 node, bytes32 indexed label, uint256 expires);

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

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

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

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

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

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

    function renew(bytes32 node, bytes32 label, uint256 duration) external returns (uint256);

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

File 24 of 25 : RegistrarAccess.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "../root/Root.sol";

contract RegistrarAccess {
    event NodeOwnerChanged(bytes32 node, address indexed oldOwner, address indexed newOwner);
    event RegistryControllersChanged(address indexed controller, bool approved);
    event RegistryNodeControllersChanged(bytes32 node, address indexed controller, bool approved);

    Root public root;

    constructor(Root _root) {
        root = _root;
    }

    // A map of top level domains and their authorised owner
    mapping(bytes32 => address) private nodeOwners;

    // A map specifying which controller addresses TLD owners are allowed to use.
    mapping(address => bool) private registryControllers;

    // A map specifying which controller addresses a specific TLD owner is allowed to use.
    mapping(bytes32 => mapping(address => bool)) private registryNodeControllers;

    modifier onlyNodeOwner(bytes32 node) {
        require(nodeOwners[node] == msg.sender);
        _;
    }

    modifier onlyRegistry {
        require(root.controllers(msg.sender));
        _;
    }

    modifier onlyRegistryControllers(bytes32 node, address controller) {
        require(registryNodeControllers[node][controller] ||
            registryControllers[controller], "controller not approved by registry");
        _;
    }

    // Transfers ownership of a TLD to a new owner
    // can only be called by existing node owner.
    function transferNodeOwnership(bytes32 node, address newOwner) public onlyNodeOwner(node) {
        require(newOwner != address(0));
        emit NodeOwnerChanged(node, nodeOwners[node], newOwner);
        nodeOwners[node] = newOwner;
    }

    // Gives up ownership of a TLD to a burn address. All functionality marked with onlyNodeOwner
    // will be disabled for the specified TLD. It will also affect any contracts
    // that rely on {ownerOfNode}. Use with extreme caution.
    function renounceNodeOwnership(bytes32 node) public onlyNodeOwner(node) {
        emit NodeOwnerChanged(node, nodeOwners[node], address(0));
        nodeOwners[node] = address(0);
    }

    function ownerOfNode(bytes32 node) public view returns (address) {
        return nodeOwners[node];
    }

    // Sets ownership of a name in the registrar. If the name
    // is locked, only the owner can transfer ownership by
    // calling transferNodeOwnership.
    function setSubnodeOwner(bytes32 label, address owner) public onlyRegistry returns(bytes32) {
        require(!root.locked(label), "name locked");
        bytes32 node = keccak256(abi.encodePacked(bytes32(0), label));
        emit NodeOwnerChanged(node, nodeOwners[node], owner);
        nodeOwners[node] = owner;
        return node;
    }

    // Whitelists a controller address to be used by the specified node.
    function approveControllerForNode(bytes32 node, address controller, bool approved) external onlyRegistry {
        registryNodeControllers[node][controller] = approved;
        emit RegistryNodeControllersChanged(node, controller, approved);
    }

    // Whitelists a controller address to be used by any node.
    function approveController(address controller, bool approved) external onlyRegistry {
        registryControllers[controller] = approved;
        emit RegistryControllersChanged(controller, approved);
    }
}

File 25 of 25 : UniversalRegistrar.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@ensdomains/ens-contracts/contracts/registry/ENS.sol";
import "@ensdomains/ens-contracts/contracts/registry/ENSRegistry.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IUniversalRegistrar.sol";
import "./RegistrarAccess.sol";

contract UniversalRegistrar is ERC721, RegistrarAccess, IUniversalRegistrar, Ownable {
    // A map of expiry times
    mapping(uint256 => uint) expiries;
    ENS public ens;

    // ERC721 Metadata URI
    string private metadataUri;

    // A map of addresses that are authorised to register and renew
    // names for the given top level node.
    mapping(bytes32 => mapping(address => bool)) public controllers;

    uint256 public constant GRACE_PERIOD = 90 days;

    bytes4 constant private INTERFACE_META_ID = bytes4(keccak256("supportsInterface(bytes4)"));
    bytes4 constant private ERC721_ID = bytes4(
        keccak256("balanceOf(address)") ^
        keccak256("ownerOf(uint256)") ^
        keccak256("approve(address,uint256)") ^
        keccak256("getApproved(uint256)") ^
        keccak256("setApprovalForAll(address,bool)") ^
        keccak256("isApprovedForAll(address,address)") ^
        keccak256("transferFrom(address,address,uint256)") ^
        keccak256("safeTransferFrom(address,address,uint256)") ^
        keccak256("safeTransferFrom(address,address,uint256,bytes)")
    );
    bytes4 constant private RECLAIM_ID = bytes4(keccak256("reclaim(bytes32,uint256,address)"));

    /**
     * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);
     * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187
     * @dev Returns whether the given spender can transfer a given token ID
     * @param spender address of the spender to query
     * @param tokenId uint256 ID of the token to be transferred
     * @return bool whether the msg.sender 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) {
        address owner = ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    constructor(ENS _ens, Root _root) ERC721("Impervious Registry", "IR") RegistrarAccess(_root) {
        ens = _ens;
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`.
     */
    function _baseURI() internal view virtual override returns (string memory) {
        return metadataUri;
    }

    modifier live(bytes32 node) {
        require(ens.owner(node) == address(this));
        _;
    }

    modifier onlyController(bytes32 node) {
        require(controllers[node][msg.sender]);
        _;
    }

    /**
     * @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 override(IERC721, ERC721) returns (address) {
        require(expiries[tokenId] > block.timestamp);
        return super.ownerOf(tokenId);
    }

    // Change metadata uri
    function setUri(string memory _uri) external onlyOwner {
        metadataUri = _uri;
    }

    // Authorises a controller, who can register and renew domains.
    // can only be called by the node owner.
    function addController(
        bytes32 node,
        address controller
    ) external override onlyNodeOwner(node) onlyRegistryControllers(node, controller) {
        controllers[node][controller] = true;
        emit ControllerAdded(node, controller);
    }

    // Revoke controller permission for an address.
    // can only be called by the node owner.
    function removeController(bytes32 node, address controller) external override onlyNodeOwner(node) {
        controllers[node][controller] = false;
        emit ControllerRemoved(node, controller);
    }

    // Set the resolver for the TLD this registrar manages.
    // can only be called by the node owner.
    function setResolver(bytes32 node, address resolver) external override onlyNodeOwner(node) {
        ens.setResolver(node, resolver);
    }

    // Returns the expiration timestamp of the specified id.
    function nameExpires(uint256 id) external view override returns (uint) {
        return expiries[id];
    }

    // Returns true iff the specified name is available for registration.
    function available(uint256 id) public view override returns (bool) {
        // Not available if it's registered here or in its grace period.
        return expiries[id] + GRACE_PERIOD < block.timestamp;
    }

    /**
     * @dev Register a name.
     * @param node The node hash.
     * @param label The token ID (keccak256 of the label).
     * @param owner The address that should own the registration.
     * @param duration Duration in seconds for the registration.
     */
    function register(bytes32 node, bytes32 label, address owner, uint duration) external override returns (uint) {
        return _register(node, label, owner, duration, true);
    }

    /**
     * @dev Register a name, without modifying the registry.
     * @param node The node hash.
     * @param label The token ID (keccak256 of the label).
     * @param owner The address that should own the registration.
     * @param duration Duration in seconds for the registration.
     */
    function registerOnly(bytes32 node, bytes32 label, address owner, uint duration) external returns (uint) {
        return _register(node, label, owner, duration, false);
    }

    function _register(bytes32 node, bytes32 label, address owner,
        uint duration, bool updateRegistry) internal live(node) onlyController(node) returns (uint) {
        require(block.timestamp + duration + GRACE_PERIOD > block.timestamp + GRACE_PERIOD); // Prevent future overflow

        uint256 id = _tokenID(node, label);
        require(available(id));

        expiries[id] = block.timestamp + duration;
        if (_exists(id)) {
            // Name was previously owned, and expired
            _burn(id);
        }
        _mint(owner, id);
        if (updateRegistry) {
            ens.setSubnodeOwner(node, label, owner);
        }

        emit NameRegistered(node, label, owner, block.timestamp + duration);

        return block.timestamp + duration;
    }

    function renew(bytes32 node, bytes32 label, uint duration) external override live(node) onlyController(node) returns (uint) {
        uint256 id = _tokenID(node, label);
        require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period
        require(expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD); // Prevent future overflow

        expiries[id] += duration;
        emit NameRenewed(node, label, expiries[id]);
        return expiries[id];
    }

    /**
     * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.
     */
    function reclaim(bytes32 node, bytes32 label, address owner) external override live(node) {
        uint256 id = _tokenID(node, label);
        require(_isApprovedOrOwner(msg.sender, id));
        ens.setSubnodeOwner(node, label, owner);
    }

    function supportsInterface(bytes4 interfaceID) public override(ERC721, IERC165) view returns (bool) {
        return interfaceID == INTERFACE_META_ID ||
        interfaceID == ERC721_ID ||
        interfaceID == RECLAIM_ID;
    }

    function _tokenID(bytes32 node, bytes32 label) internal pure returns (uint256) {
        return uint256(keccak256(abi.encodePacked(node, label)));
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"contract Root","name":"_root","type":"address"},{"internalType":"contract UniversalRegistrar","name":"_registrar","type":"address"},{"internalType":"contract SimpleHNSOracle","name":"_oracle","type":"address"},{"internalType":"contract SinglePriceOracle","name":"_priceOracle","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":true,"internalType":"address","name":"registrar","type":"address"},{"indexed":true,"internalType":"address","name":"controller","type":"address"}],"name":"NewClaim","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"},{"inputs":[{"internalType":"address","name":"registrarController","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"approveRegistrarController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"registrarController","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"approveRegistrarControllerForNode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"bool","name":"locked","type":"bool"},{"internalType":"uint256","name":"expire","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"address","name":"controller","type":"address"}],"name":"claim","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"label","type":"bytes32"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"label","type":"bytes32"},{"internalType":"address","name":"claim","type":"address"},{"internalType":"uint256","name":"expire","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"lockWithProof","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"contract SimpleHNSOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceOracle","outputs":[{"internalType":"contract SinglePriceOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registrar","outputs":[{"internalType":"contract UniversalRegistrar","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"root","outputs":[{"internalType":"contract Root","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"label","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"}],"name":"setSubnodeOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620018ea380380620018ea8339810160408190526200003491620000e3565b6200003f3362000093565b600180546001600160a01b039586166001600160a01b031991821617909155600280549486169482169490941790935560038054928516928416929092179091556004805491909316911617905562000163565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060008060808587031215620000f9578384fd5b845162000106816200014a565b602086015190945062000119816200014a565b60408601519093506200012c816200014a565b60608601519092506200013f816200014a565b939692955090935050565b6001600160a01b03811681146200016057600080fd5b50565b61177780620001736000396000f3fe6080604052600436106100dd5760003560e01c80637dc0d1d01161007f57806396f033471161005957806396f033471461025c578063b2fc46d91461027c578063ebf0c7171461029c578063f2fde38b146102c957600080fd5b80637dc0d1d0146101e45780638cb8ecec146102115780638da5cb5b1461023157600080fd5b80633ccfd60b116100bb5780633ccfd60b146101875780634a0ef0031461019c57806352b3fe83146101bc578063715018a6146101cf57600080fd5b806301670ba9146100e25780632630c12f146101045780632b20e3971461015a575b600080fd5b3480156100ee57600080fd5b506101026100fd366004611431565b6102e9565b005b34801561011057600080fd5b506004546101319073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34801561016657600080fd5b506002546101319073ffffffffffffffffffffffffffffffffffffffff1681565b34801561019357600080fd5b506101026103dc565b3480156101a857600080fd5b506101026101b73660046114c6565b610426565b6101026101ca366004611527565b610867565b3480156101db57600080fd5b50610102610e4f565b3480156101f057600080fd5b506003546101319073ffffffffffffffffffffffffffffffffffffffff1681565b34801561021d57600080fd5b5061010261022c366004611461565b610ec2565b34801561023d57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610131565b34801561026857600080fd5b50610102610277366004611485565b610fba565b34801561028857600080fd5b506101026102973660046113dd565b6110ba565b3480156102a857600080fd5b506001546101319073ffffffffffffffffffffffffffffffffffffffff1681565b3480156102d557600080fd5b506101026102e43660046113a5565b611181565b60005473ffffffffffffffffffffffffffffffffffffffff1633146103555760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001546040517f01670ba90000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906301670ba990602401600060405180830381600087803b1580156103c157600080fd5b505af11580156103d5573d6000803e3d6000fd5b5050505050565b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116914780156108fc02929091818181858888f19350505050158015610423573d6000803e3d6000fd5b50565b6001546040517fcbe9e7640000000000000000000000000000000000000000000000000000000081526004810186905273ffffffffffffffffffffffffffffffffffffffff9091169063cbe9e7649060240160206040518083038186803b15801561049057600080fd5b505afa1580156104a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c89190611415565b156105155760405162461bcd60e51b815260206004820152601360248201527f6e616d6520616c7265616479206c6f636b656400000000000000000000000000604482015260640161034c565b600354600154604080517f3f15457f000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff9384169363d86623ed938993911691633f15457f91600480820192602092909190829003018186803b15801561058e57600080fd5b505afa1580156105a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c691906113c1565b86600187876040518763ffffffff1660e01b81526004016105ec9695949392919061163a565b60206040518083038186803b15801561060457600080fd5b505afa158015610618573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063c9190611415565b6106885760405162461bcd60e51b815260206004820152600960248201527f6261642070726f6f660000000000000000000000000000000000000000000000604482015260640161034c565b60408051600060208201819052918101869052606001604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00181529082905280516020909101206002547fd344f06200000000000000000000000000000000000000000000000000000000835260048301829052909250339173ffffffffffffffffffffffffffffffffffffffff9091169063d344f0629060240160206040518083038186803b15801561074157600080fd5b505afa158015610755573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077991906113c1565b73ffffffffffffffffffffffffffffffffffffffff16146107dc5760405162461bcd60e51b815260206004820152601b60248201527f73656e646572206973206e6f74206f776e6572206f66206e6f64650000000000604482015260640161034c565b6001546040517f01670ba90000000000000000000000000000000000000000000000000000000081526004810187905273ffffffffffffffffffffffffffffffffffffffff909116906301670ba990602401600060405180830381600087803b15801561084857600080fd5b505af115801561085c573d6000803e3d6000fd5b505050505050505050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a035b1fe6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108d157600080fd5b505afa1580156108e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109099190611449565b90508034101561095b5760405162461bcd60e51b815260206004820152601260248201527f696e73756666696369656e742066756e64730000000000000000000000000000604482015260640161034c565b8551602080880191909120600354600154604080517f3f15457f0000000000000000000000000000000000000000000000000000000081529051939473ffffffffffffffffffffffffffffffffffffffff9384169463d86623ed9487941692633f15457f926004808301939192829003018186803b1580156109dc57600080fd5b505afa1580156109f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1491906113c1565b338a8a8a6040518763ffffffff1660e01b8152600401610a399695949392919061163a565b60206040518083038186803b158015610a5157600080fd5b505afa158015610a65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a899190611415565b610ad55760405162461bcd60e51b815260206004820152600960248201527f62616420636c61696d0000000000000000000000000000000000000000000000604482015260640161034c565b6002546040517f8cb8ecec0000000000000000000000000000000000000000000000000000000081526004810183905230602482015260009173ffffffffffffffffffffffffffffffffffffffff1690638cb8ecec90604401602060405180830381600087803b158015610b4857600080fd5b505af1158015610b5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b809190611449565b6002546040517f854a03dc0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff878116602483015292935091169063854a03dc90604401600060405180830381600087803b158015610bf657600080fd5b505af1158015610c0a573d6000803e3d6000fd5b50506002546040517f61b93ed90000000000000000000000000000000000000000000000000000000081526004810185905233602482015273ffffffffffffffffffffffffffffffffffffffff90911692506361b93ed99150604401600060405180830381600087803b158015610c8057600080fd5b505af1158015610c94573d6000803e3d6000fd5b50506001546002546040517f8cb8ecec0000000000000000000000000000000000000000000000000000000081526004810187905273ffffffffffffffffffffffffffffffffffffffff918216602482015291169250638cb8ecec9150604401600060405180830381600087803b158015610d0e57600080fd5b505af1158015610d22573d6000803e3d6000fd5b505050508615610db1576001546040517f01670ba90000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff909116906301670ba990602401600060405180830381600087803b158015610d9857600080fd5b505af1158015610dac573d6000803e3d6000fd5b505050505b60025460405173ffffffffffffffffffffffffffffffffffffffff8087169216907f2f248198987115467eb968481e739188b7c1a5bcc0d11d86a15cb779309719ae90610dff908c90611693565b60405180910390a382341115610e4557336108fc610e1d85346116a6565b6040518115909202916000818181858888f1935050505015801561085c573d6000803e3d6000fd5b5050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610eb65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161034c565b610ec06000611276565b565b60005473ffffffffffffffffffffffffffffffffffffffff163314610f295760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161034c565b6001546040517f8cb8ecec0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015290911690638cb8ecec906044015b600060405180830381600087803b158015610f9e57600080fd5b505af1158015610fb2573d6000803e3d6000fd5b505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146110215760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161034c565b6002546040517fd9899b7a0000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff848116602483015283151560448301529091169063d9899b7a90606401600060405180830381600087803b15801561109d57600080fd5b505af11580156110b1573d6000803e3d6000fd5b50505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146111215760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161034c565b6002546040517f17c2103800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301528315156024830152909116906317c2103890604401610f84565b60005473ffffffffffffffffffffffffffffffffffffffff1633146111e85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161034c565b73ffffffffffffffffffffffffffffffffffffffff81166112715760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161034c565b610423815b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600067ffffffffffffffff80841115611306576113066116e2565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561134c5761134c6116e2565b8160405280935085815286868601111561136557600080fd5b858560208301376000602087830101525050509392505050565b600082601f83011261138f578081fd5b61139e838335602085016112eb565b9392505050565b6000602082840312156113b6578081fd5b813561139e81611711565b6000602082840312156113d2578081fd5b815161139e81611711565b600080604083850312156113ef578081fd5b82356113fa81611711565b9150602083013561140a81611733565b809150509250929050565b600060208284031215611426578081fd5b815161139e81611733565b600060208284031215611442578081fd5b5035919050565b60006020828403121561145a578081fd5b5051919050565b60008060408385031215611473578182fd5b82359150602083013561140a81611711565b600080600060608486031215611499578081fd5b8335925060208401356114ab81611711565b915060408401356114bb81611733565b809150509250925092565b600080600080608085870312156114db578081fd5b8435935060208501356114ed81611711565b925060408501359150606085013567ffffffffffffffff81111561150f578182fd5b61151b8782880161137f565b91505092959194509250565b600080600080600060a0868803121561153e578081fd5b853567ffffffffffffffff80821115611555578283fd5b818801915088601f830112611568578283fd5b611577898335602085016112eb565b96506020880135915061158982611733565b90945060408701359350606087013590808211156115a5578283fd5b506115b28882890161137f565b92505060808601356115c381611711565b809150509295509295909350565b60008151808452815b818110156115f6576020818501810151868301820152016115da565b818111156116075782602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b868152600073ffffffffffffffffffffffffffffffffffffffff8088166020840152808716604084015250841515606083015283608083015260c060a083015261168760c08301846115d1565b98975050505050505050565b60208152600061139e60208301846115d1565b6000828210156116dd577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461042357600080fd5b801515811461042357600080fdfea2646970667358221220180b245e965c70b80e60713ba474d9c907c7a401afeb468f195f775edbb4f26e64736f6c63430008040033000000000000000000000000d5237534f8800e1d30d3d5961cfe1104e93fa03a000000000000000000000000feddc1448eb4480714a9942ba28a27b16caf9ce4000000000000000000000000612631c7d8e7956aa8aba3e7a95775d732241ab7000000000000000000000000ede3f771a348174206defc6b6ae7d3508329c955

Deployed Bytecode

0x6080604052600436106100dd5760003560e01c80637dc0d1d01161007f57806396f033471161005957806396f033471461025c578063b2fc46d91461027c578063ebf0c7171461029c578063f2fde38b146102c957600080fd5b80637dc0d1d0146101e45780638cb8ecec146102115780638da5cb5b1461023157600080fd5b80633ccfd60b116100bb5780633ccfd60b146101875780634a0ef0031461019c57806352b3fe83146101bc578063715018a6146101cf57600080fd5b806301670ba9146100e25780632630c12f146101045780632b20e3971461015a575b600080fd5b3480156100ee57600080fd5b506101026100fd366004611431565b6102e9565b005b34801561011057600080fd5b506004546101319073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34801561016657600080fd5b506002546101319073ffffffffffffffffffffffffffffffffffffffff1681565b34801561019357600080fd5b506101026103dc565b3480156101a857600080fd5b506101026101b73660046114c6565b610426565b6101026101ca366004611527565b610867565b3480156101db57600080fd5b50610102610e4f565b3480156101f057600080fd5b506003546101319073ffffffffffffffffffffffffffffffffffffffff1681565b34801561021d57600080fd5b5061010261022c366004611461565b610ec2565b34801561023d57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610131565b34801561026857600080fd5b50610102610277366004611485565b610fba565b34801561028857600080fd5b506101026102973660046113dd565b6110ba565b3480156102a857600080fd5b506001546101319073ffffffffffffffffffffffffffffffffffffffff1681565b3480156102d557600080fd5b506101026102e43660046113a5565b611181565b60005473ffffffffffffffffffffffffffffffffffffffff1633146103555760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001546040517f01670ba90000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906301670ba990602401600060405180830381600087803b1580156103c157600080fd5b505af11580156103d5573d6000803e3d6000fd5b5050505050565b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116914780156108fc02929091818181858888f19350505050158015610423573d6000803e3d6000fd5b50565b6001546040517fcbe9e7640000000000000000000000000000000000000000000000000000000081526004810186905273ffffffffffffffffffffffffffffffffffffffff9091169063cbe9e7649060240160206040518083038186803b15801561049057600080fd5b505afa1580156104a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c89190611415565b156105155760405162461bcd60e51b815260206004820152601360248201527f6e616d6520616c7265616479206c6f636b656400000000000000000000000000604482015260640161034c565b600354600154604080517f3f15457f000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff9384169363d86623ed938993911691633f15457f91600480820192602092909190829003018186803b15801561058e57600080fd5b505afa1580156105a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c691906113c1565b86600187876040518763ffffffff1660e01b81526004016105ec9695949392919061163a565b60206040518083038186803b15801561060457600080fd5b505afa158015610618573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063c9190611415565b6106885760405162461bcd60e51b815260206004820152600960248201527f6261642070726f6f660000000000000000000000000000000000000000000000604482015260640161034c565b60408051600060208201819052918101869052606001604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00181529082905280516020909101206002547fd344f06200000000000000000000000000000000000000000000000000000000835260048301829052909250339173ffffffffffffffffffffffffffffffffffffffff9091169063d344f0629060240160206040518083038186803b15801561074157600080fd5b505afa158015610755573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077991906113c1565b73ffffffffffffffffffffffffffffffffffffffff16146107dc5760405162461bcd60e51b815260206004820152601b60248201527f73656e646572206973206e6f74206f776e6572206f66206e6f64650000000000604482015260640161034c565b6001546040517f01670ba90000000000000000000000000000000000000000000000000000000081526004810187905273ffffffffffffffffffffffffffffffffffffffff909116906301670ba990602401600060405180830381600087803b15801561084857600080fd5b505af115801561085c573d6000803e3d6000fd5b505050505050505050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a035b1fe6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108d157600080fd5b505afa1580156108e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109099190611449565b90508034101561095b5760405162461bcd60e51b815260206004820152601260248201527f696e73756666696369656e742066756e64730000000000000000000000000000604482015260640161034c565b8551602080880191909120600354600154604080517f3f15457f0000000000000000000000000000000000000000000000000000000081529051939473ffffffffffffffffffffffffffffffffffffffff9384169463d86623ed9487941692633f15457f926004808301939192829003018186803b1580156109dc57600080fd5b505afa1580156109f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1491906113c1565b338a8a8a6040518763ffffffff1660e01b8152600401610a399695949392919061163a565b60206040518083038186803b158015610a5157600080fd5b505afa158015610a65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a899190611415565b610ad55760405162461bcd60e51b815260206004820152600960248201527f62616420636c61696d0000000000000000000000000000000000000000000000604482015260640161034c565b6002546040517f8cb8ecec0000000000000000000000000000000000000000000000000000000081526004810183905230602482015260009173ffffffffffffffffffffffffffffffffffffffff1690638cb8ecec90604401602060405180830381600087803b158015610b4857600080fd5b505af1158015610b5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b809190611449565b6002546040517f854a03dc0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff878116602483015292935091169063854a03dc90604401600060405180830381600087803b158015610bf657600080fd5b505af1158015610c0a573d6000803e3d6000fd5b50506002546040517f61b93ed90000000000000000000000000000000000000000000000000000000081526004810185905233602482015273ffffffffffffffffffffffffffffffffffffffff90911692506361b93ed99150604401600060405180830381600087803b158015610c8057600080fd5b505af1158015610c94573d6000803e3d6000fd5b50506001546002546040517f8cb8ecec0000000000000000000000000000000000000000000000000000000081526004810187905273ffffffffffffffffffffffffffffffffffffffff918216602482015291169250638cb8ecec9150604401600060405180830381600087803b158015610d0e57600080fd5b505af1158015610d22573d6000803e3d6000fd5b505050508615610db1576001546040517f01670ba90000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff909116906301670ba990602401600060405180830381600087803b158015610d9857600080fd5b505af1158015610dac573d6000803e3d6000fd5b505050505b60025460405173ffffffffffffffffffffffffffffffffffffffff8087169216907f2f248198987115467eb968481e739188b7c1a5bcc0d11d86a15cb779309719ae90610dff908c90611693565b60405180910390a382341115610e4557336108fc610e1d85346116a6565b6040518115909202916000818181858888f1935050505015801561085c573d6000803e3d6000fd5b5050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610eb65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161034c565b610ec06000611276565b565b60005473ffffffffffffffffffffffffffffffffffffffff163314610f295760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161034c565b6001546040517f8cb8ecec0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015290911690638cb8ecec906044015b600060405180830381600087803b158015610f9e57600080fd5b505af1158015610fb2573d6000803e3d6000fd5b505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146110215760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161034c565b6002546040517fd9899b7a0000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff848116602483015283151560448301529091169063d9899b7a90606401600060405180830381600087803b15801561109d57600080fd5b505af11580156110b1573d6000803e3d6000fd5b50505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146111215760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161034c565b6002546040517f17c2103800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301528315156024830152909116906317c2103890604401610f84565b60005473ffffffffffffffffffffffffffffffffffffffff1633146111e85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161034c565b73ffffffffffffffffffffffffffffffffffffffff81166112715760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161034c565b610423815b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600067ffffffffffffffff80841115611306576113066116e2565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561134c5761134c6116e2565b8160405280935085815286868601111561136557600080fd5b858560208301376000602087830101525050509392505050565b600082601f83011261138f578081fd5b61139e838335602085016112eb565b9392505050565b6000602082840312156113b6578081fd5b813561139e81611711565b6000602082840312156113d2578081fd5b815161139e81611711565b600080604083850312156113ef578081fd5b82356113fa81611711565b9150602083013561140a81611733565b809150509250929050565b600060208284031215611426578081fd5b815161139e81611733565b600060208284031215611442578081fd5b5035919050565b60006020828403121561145a578081fd5b5051919050565b60008060408385031215611473578182fd5b82359150602083013561140a81611711565b600080600060608486031215611499578081fd5b8335925060208401356114ab81611711565b915060408401356114bb81611733565b809150509250925092565b600080600080608085870312156114db578081fd5b8435935060208501356114ed81611711565b925060408501359150606085013567ffffffffffffffff81111561150f578182fd5b61151b8782880161137f565b91505092959194509250565b600080600080600060a0868803121561153e578081fd5b853567ffffffffffffffff80821115611555578283fd5b818801915088601f830112611568578283fd5b611577898335602085016112eb565b96506020880135915061158982611733565b90945060408701359350606087013590808211156115a5578283fd5b506115b28882890161137f565b92505060808601356115c381611711565b809150509295509295909350565b60008151808452815b818110156115f6576020818501810151868301820152016115da565b818111156116075782602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b868152600073ffffffffffffffffffffffffffffffffffffffff8088166020840152808716604084015250841515606083015283608083015260c060a083015261168760c08301846115d1565b98975050505050505050565b60208152600061139e60208301846115d1565b6000828210156116dd577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461042357600080fd5b801515811461042357600080fdfea2646970667358221220180b245e965c70b80e60713ba474d9c907c7a401afeb468f195f775edbb4f26e64736f6c63430008040033

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

000000000000000000000000d5237534f8800e1d30d3d5961cfe1104e93fa03a000000000000000000000000feddc1448eb4480714a9942ba28a27b16caf9ce4000000000000000000000000612631c7d8e7956aa8aba3e7a95775d732241ab7000000000000000000000000ede3f771a348174206defc6b6ae7d3508329c955

-----Decoded View---------------
Arg [0] : _root (address): 0xD5237534f8800e1d30d3D5961CFE1104E93fa03a
Arg [1] : _registrar (address): 0xfEDDc1448Eb4480714A9942ba28a27b16Caf9cE4
Arg [2] : _oracle (address): 0x612631C7D8e7956Aa8abA3E7A95775D732241Ab7
Arg [3] : _priceOracle (address): 0xEdE3f771a348174206DeFc6B6aE7D3508329C955

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000d5237534f8800e1d30d3d5961cfe1104e93fa03a
Arg [1] : 000000000000000000000000feddc1448eb4480714a9942ba28a27b16caf9ce4
Arg [2] : 000000000000000000000000612631c7d8e7956aa8aba3e7a95775d732241ab7
Arg [3] : 000000000000000000000000ede3f771a348174206defc6b6ae7d3508329c955


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ 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.