ETH Price: $2,612.76 (+0.83%)

Contract

0x2fe02765a82A0ED801eFC2Fc0CAdd844b2609D3f
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040147262712022-05-06 22:48:46838 days ago1651877326IN
 Create: Registrar
0 ETH0.1365299228.59024698

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Registrar

Compiler Version
v0.8.11+commit.d7f03943

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 27 : Registrar.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

// This is only kept for backward compatability / upgrading
import {OwnableUpgradeable} from "../oz/access/OwnableUpgradeable.sol";
import {EnumerableMapUpgradeable, ERC721PausableUpgradeable, IERC721Upgradeable, ERC721Upgradeable} from "../oz/token/ERC721/ERC721PausableUpgradeable.sol";
import {IRegistrar} from "../interfaces/IRegistrar.sol";
import {StorageSlot} from "../oz/utils/StorageSlot.sol";
import {BeaconProxy} from "../oz/proxy/beacon/BeaconProxy.sol";
import {IZNSHub} from "../interfaces/IZNSHub.sol";

contract Registrar is
  IRegistrar,
  OwnableUpgradeable,
  ERC721PausableUpgradeable
{
  using EnumerableMapUpgradeable for EnumerableMapUpgradeable.UintToAddressMap;

  // Data recorded for each domain
  struct DomainRecord {
    address minter;
    bool metadataLocked;
    address metadataLockedBy;
    address controller;
    uint256 royaltyAmount;
    uint256 parentId;
    address subdomainContract;
  }

  // A map of addresses that are authorised to register domains.
  mapping(address => bool) public controllers;

  // A mapping of domain id's to domain data
  // This essentially expands the internal ERC721's token storage to additional fields
  mapping(uint256 => DomainRecord) public records;

  /**
   * @dev Storage slot with the admin of the contract.
   */
  bytes32 internal constant _ADMIN_SLOT =
    0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

  // The beacon address
  address public beacon;

  // If this is a subdomain contract these will be set
  uint256 public rootDomainId;
  address public parentRegistrar;

  // The event emitter
  IZNSHub public zNSHub;
  uint8 private test; // ignore
  uint256 private gap; // ignore

  function _getAdmin() internal view returns (address) {
    return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
  }

  modifier onlyController() {
    if (!controllers[msg.sender] && !zNSHub.isController(msg.sender)) {
      revert("ZR: Not controller");
    }
    _;
  }

  modifier onlyOwnerOf(uint256 id) {
    require(ownerOf(id) == msg.sender, "ZR: Not owner");
    _;
  }

  function initialize(
    address parentRegistrar_,
    uint256 rootDomainId_,
    string calldata collectionName,
    string calldata collectionSymbol,
    address zNSHub_
  ) public initializer {
    // __Ownable_init(); // Purposely not initializing ownable since we override owner()

    if (parentRegistrar_ == address(0)) {
      // create the root domain
      _createDomain(0, 0, msg.sender, address(0));
    } else {
      rootDomainId = rootDomainId_;
      parentRegistrar = parentRegistrar_;
    }

    zNSHub = IZNSHub(zNSHub_);

    __ERC721Pausable_init();
    __ERC721_init(collectionName, collectionSymbol);
  }

  function owner() public view override returns (address) {
    return zNSHub.owner();
  }

  /*
   * External Methods
   */

  /**
   * @notice Authorizes a controller to control the registrar
   * @param controller The address of the controller
   */
  function addController(address controller) external {
    require(
      msg.sender == owner() || msg.sender == parentRegistrar,
      "ZR: Not authorized"
    );
    require(!controllers[controller], "ZR: Controller is already added");
    controllers[controller] = true;
    emit ControllerAdded(controller);
  }

  /**
   * @notice Unauthorizes a controller to control the registrar
   * @param controller The address of the controller
   */
  function removeController(address controller) external override onlyOwner {
    require(
      msg.sender == owner() || msg.sender == parentRegistrar,
      "ZR: Not authorized"
    );
    require(controllers[controller], "ZR: Controller does not exist");
    controllers[controller] = false;
    emit ControllerRemoved(controller);
  }

  /**
   * @notice Pauses the registrar. Can only be done when not paused.
   */
  function pause() external onlyOwner {
    _pause();
  }

  /**
   * @notice Unpauses the registrar. Can only be done when not paused.
   */
  function unpause() external onlyOwner {
    _unpause();
  }

  /**
   * @notice Registers a new (sub) domain
   * @param parentId The parent domain
   * @param label The label of the domain
   * @param minter the minter of the new domain
   * @param metadataUri The uri of the metadata
   * @param royaltyAmount The amount of royalty this domain pays
   * @param locked Whether the domain is locked or not
   */
  function registerDomain(
    uint256 parentId,
    string memory label,
    address minter,
    string memory metadataUri,
    uint256 royaltyAmount,
    bool locked
  ) external override onlyController returns (uint256) {
    return
      _registerDomain(
        parentId,
        label,
        minter,
        metadataUri,
        royaltyAmount,
        locked
      );
  }

  function registerDomainAndSend(
    uint256 parentId,
    string memory label,
    address minter,
    string memory metadataUri,
    uint256 royaltyAmount,
    bool locked,
    address sendToUser
  ) external override onlyController returns (uint256) {
    // Register the domain
    uint256 id = _registerDomain(
      parentId,
      label,
      minter,
      metadataUri,
      royaltyAmount,
      locked
    );

    // immediately send domain to user
    _safeTransfer(minter, sendToUser, id, "");

    return id;
  }

  function registerSubdomainContract(
    uint256 parentId,
    string memory label,
    address minter,
    string memory metadataUri,
    uint256 royaltyAmount,
    bool locked,
    address sendToUser
  ) external onlyController returns (uint256) {
    // Register domain, `minter` is the minter
    uint256 id = _registerDomain(
      parentId,
      label,
      minter,
      metadataUri,
      royaltyAmount,
      locked
    );

    // Create subdomain contract as a beacon proxy
    address subdomainContract = address(
      new BeaconProxy(zNSHub.registrarBeacon(), "")
    );

    // More maintainable instead of using `data` in constructor
    Registrar(subdomainContract).initialize(
      address(this),
      id,
      "Zer0 Name Service",
      "ZNS",
      address(zNSHub)
    );

    // Indicate that the subdomain has a contract
    records[id].subdomainContract = subdomainContract;

    zNSHub.addRegistrar(id, subdomainContract);

    // immediately send the domain to the user (from the minter)
    _safeTransfer(minter, sendToUser, id, "");

    return id;
  }

  function _registerDomain(
    uint256 parentId,
    string memory label,
    address minter,
    string memory metadataUri,
    uint256 royaltyAmount,
    bool locked
  ) internal returns (uint256) {
    require(bytes(label).length > 0, "ZR: Empty name");
    // subdomain cannot be minted on domains which are subdomain contracts
    require(
      records[parentId].subdomainContract == address(0),
      "ZR: Parent is subcontract"
    );
    if (parentId != rootDomainId) {
      // Domain parents must exist
      require(_exists(parentId), "ZR: No parent");
    }

    // Create the child domain under the parent domain
    uint256 labelHash = uint256(keccak256(bytes(label)));
    address controller = msg.sender;

    // Calculate the new domain's id and create it
    uint256 domainId = uint256(
      keccak256(abi.encodePacked(parentId, labelHash))
    );
    _createDomain(parentId, domainId, minter, controller);
    _setTokenURI(domainId, metadataUri);

    if (locked) {
      records[domainId].metadataLockedBy = minter;
      records[domainId].metadataLocked = true;
    }

    if (royaltyAmount > 0) {
      records[domainId].royaltyAmount = royaltyAmount;
    }

    zNSHub.domainCreated(
      domainId,
      label,
      labelHash,
      parentId,
      minter,
      controller,
      metadataUri,
      royaltyAmount
    );

    return domainId;
  }

  /**
   * @notice Sets the domain royalty amount
   * @param id The domain to set on
   * @param amount The royalty amount
   */
  function setDomainRoyaltyAmount(uint256 id, uint256 amount)
    external
    override
    onlyOwnerOf(id)
  {
    require(!isDomainMetadataLocked(id), "ZR: Metadata locked");

    records[id].royaltyAmount = amount;
    zNSHub.royaltiesAmountChanged(id, amount);
  }

  /**
   * @notice Both sets and locks domain metadata uri in a single call
   * @param id The domain to lock
   * @param uri The uri to set
   */
  function setAndLockDomainMetadata(uint256 id, string memory uri)
    external
    override
    onlyOwnerOf(id)
  {
    require(!isDomainMetadataLocked(id), "ZR: Metadata locked");
    _setDomainMetadataUri(id, uri);
    _setDomainLock(id, msg.sender, true);
  }

  /**
   * @notice Sets the domain metadata uri
   * @param id The domain to set on
   * @param uri The uri to set
   */
  function setDomainMetadataUri(uint256 id, string memory uri)
    external
    override
    onlyOwnerOf(id)
  {
    require(!isDomainMetadataLocked(id), "ZR: Metadata locked");
    _setDomainMetadataUri(id, uri);
  }

  /**
   * @notice Locks a domains metadata uri
   * @param id The domain to lock
   * @param toLock whether the domain should be locked or not
   */
  function lockDomainMetadata(uint256 id, bool toLock) external override {
    _validateLockDomainMetadata(id, toLock);
    _setDomainLock(id, msg.sender, toLock);
  }

  /**
   * @notice transferFrom but many at a time
   * @param from Current owner of token
   * @param to New desired owner of token
   * @param tokenIds The tokens to ransfer
   */
  function transferFromBulk(
    address from,
    address to,
    uint256[] calldata tokenIds
  ) public {
    for (uint256 i = 0; i < tokenIds.length; ++i) {
      uint256 tokenId = tokenIds[i];
      require(
        _isApprovedOrOwner(_msgSender(), tokenId),
        "ERC721: transfer caller is not owner nor approved"
      );

      _transfer(from, to, tokenId);
    }
  }

  /*
   * Public View
   */

  function ownerOf(uint256 tokenId)
    public
    view
    virtual
    override(ERC721Upgradeable, IERC721Upgradeable)
    returns (address)
  {
    // Check if the token is in this contract
    if (_tokenOwners.contains(tokenId)) {
      return
        _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
    }

    return zNSHub.ownerOf(tokenId);
  }

  /**
   * @notice Returns whether or not an account is a a controller registered on this contract
   * @param account Address of account to check
   */
  function isController(address account) external view override returns (bool) {
    bool accountIsController = controllers[account];
    return accountIsController;
  }

  /**
   * @notice Returns whether or not a domain is exists
   * @param id The domain
   */
  function domainExists(uint256 id) public view override returns (bool) {
    bool domainNftExists = _exists(id);
    return domainNftExists;
  }

  /**
   * @notice Returns the original minter of a domain
   * @param id The domain
   */
  function minterOf(uint256 id) public view override returns (address) {
    address minter = records[id].minter;
    return minter;
  }

  /**
   * @notice Returns whether or not a domain's metadata is locked
   * @param id The domain
   */
  function isDomainMetadataLocked(uint256 id)
    public
    view
    override
    returns (bool)
  {
    bool isLocked = records[id].metadataLocked;
    return isLocked;
  }

  /**
   * @notice Returns who locked a domain's metadata
   * @param id The domain
   */
  function domainMetadataLockedBy(uint256 id)
    public
    view
    override
    returns (address)
  {
    address lockedBy = records[id].metadataLockedBy;
    return lockedBy;
  }

  /**
   * @notice Returns the controller which created the domain on behalf of a user
   * @param id The domain
   */
  function domainController(uint256 id) public view override returns (address) {
    address controller = records[id].controller;
    return controller;
  }

  /**
   * @notice Returns the current royalty amount for a domain
   * @param id The domain
   */
  function domainRoyaltyAmount(uint256 id)
    public
    view
    override
    returns (uint256)
  {
    uint256 amount = records[id].royaltyAmount;
    return amount;
  }

  /**
   * @notice Returns the parent id of a domain.
   * @param id The domain
   */
  function parentOf(uint256 id) public view override returns (uint256) {
    require(_exists(id), "ZR: Does not exist");

    uint256 parentId = records[id].parentId;
    return parentId;
  }

  /*
   * Internal Methods
   */

  function _transfer(
    address from,
    address to,
    uint256 tokenId
  ) internal virtual override {
    super._transfer(from, to, tokenId);
    // Need to emit transfer events on event emitter
    zNSHub.domainTransferred(from, to, tokenId);
  }

  function _setDomainMetadataUri(uint256 id, string memory uri) internal {
    _setTokenURI(id, uri);
    zNSHub.metadataChanged(id, uri);
  }

  function _validateLockDomainMetadata(uint256 id, bool toLock) internal view {
    if (toLock) {
      require(ownerOf(id) == msg.sender, "ZR: Not owner");
      require(!isDomainMetadataLocked(id), "ZR: Metadata locked");
    } else {
      require(isDomainMetadataLocked(id), "ZR: Not locked");
      require(domainMetadataLockedBy(id) == msg.sender, "ZR: Not locker");
    }
  }

  // internal - creates a domain
  function _createDomain(
    uint256 parentId,
    uint256 domainId,
    address minter,
    address controller
  ) internal {
    // Create the NFT and register the domain data
    _mint(minter, domainId);
    records[domainId] = DomainRecord({
      parentId: parentId,
      minter: minter,
      metadataLocked: false,
      metadataLockedBy: address(0),
      controller: controller,
      royaltyAmount: 0,
      subdomainContract: address(0)
    });
  }

  function _setDomainLock(
    uint256 id,
    address locker,
    bool lockStatus
  ) internal {
    records[id].metadataLockedBy = locker;
    records[id].metadataLocked = lockStatus;

    zNSHub.metadataLockChanged(id, locker, lockStatus);
  }

  function adminBurnToken(uint256 tokenId) external onlyOwner {
    _burn(tokenId);
    delete (records[tokenId]);
  }

  function adminSetMetadataBulk(
    string memory folderWithIPFSPrefix,
    uint256[] memory orderedIds,
    uint256 ipfsFolderIndexOffset
  ) external onlyOwner {
    for (uint256 i = 0; i < orderedIds.length; i++) {
      _setDomainMetadataUri(
        orderedIds[i],
        string(
          abi.encodePacked(
            folderWithIPFSPrefix,
            uint2str(ipfsFolderIndexOffset + i)
          )
        )
      );
    }
  }

  /**
   * Sets metadata via IPFS folder in a bulk fashion via token index (not token ID)
   * @param folderWithIPFSPrefix the IPFS Folder (ie: "ipfs://QmABCDEFG/")
   * @param tokenIndexStart The token index starting point
   * @param ipfsFolderIndexStart The IPFS folder index starting point
   * @param count The number of tokens to modify [start index -> start index + count]
   */
  function adminSetMetadataBulkByIndex(
    string memory folderWithIPFSPrefix,
    uint256 tokenIndexStart,
    uint256 ipfsFolderIndexStart,
    uint256 count
  ) external onlyOwner {
    for (uint256 i = 0; i < count; i++) {
      _setDomainMetadataUri(
        tokenByIndex(tokenIndexStart + i),
        string(
          abi.encodePacked(
            folderWithIPFSPrefix,
            uint2str(ipfsFolderIndexStart + i)
          )
        )
      );
    }
  }

  function adminTransfer(
    address from,
    address to,
    uint256 tokenId
  ) external onlyOwner {
    _transfer(from, to, tokenId);
  }

  function adminSetMetadataUri(uint256 id, string memory uri)
    external
    onlyOwner
  {
    _setDomainMetadataUri(id, uri);
  }

  function setZNSHub(IZNSHub hub) external onlyOwner {
    zNSHub = hub;
  }

  function registerDomainAndSendBulk(
    uint256 parentId,
    uint256 namingOffset, // e.g., the IPFS node refers to the metadata as x. the zNS label will be x + namingOffset
    uint256 startingIndex,
    uint256 endingIndex,
    address minter,
    string memory folderWithIPFSPrefix, // e.g., ipfs://Qm.../
    uint256 royaltyAmount,
    bool locked
  ) external onlyController {
    require(endingIndex - startingIndex > 0, "Invalid number of domains");
    uint256 result;
    for (uint256 i = startingIndex; i < endingIndex; i++) {
      result = _registerDomain(
        parentId,
        uint2str(i + namingOffset),
        minter,
        string(abi.encodePacked(folderWithIPFSPrefix, uint2str(i))),
        royaltyAmount,
        locked
      );
    }
  }

  function uint2str(uint256 _i)
    internal
    pure
    returns (string memory _uintAsString)
  {
    if (_i == 0) {
      return "0";
    }
    uint256 j = _i;
    uint256 len;
    while (j != 0) {
      len++;
      j /= 10;
    }
    bytes memory bstr = new bytes(len);
    uint256 k = len;
    while (_i != 0) {
      k = k - 1;
      uint8 temp = (48 + uint8(_i - (_i / 10) * 10));
      bytes1 b1 = bytes1(temp);
      bstr[k] = b1;
      _i /= 10;
    }
    return string(bstr);
  }
}

File 2 of 27 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;

import "../utils/ContextUpgradeable.sol";
import "../proxy/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
  address private _owner;

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

  /**
   * @dev Initializes the contract setting the deployer as the initial owner.
   */
  function __Ownable_init() internal initializer {
    __Context_init_unchained();
    __Ownable_init_unchained();
  }

  function __Ownable_init_unchained() internal initializer {
    address msgSender = _msgSender();
    _owner = msgSender;
    emit OwnershipTransferred(address(0), 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 {
    emit OwnershipTransferred(_owner, address(0));
    _owner = 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");
    emit OwnershipTransferred(_owner, newOwner);
    _owner = newOwner;
  }

  uint256[49] private __gap;
}

File 3 of 27 : ERC721PausableUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;

import "./ERC721Upgradeable.sol";
import "../../utils/PausableUpgradeable.sol";
import "../../proxy/Initializable.sol";

/**
 * @dev ERC721 token with pausable token transfers, minting and burning.
 *
 * Useful for scenarios such as preventing trades until the end of an evaluation
 * period, or having an emergency switch for freezing all token transfers in the
 * event of a large bug.
 */
abstract contract ERC721PausableUpgradeable is
  Initializable,
  ERC721Upgradeable,
  PausableUpgradeable
{
  function __ERC721Pausable_init() internal initializer {
    __Context_init_unchained();
    __ERC165_init_unchained();
    __Pausable_init_unchained();
    __ERC721Pausable_init_unchained();
  }

  function __ERC721Pausable_init_unchained() internal initializer {}

  /**
   * @dev See {ERC721-_beforeTokenTransfer}.
   *
   * Requirements:
   *
   * - the contract must not be paused.
   */
  function _beforeTokenTransfer(
    address from,
    address to,
    uint256 tokenId
  ) internal virtual override {
    super._beforeTokenTransfer(from, to, tokenId);

    require(!paused(), "ERC721Pausable: token transfer while paused");
  }

  uint256[50] private __gap;
}

File 4 of 27 : IRegistrar.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "../oz/token/ERC721/IERC721EnumerableUpgradeable.sol";
import "../oz/token/ERC721/IERC721MetadataUpgradeable.sol";

interface IRegistrar is
  IERC721MetadataUpgradeable,
  IERC721EnumerableUpgradeable
{
  // Emitted when a controller is removed
  event ControllerAdded(address indexed controller);

  // Emitted whenever a controller is removed
  event ControllerRemoved(address indexed controller);

  // Emitted whenever a new domain is created
  event DomainCreated(
    uint256 indexed id,
    string label,
    uint256 indexed labelHash,
    uint256 indexed parent,
    address minter,
    address controller,
    string metadataUri,
    uint256 royaltyAmount
  );

  // Emitted whenever the metadata of a domain is locked
  event MetadataLockChanged(uint256 indexed id, address locker, bool isLocked);

  // Emitted whenever the metadata of a domain is changed
  event MetadataChanged(uint256 indexed id, string uri);

  // Emitted whenever the royalty amount is changed
  event RoyaltiesAmountChanged(uint256 indexed id, uint256 amount);

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

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

  // Registers a new sub domain
  function registerDomain(
    uint256 parentId,
    string memory label,
    address minter,
    string memory metadataUri,
    uint256 royaltyAmount,
    bool locked
  ) external returns (uint256);

  function registerDomainAndSend(
    uint256 parentId,
    string memory label,
    address minter,
    string memory metadataUri,
    uint256 royaltyAmount,
    bool locked,
    address sendToUser
  ) external returns (uint256);

  function registerSubdomainContract(
    uint256 parentId,
    string memory label,
    address minter,
    string memory metadataUri,
    uint256 royaltyAmount,
    bool locked,
    address sendToUser
  ) external returns (uint256);

  // Set a domains metadata uri and lock that domain from being modified
  function setAndLockDomainMetadata(uint256 id, string memory uri) external;

  // Lock a domain's metadata so that it cannot be changed
  function lockDomainMetadata(uint256 id, bool toLock) external;

  // Update a domain's metadata uri
  function setDomainMetadataUri(uint256 id, string memory uri) external;

  // Sets the asked royalty amount on a domain (amount is a percentage with 5 decimal places)
  function setDomainRoyaltyAmount(uint256 id, uint256 amount) external;

  // Returns whether an address is a controller
  function isController(address account) external view returns (bool);

  // Checks whether or not a domain exists
  function domainExists(uint256 id) external view returns (bool);

  // Returns the original minter of a domain
  function minterOf(uint256 id) external view returns (address);

  // Checks if a domains metadata is locked
  function isDomainMetadataLocked(uint256 id) external view returns (bool);

  // Returns the address which locked the domain metadata
  function domainMetadataLockedBy(uint256 id) external view returns (address);

  // Gets the controller that registered a domain
  function domainController(uint256 id) external view returns (address);

  // Gets a domains current royalty amount
  function domainRoyaltyAmount(uint256 id) external view returns (uint256);

  // Returns the parent domain of a child domain
  function parentOf(uint256 id) external view returns (uint256);
}

File 5 of 27 : StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
 */
library StorageSlot {
  struct AddressSlot {
    address value;
  }

  struct BooleanSlot {
    bool value;
  }

  struct Bytes32Slot {
    bytes32 value;
  }

  struct Uint256Slot {
    uint256 value;
  }

  /**
   * @dev Returns an `AddressSlot` with member `value` located at `slot`.
   */
  function getAddressSlot(bytes32 slot)
    internal
    pure
    returns (AddressSlot storage r)
  {
    assembly {
      r.slot := slot
    }
  }

  /**
   * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
   */
  function getBooleanSlot(bytes32 slot)
    internal
    pure
    returns (BooleanSlot storage r)
  {
    assembly {
      r.slot := slot
    }
  }

  /**
   * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
   */
  function getBytes32Slot(bytes32 slot)
    internal
    pure
    returns (Bytes32Slot storage r)
  {
    assembly {
      r.slot := slot
    }
  }

  /**
   * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
   */
  function getUint256Slot(bytes32 slot)
    internal
    pure
    returns (Uint256Slot storage r)
  {
    assembly {
      r.slot := slot
    }
  }
}

File 6 of 27 : BeaconProxy.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/BeaconProxy.sol)

pragma solidity ^0.8.0;

import "./IBeacon.sol";
import "../Proxy.sol";
import "../ERC1967/ERC1967Upgrade.sol";

/**
 * @dev This contract implements a proxy that gets the implementation address for each call from a {UpgradeableBeacon}.
 *
 * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't
 * conflict with the storage layout of the implementation behind the proxy.
 *
 * _Available since v3.4._
 */
contract BeaconProxy is Proxy, ERC1967Upgrade {
  /**
   * @dev Initializes the proxy with `beacon`.
   *
   * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This
   * will typically be an encoded function call, and allows initializating the storage of the proxy like a Solidity
   * constructor.
   *
   * Requirements:
   *
   * - `beacon` must be a contract with the interface {IBeacon}.
   */
  constructor(address beacon, bytes memory data) payable {
    assert(
      _BEACON_SLOT == bytes32(uint256(keccak256("eip1967.proxy.beacon")) - 1)
    );
    _upgradeBeaconToAndCall(beacon, data, false);
  }

  /**
   * @dev Returns the current beacon address.
   */
  function _beacon() internal view virtual returns (address) {
    return _getBeacon();
  }

  /**
   * @dev Returns the current implementation address of the associated beacon.
   */
  function _implementation() internal view virtual override returns (address) {
    return IBeacon(_getBeacon()).implementation();
  }

  /**
   * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.
   *
   * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon.
   *
   * Requirements:
   *
   * - `beacon` must be a contract.
   * - The implementation returned by `beacon` must be a contract.
   */
  function _setBeacon(address beacon, bytes memory data) internal virtual {
    _upgradeBeaconToAndCall(beacon, data, false);
  }
}

File 7 of 27 : IZNSHub.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import {IRegistrar} from "./IRegistrar.sol";

interface IZNSHub {
  function addRegistrar(uint256 rootDomainId, address registrar) external;

  function isController(address controller) external returns (bool);

  function getRegistrarForDomain(uint256 domainId)
    external
    view
    returns (IRegistrar);

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

  function domainExists(uint256 domainId) external view returns (bool);

  function owner() external view returns (address);

  function registrarBeacon() external view returns (address);

  function domainTransferred(
    address from,
    address to,
    uint256 tokenId
  ) external;

  function domainCreated(
    uint256 id,
    string calldata name,
    uint256 nameHash,
    uint256 parent,
    address minter,
    address controller,
    string calldata metadataUri,
    uint256 royaltyAmount
  ) external;

  function metadataLockChanged(
    uint256 id,
    address locker,
    bool isLocked
  ) external;

  function metadataChanged(uint256 id, string calldata uri) external;

  function royaltiesAmountChanged(uint256 id, uint256 amount) external;

  // Returns the parent domain of a child domain
  function parentOf(uint256 id) external view returns (uint256);
}

File 8 of 27 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;
import "../proxy/Initializable.sol";

/*
 * @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 GSN 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 ContextUpgradeable is Initializable {
  function __Context_init() internal initializer {
    __Context_init_unchained();
  }

  function __Context_init_unchained() internal initializer {}

  function _msgSender() internal view virtual returns (address) {
    return msg.sender;
  }

  function _msgData() internal view virtual returns (bytes memory) {
    this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
    return msg.data;
  }

  uint256[50] private __gap;
}

File 9 of 27 : Initializable.sol
// SPDX-License-Identifier: MIT

// solhint-disable-next-line compiler-version
pragma solidity ^0.8.9;

import "../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {
  /**
   * @dev Indicates that the contract has been initialized.
   */
  bool private _initialized;

  /**
   * @dev Indicates that the contract is in the process of being initialized.
   */
  bool private _initializing;

  /**
   * @dev Modifier to protect an initializer function from being invoked twice.
   */
  modifier initializer() {
    require(
      _initializing || _isConstructor() || !_initialized,
      "Initializable: contract is already initialized"
    );

    bool isTopLevelCall = !_initializing;
    if (isTopLevelCall) {
      _initializing = true;
      _initialized = true;
    }

    _;

    if (isTopLevelCall) {
      _initializing = false;
    }
  }

  /// @dev Returns true if and only if the function is running in the constructor
  function _isConstructor() private view returns (bool) {
    return !AddressUpgradeable.isContract(address(this));
  }
}

File 10 of 27 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
  /**
   * @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
   * ====
   */
  function isContract(address account) internal view returns (bool) {
    // This method relies on extcodesize, which returns 0 for contracts in
    // construction, since the code is only stored at the end of the
    // constructor execution.

    uint256 size;
    // solhint-disable-next-line no-inline-assembly
    assembly {
      size := extcodesize(account)
    }
    return size > 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");

    // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
    (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");

    // solhint-disable-next-line avoid-low-level-calls
    (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");

    // solhint-disable-next-line avoid-low-level-calls
    (bool success, bytes memory returndata) = target.staticcall(data);
    return _verifyCallResult(success, returndata, errorMessage);
  }

  function _verifyCallResult(
    bool success,
    bytes memory returndata,
    string memory errorMessage
  ) private 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

        // solhint-disable-next-line no-inline-assembly
        assembly {
          let returndata_size := mload(returndata)
          revert(add(32, returndata), returndata_size)
        }
      } else {
        revert(errorMessage);
      }
    }
  }
}

File 11 of 27 : ERC721Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;

import "../../utils/ContextUpgradeable.sol";
import "./IERC721Upgradeable.sol";
import "./IERC721MetadataUpgradeable.sol";
import "./IERC721EnumerableUpgradeable.sol";
import "./IERC721ReceiverUpgradeable.sol";
import "../../introspection/ERC165Upgradeable.sol";
import "../../math/SafeMathUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/EnumerableSetUpgradeable.sol";
import "../../utils/EnumerableMapUpgradeable.sol";
import "../../utils/StringsUpgradeable.sol";
import "../../proxy/Initializable.sol";

/**
 * @title ERC721 Non-Fungible Token Standard basic implementation
 * @dev see https://eips.ethereum.org/EIPS/eip-721
 */
contract ERC721Upgradeable is
  Initializable,
  ContextUpgradeable,
  ERC165Upgradeable,
  IERC721Upgradeable,
  IERC721MetadataUpgradeable,
  IERC721EnumerableUpgradeable
{
  using SafeMathUpgradeable for uint256;
  using AddressUpgradeable for address;
  using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;
  using EnumerableMapUpgradeable for EnumerableMapUpgradeable.UintToAddressMap;
  using StringsUpgradeable for uint256;

  // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
  // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
  bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;

  // Mapping from holder address to their (enumerable) set of owned tokens
  mapping(address => EnumerableSetUpgradeable.UintSet) private _holderTokens;

  // Enumerable mapping from token ids to their owners
  EnumerableMapUpgradeable.UintToAddressMap internal _tokenOwners;

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

  // Token name
  string private _name;

  // Token symbol
  string private _symbol;

  // Optional mapping for token URIs
  mapping(uint256 => string) private _tokenURIs;

  // Base URI
  string private _baseURI;

  /*
   *     bytes4(keccak256('balanceOf(address)')) == 0x70a08231
   *     bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
   *     bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
   *     bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
   *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
   *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
   *     bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
   *     bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
   *     bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
   *
   *     => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
   *        0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
   */
  bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;

  /*
   *     bytes4(keccak256('name()')) == 0x06fdde03
   *     bytes4(keccak256('symbol()')) == 0x95d89b41
   *     bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd
   *
   *     => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f
   */
  bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;

  /*
   *     bytes4(keccak256('totalSupply()')) == 0x18160ddd
   *     bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59
   *     bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7
   *
   *     => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63
   */
  bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;

  /**
   * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
   */
  function __ERC721_init(string memory name_, string memory symbol_)
    internal
    initializer
  {
    __Context_init_unchained();
    __ERC165_init_unchained();
    __ERC721_init_unchained(name_, symbol_);
  }

  function __ERC721_init_unchained(string memory name_, string memory symbol_)
    internal
    initializer
  {
    _name = name_;
    _symbol = symbol_;

    // register the supported interfaces to conform to ERC721 via ERC165
    _registerInterface(_INTERFACE_ID_ERC721);
    _registerInterface(_INTERFACE_ID_ERC721_METADATA);
    _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
  }

  /**
   * @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 _holderTokens[owner].length();
  }

  /**
   * @dev See {IERC721-ownerOf}.
   */
  function ownerOf(uint256 tokenId)
    public
    view
    virtual
    override
    returns (address)
  {
    return
      _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
  }

  /**
   * @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 _tokenURI = _tokenURIs[tokenId];
    string memory base = baseURI();

    // If there is no base URI, return the token URI.
    if (bytes(base).length == 0) {
      return _tokenURI;
    }
    // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
    if (bytes(_tokenURI).length > 0) {
      return string(abi.encodePacked(base, _tokenURI));
    }
    // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
    return string(abi.encodePacked(base, tokenId.toString()));
  }

  /**
   * @dev Returns the base URI set via {_setBaseURI}. This will be
   * automatically added as a prefix in {tokenURI} to each token's URI, or
   * to the token ID if no specific URI is set for that token ID.
   */
  function baseURI() public view virtual returns (string memory) {
    return _baseURI;
  }

  /**
   * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
   */
  function tokenOfOwnerByIndex(address owner, uint256 index)
    public
    view
    virtual
    override
    returns (uint256)
  {
    return _holderTokens[owner].at(index);
  }

  /**
   * @dev See {IERC721Enumerable-totalSupply}.
   */
  function totalSupply() public view virtual override returns (uint256) {
    // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
    return _tokenOwners.length();
  }

  /**
   * @dev See {IERC721Enumerable-tokenByIndex}.
   */
  function tokenByIndex(uint256 index)
    public
    view
    virtual
    override
    returns (uint256)
  {
    (uint256 tokenId, ) = _tokenOwners.at(index);
    return tokenId;
  }

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

    require(
      _msgSender() == owner ||
        ERC721Upgradeable.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
  {
    require(operator != _msgSender(), "ERC721: approve to caller");

    _operatorApprovals[_msgSender()][operator] = approved;
    emit ApprovalForAll(_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 _tokenOwners.contains(tokenId);
  }

  /**
   * @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 = ERC721Upgradeable.ownerOf(tokenId);
    return (spender == owner ||
      getApproved(tokenId) == spender ||
      ERC721Upgradeable.isApprovedForAll(owner, spender));
  }

  /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     d*
     * - `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);

    _holderTokens[to].add(tokenId);

    _tokenOwners.set(tokenId, to);

    emit Transfer(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 = ERC721Upgradeable.ownerOf(tokenId); // internal owner

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

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

    // Clear metadata (if any)
    if (bytes(_tokenURIs[tokenId]).length != 0) {
      delete _tokenURIs[tokenId];
    }

    _holderTokens[owner].remove(tokenId);

    _tokenOwners.remove(tokenId);

    emit Transfer(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(
      ERC721Upgradeable.ownerOf(tokenId) == from,
      "ERC721: transfer of token that is not own"
    ); // internal 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);

    _holderTokens[from].remove(tokenId);
    _holderTokens[to].add(tokenId);

    _tokenOwners.set(tokenId, to);

    emit Transfer(from, to, tokenId);
  }

  /**
   * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
   *
   * Requirements:
   *
   * - `tokenId` must exist.
   */
  function _setTokenURI(uint256 tokenId, string memory _tokenURI)
    internal
    virtual
  {
    _tokenURIs[tokenId] = _tokenURI;
  }

  /**
   * @dev Internal function to set the base URI for all token IDs. It is
   * automatically added as a prefix to the value returned in {tokenURI},
   * or to the token ID if {tokenURI} is empty.
   */
  function _setBaseURI(string memory baseURI_) internal virtual {
    _baseURI = baseURI_;
  }

  /**
   * @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()) {
      return true;
    }
    bytes memory returndata = to.functionCall(
      abi.encodeWithSelector(
        IERC721ReceiverUpgradeable(to).onERC721Received.selector,
        _msgSender(),
        from,
        tokenId,
        _data
      ),
      "ERC721: transfer to non ERC721Receiver implementer"
    );
    bytes4 retval = abi.decode(returndata, (bytes4));
    return (retval == _ERC721_RECEIVED);
  }

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

  /**
   * @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` cannot be the zero address.
   * - `to` cannot be the zero address.
   *
   * 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 {}

  uint256[41] private __gap;
}

File 12 of 27 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;

import "./ContextUpgradeable.sol";
import "../proxy/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
  /**
   * @dev Emitted when the pause is triggered by `account`.
   */
  event Paused(address account);

  /**
   * @dev Emitted when the pause is lifted by `account`.
   */
  event Unpaused(address account);

  bool private _paused;

  /**
   * @dev Initializes the contract in unpaused state.
   */
  function __Pausable_init() internal initializer {
    __Context_init_unchained();
    __Pausable_init_unchained();
  }

  function __Pausable_init_unchained() internal initializer {
    _paused = false;
  }

  /**
   * @dev Returns true if the contract is paused, and false otherwise.
   */
  function paused() public view virtual returns (bool) {
    return _paused;
  }

  /**
   * @dev Modifier to make a function callable only when the contract is not paused.
   *
   * Requirements:
   *
   * - The contract must not be paused.
   */
  modifier whenNotPaused() {
    require(!paused(), "Pausable: paused");
    _;
  }

  /**
   * @dev Modifier to make a function callable only when the contract is paused.
   *
   * Requirements:
   *
   * - The contract must be paused.
   */
  modifier whenPaused() {
    require(paused(), "Pausable: not paused");
    _;
  }

  /**
   * @dev Triggers stopped state.
   *
   * Requirements:
   *
   * - The contract must not be paused.
   */
  function _pause() internal virtual whenNotPaused {
    _paused = true;
    emit Paused(_msgSender());
  }

  /**
   * @dev Returns to normal state.
   *
   * Requirements:
   *
   * - The contract must be paused.
   */
  function _unpause() internal virtual whenPaused {
    _paused = false;
    emit Unpaused(_msgSender());
  }

  uint256[49] private __gap;
}

File 13 of 27 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;
import "../../introspection/IERC165Upgradeable.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721Upgradeable is IERC165Upgradeable {
  /**
   * @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`, 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 Returns the account approved for `tokenId` token.
   *
   * Requirements:
   *
   * - `tokenId` must exist.
   */
  function getApproved(uint256 tokenId)
    external
    view
    returns (address operator);

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

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

File 14 of 27 : IERC721MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;
import "./IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721MetadataUpgradeable is IERC721Upgradeable {
  /**
   * @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 15 of 27 : IERC721EnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;
import "./IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721EnumerableUpgradeable is IERC721Upgradeable {
  /**
   * @dev Returns the total amount of tokens stored by the contract.
   */
  function totalSupply() external view returns (uint256);

  /**
   * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
   * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
   */
  function tokenOfOwnerByIndex(address owner, uint256 index)
    external
    view
    returns (uint256 tokenId);

  /**
   * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
   * Use along with {totalSupply} to enumerate all tokens.
   */
  function tokenByIndex(uint256 index) external view returns (uint256);
}

File 16 of 27 : IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721ReceiverUpgradeable {
  /**
   * @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 `IERC721.onERC721Received.selector`.
   */
  function onERC721Received(
    address operator,
    address from,
    uint256 tokenId,
    bytes calldata data
  ) external returns (bytes4);
}

File 17 of 27 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;

import "./IERC165Upgradeable.sol";
import "../proxy/Initializable.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
  /*
   * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
   */
  bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;

  /**
   * @dev Mapping of interface ids to whether or not it's supported.
   */
  mapping(bytes4 => bool) private _supportedInterfaces;

  function __ERC165_init() internal initializer {
    __ERC165_init_unchained();
  }

  function __ERC165_init_unchained() internal initializer {
    // Derived contracts need only register support for their own interfaces,
    // we register support for ERC165 itself here
    _registerInterface(_INTERFACE_ID_ERC165);
  }

  /**
   * @dev See {IERC165-supportsInterface}.
   *
   * Time complexity O(1), guaranteed to always use less than 30 000 gas.
   */
  function supportsInterface(bytes4 interfaceId)
    public
    view
    virtual
    override
    returns (bool)
  {
    return _supportedInterfaces[interfaceId];
  }

  /**
   * @dev Registers the contract as an implementer of the interface defined by
   * `interfaceId`. Support of the actual ERC165 interface is automatic and
   * registering its interface id is not required.
   *
   * See {IERC165-supportsInterface}.
   *
   * Requirements:
   *
   * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
   */
  function _registerInterface(bytes4 interfaceId) internal virtual {
    require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
    _supportedInterfaces[interfaceId] = true;
  }

  uint256[49] private __gap;
}

File 18 of 27 : SafeMathUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMathUpgradeable {
  /**
   * @dev Returns the addition of two unsigned integers, with an overflow flag.
   *
   * _Available since v3.4._
   */
  function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
    uint256 c = a + b;
    if (c < a) return (false, 0);
    return (true, c);
  }

  /**
   * @dev Returns the substraction of two unsigned integers, with an overflow flag.
   *
   * _Available since v3.4._
   */
  function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
    if (b > a) return (false, 0);
    return (true, a - b);
  }

  /**
   * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
   *
   * _Available since v3.4._
   */
  function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
    // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
    if (a == 0) return (true, 0);
    uint256 c = a * b;
    if (c / a != b) return (false, 0);
    return (true, c);
  }

  /**
   * @dev Returns the division of two unsigned integers, with a division by zero flag.
   *
   * _Available since v3.4._
   */
  function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
    if (b == 0) return (false, 0);
    return (true, a / b);
  }

  /**
   * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
   *
   * _Available since v3.4._
   */
  function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
    if (b == 0) return (false, 0);
    return (true, a % b);
  }

  /**
   * @dev Returns the addition of two unsigned integers, reverting on
   * overflow.
   *
   * Counterpart to Solidity's `+` operator.
   *
   * Requirements:
   *
   * - Addition cannot overflow.
   */
  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    require(c >= a, "SafeMath: addition overflow");
    return c;
  }

  /**
   * @dev Returns the subtraction of two unsigned integers, reverting on
   * overflow (when the result is negative).
   *
   * Counterpart to Solidity's `-` operator.
   *
   * Requirements:
   *
   * - Subtraction cannot overflow.
   */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b <= a, "SafeMath: subtraction overflow");
    return a - b;
  }

  /**
   * @dev Returns the multiplication of two unsigned integers, reverting on
   * overflow.
   *
   * Counterpart to Solidity's `*` operator.
   *
   * Requirements:
   *
   * - Multiplication cannot overflow.
   */
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    if (a == 0) return 0;
    uint256 c = a * b;
    require(c / a == b, "SafeMath: multiplication overflow");
    return c;
  }

  /**
   * @dev Returns the integer division of two unsigned integers, reverting on
   * division by zero. The result is rounded towards zero.
   *
   * Counterpart to Solidity's `/` operator. Note: this function uses a
   * `revert` opcode (which leaves remaining gas untouched) while Solidity
   * uses an invalid opcode to revert (consuming all remaining gas).
   *
   * Requirements:
   *
   * - The divisor cannot be zero.
   */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b > 0, "SafeMath: division by zero");
    return a / b;
  }

  /**
   * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
   * reverting when dividing by zero.
   *
   * Counterpart to Solidity's `%` operator. This function uses a `revert`
   * opcode (which leaves remaining gas untouched) while Solidity uses an
   * invalid opcode to revert (consuming all remaining gas).
   *
   * Requirements:
   *
   * - The divisor cannot be zero.
   */
  function mod(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b > 0, "SafeMath: modulo by zero");
    return a % b;
  }

  /**
   * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
   * overflow (when the result is negative).
   *
   * CAUTION: This function is deprecated because it requires allocating memory for the error
   * message unnecessarily. For custom revert reasons use {trySub}.
   *
   * Counterpart to Solidity's `-` operator.
   *
   * Requirements:
   *
   * - Subtraction cannot overflow.
   */
  function sub(
    uint256 a,
    uint256 b,
    string memory errorMessage
  ) internal pure returns (uint256) {
    require(b <= a, errorMessage);
    return a - b;
  }

  /**
   * @dev Returns the integer division of two unsigned integers, reverting with custom message on
   * division by zero. The result is rounded towards zero.
   *
   * CAUTION: This function is deprecated because it requires allocating memory for the error
   * message unnecessarily. For custom revert reasons use {tryDiv}.
   *
   * Counterpart to Solidity's `/` operator. Note: this function uses a
   * `revert` opcode (which leaves remaining gas untouched) while Solidity
   * uses an invalid opcode to revert (consuming all remaining gas).
   *
   * Requirements:
   *
   * - The divisor cannot be zero.
   */
  function div(
    uint256 a,
    uint256 b,
    string memory errorMessage
  ) internal pure returns (uint256) {
    require(b > 0, errorMessage);
    return a / b;
  }

  /**
   * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
   * reverting with custom message when dividing by zero.
   *
   * CAUTION: This function is deprecated because it requires allocating memory for the error
   * message unnecessarily. For custom revert reasons use {tryMod}.
   *
   * Counterpart to Solidity's `%` operator. This function uses a `revert`
   * opcode (which leaves remaining gas untouched) while Solidity uses an
   * invalid opcode to revert (consuming all remaining gas).
   *
   * Requirements:
   *
   * - The divisor cannot be zero.
   */
  function mod(
    uint256 a,
    uint256 b,
    string memory errorMessage
  ) internal pure returns (uint256) {
    require(b > 0, errorMessage);
    return a % b;
  }
}

File 19 of 27 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSetUpgradeable {
  // To implement this library for multiple types with as little code
  // repetition as possible, we write it in terms of a generic Set type with
  // bytes32 values.
  // The Set implementation uses private functions, and user-facing
  // implementations (such as AddressSet) are just wrappers around the
  // underlying Set.
  // This means that we can only create new EnumerableSets for types that fit
  // in bytes32.

  struct Set {
    // Storage of set values
    bytes32[] _values;
    // Position of the value in the `values` array, plus 1 because index 0
    // means a value is not in the set.
    mapping(bytes32 => uint256) _indexes;
  }

  /**
   * @dev Add a value to a set. O(1).
   *
   * Returns true if the value was added to the set, that is if it was not
   * already present.
   */
  function _add(Set storage set, bytes32 value) private returns (bool) {
    if (!_contains(set, value)) {
      set._values.push(value);
      // The value is stored at length-1, but we add 1 to all indexes
      // and use 0 as a sentinel value
      set._indexes[value] = set._values.length;
      return true;
    } else {
      return false;
    }
  }

  /**
   * @dev Removes a value from a set. O(1).
   *
   * Returns true if the value was removed from the set, that is if it was
   * present.
   */
  function _remove(Set storage set, bytes32 value) private returns (bool) {
    // We read and store the value's index to prevent multiple reads from the same storage slot
    uint256 valueIndex = set._indexes[value];

    if (valueIndex != 0) {
      // Equivalent to contains(set, value)
      // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
      // the array, and then remove the last element (sometimes called as 'swap and pop').
      // This modifies the order of the array, as noted in {at}.

      uint256 toDeleteIndex = valueIndex - 1;
      uint256 lastIndex = set._values.length - 1;

      // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
      // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

      bytes32 lastvalue = set._values[lastIndex];

      // Move the last value to the index where the value to delete is
      set._values[toDeleteIndex] = lastvalue;
      // Update the index for the moved value
      set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

      // Delete the slot where the moved value was stored
      set._values.pop();

      // Delete the index for the deleted slot
      delete set._indexes[value];

      return true;
    } else {
      return false;
    }
  }

  /**
   * @dev Returns true if the value is in the set. O(1).
   */
  function _contains(Set storage set, bytes32 value)
    private
    view
    returns (bool)
  {
    return set._indexes[value] != 0;
  }

  /**
   * @dev Returns the number of values on the set. O(1).
   */
  function _length(Set storage set) private view returns (uint256) {
    return set._values.length;
  }

  /**
   * @dev Returns the value stored at position `index` in the set. O(1).
   *
   * Note that there are no guarantees on the ordering of values inside the
   * array, and it may change when more values are added or removed.
   *
   * Requirements:
   *
   * - `index` must be strictly less than {length}.
   */
  function _at(Set storage set, uint256 index) private view returns (bytes32) {
    require(set._values.length > index, "EnumerableSet: index out of bounds");
    return set._values[index];
  }

  // Bytes32Set

  struct Bytes32Set {
    Set _inner;
  }

  /**
   * @dev Add a value to a set. O(1).
   *
   * Returns true if the value was added to the set, that is if it was not
   * already present.
   */
  function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
    return _add(set._inner, value);
  }

  /**
   * @dev Removes a value from a set. O(1).
   *
   * Returns true if the value was removed from the set, that is if it was
   * present.
   */
  function remove(Bytes32Set storage set, bytes32 value)
    internal
    returns (bool)
  {
    return _remove(set._inner, value);
  }

  /**
   * @dev Returns true if the value is in the set. O(1).
   */
  function contains(Bytes32Set storage set, bytes32 value)
    internal
    view
    returns (bool)
  {
    return _contains(set._inner, value);
  }

  /**
   * @dev Returns the number of values in the set. O(1).
   */
  function length(Bytes32Set storage set) internal view returns (uint256) {
    return _length(set._inner);
  }

  /**
   * @dev Returns the value stored at position `index` in the set. O(1).
   *
   * Note that there are no guarantees on the ordering of values inside the
   * array, and it may change when more values are added or removed.
   *
   * Requirements:
   *
   * - `index` must be strictly less than {length}.
   */
  function at(Bytes32Set storage set, uint256 index)
    internal
    view
    returns (bytes32)
  {
    return _at(set._inner, index);
  }

  // AddressSet

  struct AddressSet {
    Set _inner;
  }

  /**
   * @dev Add a value to a set. O(1).
   *
   * Returns true if the value was added to the set, that is if it was not
   * already present.
   */
  function add(AddressSet storage set, address value) internal returns (bool) {
    return _add(set._inner, bytes32(uint256(uint160(value))));
  }

  /**
   * @dev Removes a value from a set. O(1).
   *
   * Returns true if the value was removed from the set, that is if it was
   * present.
   */
  function remove(AddressSet storage set, address value)
    internal
    returns (bool)
  {
    return _remove(set._inner, bytes32(uint256(uint160(value))));
  }

  /**
   * @dev Returns true if the value is in the set. O(1).
   */
  function contains(AddressSet storage set, address value)
    internal
    view
    returns (bool)
  {
    return _contains(set._inner, bytes32(uint256(uint160(value))));
  }

  /**
   * @dev Returns the number of values in the set. O(1).
   */
  function length(AddressSet storage set) internal view returns (uint256) {
    return _length(set._inner);
  }

  /**
   * @dev Returns the value stored at position `index` in the set. O(1).
   *
   * Note that there are no guarantees on the ordering of values inside the
   * array, and it may change when more values are added or removed.
   *
   * Requirements:
   *
   * - `index` must be strictly less than {length}.
   */
  function at(AddressSet storage set, uint256 index)
    internal
    view
    returns (address)
  {
    return address(uint160(uint256(_at(set._inner, index))));
  }

  // UintSet

  struct UintSet {
    Set _inner;
  }

  /**
   * @dev Add a value to a set. O(1).
   *
   * Returns true if the value was added to the set, that is if it was not
   * already present.
   */
  function add(UintSet storage set, uint256 value) internal returns (bool) {
    return _add(set._inner, bytes32(value));
  }

  /**
   * @dev Removes a value from a set. O(1).
   *
   * Returns true if the value was removed from the set, that is if it was
   * present.
   */
  function remove(UintSet storage set, uint256 value) internal returns (bool) {
    return _remove(set._inner, bytes32(value));
  }

  /**
   * @dev Returns true if the value is in the set. O(1).
   */
  function contains(UintSet storage set, uint256 value)
    internal
    view
    returns (bool)
  {
    return _contains(set._inner, bytes32(value));
  }

  /**
   * @dev Returns the number of values on the set. O(1).
   */
  function length(UintSet storage set) internal view returns (uint256) {
    return _length(set._inner);
  }

  /**
   * @dev Returns the value stored at position `index` in the set. O(1).
   *
   * Note that there are no guarantees on the ordering of values inside the
   * array, and it may change when more values are added or removed.
   *
   * Requirements:
   *
   * - `index` must be strictly less than {length}.
   */
  function at(UintSet storage set, uint256 index)
    internal
    view
    returns (uint256)
  {
    return uint256(_at(set._inner, index));
  }
}

File 20 of 27 : EnumerableMapUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are
 * supported.
 */
library EnumerableMapUpgradeable {
  // To implement this library for multiple types with as little code
  // repetition as possible, we write it in terms of a generic Map type with
  // bytes32 keys and values.
  // The Map implementation uses private functions, and user-facing
  // implementations (such as Uint256ToAddressMap) are just wrappers around
  // the underlying Map.
  // This means that we can only create new EnumerableMaps for types that fit
  // in bytes32.

  struct MapEntry {
    bytes32 _key;
    bytes32 _value;
  }

  struct Map {
    // Storage of map keys and values
    MapEntry[] _entries;
    // Position of the entry defined by a key in the `entries` array, plus 1
    // because index 0 means a key is not in the map.
    mapping(bytes32 => uint256) _indexes;
  }

  /**
   * @dev Adds a key-value pair to a map, or updates the value for an existing
   * key. O(1).
   *
   * Returns true if the key was added to the map, that is if it was not
   * already present.
   */
  function _set(
    Map storage map,
    bytes32 key,
    bytes32 value
  ) private returns (bool) {
    // We read and store the key's index to prevent multiple reads from the same storage slot
    uint256 keyIndex = map._indexes[key];

    if (keyIndex == 0) {
      // Equivalent to !contains(map, key)
      map._entries.push(MapEntry({_key: key, _value: value}));
      // The entry is stored at length-1, but we add 1 to all indexes
      // and use 0 as a sentinel value
      map._indexes[key] = map._entries.length;
      return true;
    } else {
      map._entries[keyIndex - 1]._value = value;
      return false;
    }
  }

  /**
   * @dev Removes a key-value pair from a map. O(1).
   *
   * Returns true if the key was removed from the map, that is if it was present.
   */
  function _remove(Map storage map, bytes32 key) private returns (bool) {
    // We read and store the key's index to prevent multiple reads from the same storage slot
    uint256 keyIndex = map._indexes[key];

    if (keyIndex != 0) {
      // Equivalent to contains(map, key)
      // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one
      // in the array, and then remove the last entry (sometimes called as 'swap and pop').
      // This modifies the order of the array, as noted in {at}.

      uint256 toDeleteIndex = keyIndex - 1;
      uint256 lastIndex = map._entries.length - 1;

      // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs
      // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

      MapEntry storage lastEntry = map._entries[lastIndex];

      // Move the last entry to the index where the entry to delete is
      map._entries[toDeleteIndex] = lastEntry;
      // Update the index for the moved entry
      map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based

      // Delete the slot where the moved entry was stored
      map._entries.pop();

      // Delete the index for the deleted slot
      delete map._indexes[key];

      return true;
    } else {
      return false;
    }
  }

  /**
   * @dev Returns true if the key is in the map. O(1).
   */
  function _contains(Map storage map, bytes32 key) private view returns (bool) {
    return map._indexes[key] != 0;
  }

  /**
   * @dev Returns the number of key-value pairs in the map. O(1).
   */
  function _length(Map storage map) private view returns (uint256) {
    return map._entries.length;
  }

  /**
   * @dev Returns the key-value pair stored at position `index` in the map. O(1).
   *
   * Note that there are no guarantees on the ordering of entries inside the
   * array, and it may change when more entries are added or removed.
   *
   * Requirements:
   *
   * - `index` must be strictly less than {length}.
   */
  function _at(Map storage map, uint256 index)
    private
    view
    returns (bytes32, bytes32)
  {
    require(map._entries.length > index, "EnumerableMap: index out of bounds");

    MapEntry storage entry = map._entries[index];
    return (entry._key, entry._value);
  }

  /**
   * @dev Tries to returns the value associated with `key`.  O(1).
   * Does not revert if `key` is not in the map.
   */
  function _tryGet(Map storage map, bytes32 key)
    private
    view
    returns (bool, bytes32)
  {
    uint256 keyIndex = map._indexes[key];
    if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key)
    return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based
  }

  /**
   * @dev Returns the value associated with `key`.  O(1).
   *
   * Requirements:
   *
   * - `key` must be in the map.
   */
  function _get(Map storage map, bytes32 key) private view returns (bytes32) {
    uint256 keyIndex = map._indexes[key];
    require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key)
    return map._entries[keyIndex - 1]._value; // All indexes are 1-based
  }

  /**
   * @dev Same as {_get}, with a custom error message when `key` is not in the map.
   *
   * CAUTION: This function is deprecated because it requires allocating memory for the error
   * message unnecessarily. For custom revert reasons use {_tryGet}.
   */
  function _get(
    Map storage map,
    bytes32 key,
    string memory errorMessage
  ) private view returns (bytes32) {
    uint256 keyIndex = map._indexes[key];
    require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key)
    return map._entries[keyIndex - 1]._value; // All indexes are 1-based
  }

  // UintToAddressMap

  struct UintToAddressMap {
    Map _inner;
  }

  /**
   * @dev Adds a key-value pair to a map, or updates the value for an existing
   * key. O(1).
   *
   * Returns true if the key was added to the map, that is if it was not
   * already present.
   */
  function set(
    UintToAddressMap storage map,
    uint256 key,
    address value
  ) internal returns (bool) {
    return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
  }

  /**
   * @dev Removes a value from a set. O(1).
   *
   * Returns true if the key was removed from the map, that is if it was present.
   */
  function remove(UintToAddressMap storage map, uint256 key)
    internal
    returns (bool)
  {
    return _remove(map._inner, bytes32(key));
  }

  /**
   * @dev Returns true if the key is in the map. O(1).
   */
  function contains(UintToAddressMap storage map, uint256 key)
    internal
    view
    returns (bool)
  {
    return _contains(map._inner, bytes32(key));
  }

  /**
   * @dev Returns the number of elements in the map. O(1).
   */
  function length(UintToAddressMap storage map)
    internal
    view
    returns (uint256)
  {
    return _length(map._inner);
  }

  /**
   * @dev Returns the element stored at position `index` in the set. O(1).
   * Note that there are no guarantees on the ordering of values inside the
   * array, and it may change when more values are added or removed.
   *
   * Requirements:
   *
   * - `index` must be strictly less than {length}.
   */
  function at(UintToAddressMap storage map, uint256 index)
    internal
    view
    returns (uint256, address)
  {
    (bytes32 key, bytes32 value) = _at(map._inner, index);
    return (uint256(key), address(uint160(uint256(value))));
  }

  /**
   * @dev Tries to returns the value associated with `key`.  O(1).
   * Does not revert if `key` is not in the map.
   *
   * _Available since v3.4._
   */
  function tryGet(UintToAddressMap storage map, uint256 key)
    internal
    view
    returns (bool, address)
  {
    (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key));
    return (success, address(uint160(uint256(value))));
  }

  /**
   * @dev Returns the value associated with `key`.  O(1).
   *
   * Requirements:
   *
   * - `key` must be in the map.
   */
  function get(UintToAddressMap storage map, uint256 key)
    internal
    view
    returns (address)
  {
    return address(uint160(uint256(_get(map._inner, bytes32(key)))));
  }

  /**
   * @dev Same as {get}, with a custom error message when `key` is not in the map.
   *
   * CAUTION: This function is deprecated because it requires allocating memory for the error
   * message unnecessarily. For custom revert reasons use {tryGet}.
   */
  function get(
    UintToAddressMap storage map,
    uint256 key,
    string memory errorMessage
  ) internal view returns (address) {
    return
      address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage))));
  }
}

File 21 of 27 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
  /**
   * @dev Converts a `uint256` to its ASCII `string` 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);
    uint256 index = digits - 1;
    temp = value;
    while (temp != 0) {
      buffer[index--] = bytes1(uint8(48 + (temp % 10)));
      temp /= 10;
    }
    return string(buffer);
  }
}

File 22 of 27 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;

/**
 * @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 IERC165Upgradeable {
  /**
   * @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 23 of 27 : IBeacon.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.0;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeacon {
  /**
   * @dev Must return an address that can be used as a delegate call target.
   *
   * {BeaconProxy} will check that this address is a contract.
   */
  function implementation() external view returns (address);
}

File 24 of 27 : Proxy.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/Proxy.sol)

pragma solidity ^0.8.0;

/**
 * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
 * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
 * be specified by overriding the virtual {_implementation} function.
 *
 * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
 * different contract through the {_delegate} function.
 *
 * The success and return data of the delegated call will be returned back to the caller of the proxy.
 */
abstract contract Proxy {
  /**
   * @dev Delegates the current call to `implementation`.
   *
   * This function does not return to its internal call site, it will return directly to the external caller.
   */
  function _delegate(address implementation) internal virtual {
    assembly {
      // Copy msg.data. We take full control of memory in this inline assembly
      // block because it will not return to Solidity code. We overwrite the
      // Solidity scratch pad at memory position 0.
      calldatacopy(0, 0, calldatasize())

      // Call the implementation.
      // out and outsize are 0 because we don't know the size yet.
      let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)

      // Copy the returned data.
      returndatacopy(0, 0, returndatasize())

      switch result
      // delegatecall returns 0 on error.
      case 0 {
        revert(0, returndatasize())
      }
      default {
        return(0, returndatasize())
      }
    }
  }

  /**
   * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
   * and {_fallback} should delegate.
   */
  function _implementation() internal view virtual returns (address);

  /**
   * @dev Delegates the current call to the address returned by `_implementation()`.
   *
   * This function does not return to its internall call site, it will return directly to the external caller.
   */
  function _fallback() internal virtual {
    _beforeFallback();
    _delegate(_implementation());
  }

  /**
   * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
   * function in the contract matches the call data.
   */
  fallback() external payable virtual {
    _fallback();
  }

  /**
   * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
   * is empty.
   */
  receive() external payable virtual {
    _fallback();
  }

  /**
   * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
   * call, or as part of the Solidity `fallback` or `receive` functions.
   *
   * If overriden should call `super._beforeFallback()`.
   */
  function _beforeFallback() internal virtual {}
}

File 25 of 27 : ERC1967Upgrade.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)

pragma solidity ^0.8.2;

import "../beacon/IBeacon.sol";
import "../../interfaces/draft-IERC1822.sol";
import "../../utils/Address.sol";
import "../../utils/StorageSlot.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 *
 * @custom:oz-upgrades-unsafe-allow delegatecall
 */
abstract contract ERC1967Upgrade {
  // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
  bytes32 private constant _ROLLBACK_SLOT =
    0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

  /**
   * @dev Storage slot with the address of the current implementation.
   * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
   * validated in the constructor.
   */
  bytes32 internal constant _IMPLEMENTATION_SLOT =
    0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

  /**
   * @dev Emitted when the implementation is upgraded.
   */
  event Upgraded(address indexed implementation);

  /**
   * @dev Returns the current implementation address.
   */
  function _getImplementation() internal view returns (address) {
    return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
  }

  /**
   * @dev Stores a new address in the EIP1967 implementation slot.
   */
  function _setImplementation(address newImplementation) private {
    require(
      Address.isContract(newImplementation),
      "ERC1967: new implementation is not a contract"
    );
    StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
  }

  /**
   * @dev Perform implementation upgrade
   *
   * Emits an {Upgraded} event.
   */
  function _upgradeTo(address newImplementation) internal {
    _setImplementation(newImplementation);
    emit Upgraded(newImplementation);
  }

  /**
   * @dev Perform implementation upgrade with additional setup call.
   *
   * Emits an {Upgraded} event.
   */
  function _upgradeToAndCall(
    address newImplementation,
    bytes memory data,
    bool forceCall
  ) internal {
    _upgradeTo(newImplementation);
    if (data.length > 0 || forceCall) {
      Address.functionDelegateCall(newImplementation, data);
    }
  }

  /**
   * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
   *
   * Emits an {Upgraded} event.
   */
  function _upgradeToAndCallUUPS(
    address newImplementation,
    bytes memory data,
    bool forceCall
  ) internal {
    // Upgrades from old implementations will perform a rollback test. This test requires the new
    // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
    // this special case will break upgrade paths from old UUPS implementation to new ones.
    if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {
      _setImplementation(newImplementation);
    } else {
      try IERC1822Proxiable(newImplementation).proxiableUUID() returns (
        bytes32 slot
      ) {
        require(
          slot == _IMPLEMENTATION_SLOT,
          "ERC1967Upgrade: unsupported proxiableUUID"
        );
      } catch {
        revert("ERC1967Upgrade: new implementation is not UUPS");
      }
      _upgradeToAndCall(newImplementation, data, forceCall);
    }
  }

  /**
   * @dev Storage slot with the admin of the contract.
   * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
   * validated in the constructor.
   */
  bytes32 internal constant _ADMIN_SLOT =
    0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

  /**
   * @dev Emitted when the admin account has changed.
   */
  event AdminChanged(address previousAdmin, address newAdmin);

  /**
   * @dev Returns the current admin.
   */
  function _getAdmin() internal view returns (address) {
    return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
  }

  /**
   * @dev Stores a new address in the EIP1967 admin slot.
   */
  function _setAdmin(address newAdmin) private {
    require(newAdmin != address(0), "ERC1967: new admin is the zero address");
    StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
  }

  /**
   * @dev Changes the admin of the proxy.
   *
   * Emits an {AdminChanged} event.
   */
  function _changeAdmin(address newAdmin) internal {
    emit AdminChanged(_getAdmin(), newAdmin);
    _setAdmin(newAdmin);
  }

  /**
   * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
   * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
   */
  bytes32 internal constant _BEACON_SLOT =
    0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

  /**
   * @dev Emitted when the beacon is upgraded.
   */
  event BeaconUpgraded(address indexed beacon);

  /**
   * @dev Returns the current beacon.
   */
  function _getBeacon() internal view returns (address) {
    return StorageSlot.getAddressSlot(_BEACON_SLOT).value;
  }

  /**
   * @dev Stores a new beacon in the EIP1967 beacon slot.
   */
  function _setBeacon(address newBeacon) private {
    require(
      Address.isContract(newBeacon),
      "ERC1967: new beacon is not a contract"
    );
    require(
      Address.isContract(IBeacon(newBeacon).implementation()),
      "ERC1967: beacon implementation is not a contract"
    );
    StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;
  }

  /**
   * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
   * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
   *
   * Emits a {BeaconUpgraded} event.
   */
  function _upgradeBeaconToAndCall(
    address newBeacon,
    bytes memory data,
    bool forceCall
  ) internal {
    _setBeacon(newBeacon);
    emit BeaconUpgraded(newBeacon);
    if (data.length > 0 || forceCall) {
      Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
    }
  }
}

File 26 of 27 : draft-IERC1822.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
 * proxy whose upgrades are fully controlled by the current implementation.
 */
interface IERC1822Proxiable {
  /**
   * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
   * address.
   *
   * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
   * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
   * function revert if invoked through a proxy.
   */
  function proxiableUUID() external view returns (bytes32);
}

File 27 of 27 : 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);
      }
    }
  }
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"controller","type":"address"}],"name":"ControllerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"controller","type":"address"}],"name":"ControllerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"string","name":"label","type":"string"},{"indexed":true,"internalType":"uint256","name":"labelHash","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"parent","type":"uint256"},{"indexed":false,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"address","name":"controller","type":"address"},{"indexed":false,"internalType":"string","name":"metadataUri","type":"string"},{"indexed":false,"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"name":"DomainCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"string","name":"uri","type":"string"}],"name":"MetadataChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"locker","type":"address"},{"indexed":false,"internalType":"bool","name":"isLocked","type":"bool"}],"name":"MetadataLockChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RoyaltiesAmountChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"controller","type":"address"}],"name":"addController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"adminBurnToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"folderWithIPFSPrefix","type":"string"},{"internalType":"uint256[]","name":"orderedIds","type":"uint256[]"},{"internalType":"uint256","name":"ipfsFolderIndexOffset","type":"uint256"}],"name":"adminSetMetadataBulk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"folderWithIPFSPrefix","type":"string"},{"internalType":"uint256","name":"tokenIndexStart","type":"uint256"},{"internalType":"uint256","name":"ipfsFolderIndexStart","type":"uint256"},{"internalType":"uint256","name":"count","type":"uint256"}],"name":"adminSetMetadataBulkByIndex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"string","name":"uri","type":"string"}],"name":"adminSetMetadataUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"adminTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"beacon","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"controllers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"domainController","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"domainExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"domainMetadataLockedBy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"domainRoyaltyAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"parentRegistrar_","type":"address"},{"internalType":"uint256","name":"rootDomainId_","type":"uint256"},{"internalType":"string","name":"collectionName","type":"string"},{"internalType":"string","name":"collectionSymbol","type":"string"},{"internalType":"address","name":"zNSHub_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isController","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"isDomainMetadataLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bool","name":"toLock","type":"bool"}],"name":"lockDomainMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"minterOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"parentOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"parentRegistrar","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"records","outputs":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"bool","name":"metadataLocked","type":"bool"},{"internalType":"address","name":"metadataLockedBy","type":"address"},{"internalType":"address","name":"controller","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"},{"internalType":"uint256","name":"parentId","type":"uint256"},{"internalType":"address","name":"subdomainContract","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"parentId","type":"uint256"},{"internalType":"string","name":"label","type":"string"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"string","name":"metadataUri","type":"string"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"},{"internalType":"bool","name":"locked","type":"bool"}],"name":"registerDomain","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"parentId","type":"uint256"},{"internalType":"string","name":"label","type":"string"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"string","name":"metadataUri","type":"string"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"},{"internalType":"bool","name":"locked","type":"bool"},{"internalType":"address","name":"sendToUser","type":"address"}],"name":"registerDomainAndSend","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"parentId","type":"uint256"},{"internalType":"uint256","name":"namingOffset","type":"uint256"},{"internalType":"uint256","name":"startingIndex","type":"uint256"},{"internalType":"uint256","name":"endingIndex","type":"uint256"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"string","name":"folderWithIPFSPrefix","type":"string"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"},{"internalType":"bool","name":"locked","type":"bool"}],"name":"registerDomainAndSendBulk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"parentId","type":"uint256"},{"internalType":"string","name":"label","type":"string"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"string","name":"metadataUri","type":"string"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"},{"internalType":"bool","name":"locked","type":"bool"},{"internalType":"address","name":"sendToUser","type":"address"}],"name":"registerSubdomainContract","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"controller","type":"address"}],"name":"removeController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rootDomainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"string","name":"uri","type":"string"}],"name":"setAndLockDomainMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"string","name":"uri","type":"string"}],"name":"setDomainMetadataUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setDomainRoyaltyAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IZNSHub","name":"hub","type":"address"}],"name":"setZNSHub","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"transferFromBulk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"zNSHub","outputs":[{"internalType":"contract IZNSHub","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b506155ac806100206000396000f3fe60806040523480156200001157600080fd5b5060043610620003a45760003560e01c80637efcc90d11620001f9578063be21eccd1162000119578063e985e9c511620000af578063f2fde38b1162000086578063f2fde38b1462000965578063f6a74ed7146200097c578063fb7b395e1462000993578063fda9b94a146200099e57600080fd5b8063e985e9c514620008f8578063ea0458041462000937578063ec62558d146200094e57600080fd5b8063cfa3c13211620000f0578063cfa3c132146200088c578063d428bc7714620008a3578063da72c1e814620008ba578063da8c229e14620008d157600080fd5b8063be21eccd1462000847578063be25304e146200085e578063c87b56dd146200087557600080fd5b80639c4f6c6d116200018f578063a7fc7a071162000166578063a7fc7a0714620007d2578063aca05acc14620007e9578063b429afeb1462000800578063b88d4fde146200083057600080fd5b80639c4f6c6d14620007775780639e942ace146200078e578063a22cb46514620007bb57600080fd5b80638da5cb5b11620001d05780638da5cb5b14620007355780638de2dec9146200073f5780639083709a146200075657806395d89b41146200076d57600080fd5b80637efcc90d14620006e45780637f861b1a14620007145780638456cb59146200072b57600080fd5b80633a47040f11620002e5578063620e42ea116200027b57806370a08231116200025257806370a082311462000685578063715018a6146200069c5780637ad3e55b14620006a65780637da111fe14620006cd57600080fd5b8063620e42ea14620006345780636352211e14620006645780636c0360eb146200067b57600080fd5b806342842e0e11620002bc57806342842e0e14620005e55780634f6ccce714620005fc57806359659e9014620006135780635c975abb146200062857600080fd5b80633a47040f14620005af5780633f4ba83a14620005c457806341d01e7c14620005ce57600080fd5b806318160ddd116200035b5780632f745c5911620003325780632f745c5914620004c557806334038d4814620004dc5780633446106714620004f357806337aa32ba146200059a57600080fd5b806318160ddd146200047e57806323b872dd14620004975780632566193f14620004ae57600080fd5b806301ffc9a714620003a9578063059fb6f714620003ee57806306fdde031462000407578063081812fc1462000420578063095ea7b314620004505780630bfb66c51462000467575b600080fd5b620003d9620003ba36600462003ed9565b6001600160e01b03191660009081526033602052604090205460ff1690565b60405190151581526020015b60405180910390f35b62000405620003ff36600462003f0f565b620009b5565b005b6200041162000a44565b604051620003e5919062004009565b62000437620004313660046200401e565b62000ade565b6040516001600160a01b039091168152602001620003e5565b620004056200046136600462004038565b62000b6a565b620004056200047836600462004130565b62000c8b565b6200048862000d33565b604051908152602001620003e5565b62000405620004a836600462004187565b62000d46565b62000405620004bf366004620041cd565b62000d7d565b62000488620004d636600462004038565b62000e62565b62000488620004ed366004620041ff565b62000e8f565b62000554620005043660046200401e565b61012e602052600090815260409020805460018201546002830154600384015460048501546005909501546001600160a01b0380861696600160a01b90960460ff16959481169493811693911687565b604080516001600160a01b0398891681529615156020880152948716948601949094529185166060850152608084015260a083015290911660c082015260e001620003e5565b6101315462000437906001600160a01b031681565b6101325462000437906001600160a01b031681565b6200040562000f7d565b62000405620005df366004620042be565b62000fbd565b62000405620005f636600462004187565b6200102a565b620004886200060d3660046200401e565b62001047565b61012f5462000437906001600160a01b031681565b60c95460ff16620003d9565b62000437620006453660046200401e565b600090815261012e60205260409020600101546001600160a01b031690565b62000437620006753660046200401e565b6200105f565b620004116200110e565b620004886200069636600462004308565b6200111f565b62000405620011af565b62000488620006b73660046200401e565b600090815261012e602052604090206003015490565b62000405620006de366004620042be565b6200122d565b62000437620006f53660046200401e565b600090815261012e60205260409020600201546001600160a01b031690565b620004056200072536600462004328565b62001271565b6200040562001301565b620004376200133f565b620003d9620007503660046200401e565b620013b1565b620004056200076736600462004407565b620013c6565b6200041162001550565b6200040562000788366004620044a3565b62001561565b620004376200079f3660046200401e565b600090815261012e60205260409020546001600160a01b031690565b62000405620007cc366004620044d6565b6200157a565b62000405620007e336600462004308565b62001641565b62000488620007fa36600462004509565b62001772565b620003d96200081136600462004308565b6001600160a01b0316600090815261012d602052604090205460ff1690565b6200040562000841366004620045b2565b6200183e565b620003d9620008583660046200401e565b62001877565b620004886200086f366004620041ff565b62001894565b62000411620008863660046200401e565b62001b90565b620004886200089d3660046200401e565b62001d18565b62000405620008b4366004620042be565b62001d7f565b62000405620008cb36600462004187565b62001dfa565b620003d9620008e236600462004308565b61012d6020526000908152604090205460ff1681565b620003d9620009093660046200463a565b6001600160a01b039182166000908152609b6020908152604080832093909416825291909152205460ff1690565b620004056200094836600462004308565b62001e2e565b620004056200095f3660046200401e565b62001e85565b620004056200097636600462004308565b62001f1b565b620004056200098d36600462004308565b62002012565b620004886101305481565b62000405620009af366004620046b1565b62002173565b60005b8181101562000a3d576000838383818110620009d857620009d86200474b565b905060200201359050620009f4620009ed3390565b82620022da565b62000a1c5760405162461bcd60e51b815260040162000a139062004761565b60405180910390fd5b62000a29868683620023ce565b5062000a3581620047c8565b9050620009b8565b5050505050565b6060609c805462000a5590620047e6565b80601f016020809104026020016040519081016040528092919081815260200182805462000a8390620047e6565b801562000ad45780601f1062000aa85761010080835404028352916020019162000ad4565b820191906000526020600020905b81548152906001019060200180831162000ab657829003601f168201915b5050505050905090565b600062000aeb826200241e565b62000b4e5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840162000a13565b506000908152609a60205260409020546001600160a01b031690565b600062000b77826200242d565b9050806001600160a01b0316836001600160a01b0316141562000be75760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840162000a13565b336001600160a01b038216148062000c06575062000c06813362000909565b62000c7a5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840162000a13565b62000c86838362002458565b505050565b3362000c966200133f565b6001600160a01b03161462000cbf5760405162461bcd60e51b815260040162000a139062004823565b60005b8181101562000a3d5762000d1e62000cdf6200060d838762004858565b8662000cf662000cf0858862004858565b620024c8565b60405160200162000d0992919062004873565b6040516020818303038152906040526200260c565b8062000d2a81620047c8565b91505062000cc2565b600062000d41609862002685565b905090565b62000d5133620009ed565b62000d705760405162461bcd60e51b815260040162000a139062004761565b62000c86838383620023ce565b813362000d8a826200105f565b6001600160a01b03161462000db35760405162461bcd60e51b815260040162000a1390620048a6565b62000dbe8362001877565b1562000dde5760405162461bcd60e51b815260040162000a1390620048cd565b600083815261012e602052604090819020600301839055610132549051636f88668760e11b815260048101859052602481018490526001600160a01b039091169063df10cd0e906044015b600060405180830381600087803b15801562000e4457600080fd5b505af115801562000e59573d6000803e3d6000fd5b50505050505050565b6001600160a01b038216600090815260976020526040812062000e86908362002690565b90505b92915050565b33600090815261012d602052604081205460ff1615801562000f2057506101325460405163b429afeb60e01b81523360048201526001600160a01b039091169063b429afeb906024016020604051808303816000875af115801562000ef8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f1e9190620048fa565b155b1562000f405760405162461bcd60e51b815260040162000a13906200491a565b600062000f528989898989896200269e565b905062000f7187848360405180602001604052806000815250620028ea565b98975050505050505050565b3362000f886200133f565b6001600160a01b03161462000fb15760405162461bcd60e51b815260040162000a139062004823565b62000fbb6200296e565b565b813362000fca826200105f565b6001600160a01b03161462000ff35760405162461bcd60e51b815260040162000a1390620048a6565b62000ffe8362001877565b156200101e5760405162461bcd60e51b815260040162000a1390620048cd565b62000c8683836200260c565b62000c86838383604051806020016040528060008152506200183e565b6000806200105760988462002a03565b509392505050565b60006200106e60988362002a23565b156200109d5762000e89826040518060600160405280602981526020016200554e602991396098919062002a3c565b610132546040516331a9108f60e11b8152600481018490526001600160a01b0390911690636352211e90602401602060405180830381865afa158015620010e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000e89919062004946565b6060609f805462000a5590620047e6565b60006001600160a01b0382166200118c5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840162000a13565b6001600160a01b038216600090815260976020526040902062000e899062002685565b33620011ba6200133f565b6001600160a01b031614620011e35760405162461bcd60e51b815260040162000a139062004823565b6065546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3606580546001600160a01b0319169055565b33620012386200133f565b6001600160a01b031614620012615760405162461bcd60e51b815260040162000a139062004823565b6200126d82826200260c565b5050565b336200127c6200133f565b6001600160a01b031614620012a55760405162461bcd60e51b815260040162000a139062004823565b60005b8251811015620012fb57620012e6838281518110620012cb57620012cb6200474b565b60200260200101518562000cf6848662000cf0919062004858565b80620012f281620047c8565b915050620012a8565b50505050565b336200130c6200133f565b6001600160a01b031614620013355760405162461bcd60e51b815260040162000a139062004823565b62000fbb62002a4b565b6101325460408051638da5cb5b60e01b815290516000926001600160a01b031691638da5cb5b9160048083019260209291908290030181865afa1580156200138b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000d41919062004946565b600080620013bf836200241e565b9392505050565b33600090815261012d602052604090205460ff161580156200145757506101325460405163b429afeb60e01b81523360048201526001600160a01b039091169063b429afeb906024016020604051808303816000875af11580156200142f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014559190620048fa565b155b15620014775760405162461bcd60e51b815260040162000a13906200491a565b600062001485878762004966565b11620014d45760405162461bcd60e51b815260206004820152601960248201527f496e76616c6964206e756d626572206f6620646f6d61696e7300000000000000604482015260640162000a13565b6000865b8681101562001544576200152d8a620014f662000cf08c8562004858565b88886200150386620024c8565b6040516020016200151692919062004873565b60405160208183030381529060405288886200269e565b9150806200153b81620047c8565b915050620014d8565b50505050505050505050565b6060609d805462000a5590620047e6565b6200156d828262002ac9565b6200126d82338362002bd7565b6001600160a01b038216331415620015d55760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640162000a13565b336000818152609b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6200164b6200133f565b6001600160a01b0316336001600160a01b03161480620016765750610131546001600160a01b031633145b620016b95760405162461bcd60e51b815260206004820152601260248201527116948e88139bdd08185d5d1a1bdc9a5e995960721b604482015260640162000a13565b6001600160a01b038116600090815261012d602052604090205460ff1615620017255760405162461bcd60e51b815260206004820152601f60248201527f5a523a20436f6e74726f6c6c657220697320616c726561647920616464656400604482015260640162000a13565b6001600160a01b038116600081815261012d6020526040808220805460ff19166001179055517f0a8bb31534c0ed46f380cb867bd5c803a189ced9a764e30b3a4991a9901d74749190a250565b33600090815261012d602052604081205460ff161580156200180357506101325460405163b429afeb60e01b81523360048201526001600160a01b039091169063b429afeb906024016020604051808303816000875af1158015620017db573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620018019190620048fa565b155b15620018235760405162461bcd60e51b815260040162000a13906200491a565b620018338787878787876200269e565b979650505050505050565b6200184a3383620022da565b620018695760405162461bcd60e51b815260040162000a139062004761565b620012fb84848484620028ea565b600090815261012e6020526040902054600160a01b900460ff1690565b33600090815261012d602052604081205460ff161580156200192557506101325460405163b429afeb60e01b81523360048201526001600160a01b039091169063b429afeb906024016020604051808303816000875af1158015620018fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019239190620048fa565b155b15620019455760405162461bcd60e51b815260040162000a13906200491a565b6000620019578989898989896200269e565b9050600061013260009054906101000a90046001600160a01b03166001600160a01b031663e1cc84906040518163ffffffff1660e01b8152600401602060405180830381865afa158015620019b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019d6919062004946565b604051620019e49062003dcf565b6001600160a01b039091168152604060208201819052600090820152606001604051809103906000f08015801562001a20573d6000803e3d6000fd5b5061013254604051637ed4dca560e11b81523060048201526024810185905260a06044820152601160a4820152705a657230204e616d65205365727669636560781b60c482015260e06064820152600360e4820152625a4e5360e81b6101048201526001600160a01b03918216608482015291925082169063fda9b94a9061012401600060405180830381600087803b15801562001abd57600080fd5b505af115801562001ad2573d6000803e3d6000fd5b505050600083815261012e60205260409081902060050180546001600160a01b0319166001600160a01b03858116918217909255610132549251633f7baeb960e01b815260048101879052602481019190915291169150633f7baeb990604401600060405180830381600087803b15801562001b4d57600080fd5b505af115801562001b62573d6000803e3d6000fd5b5050505062001b8388858460405180602001604052806000815250620028ea565b5098975050505050505050565b606062001b9d826200241e565b62001c035760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840162000a13565b6000828152609e60205260408120805462001c1e90620047e6565b80601f016020809104026020016040519081016040528092919081815260200182805462001c4c90620047e6565b801562001c9d5780601f1062001c715761010080835404028352916020019162001c9d565b820191906000526020600020905b81548152906001019060200180831162001c7f57829003601f168201915b50505050509050600062001cb06200110e565b905080516000141562001cc4575092915050565b81511562001cf957808260405160200162001ce192919062004873565b60405160208183030381529060405292505050919050565b8062001d058562002c5f565b60405160200162001ce192919062004873565b600062001d25826200241e565b62001d685760405162461bcd60e51b815260206004820152601260248201527116948e88111bd95cc81b9bdd08195e1a5cdd60721b604482015260640162000a13565b50600090815261012e602052604090206004015490565b813362001d8c826200105f565b6001600160a01b03161462001db55760405162461bcd60e51b815260040162000a1390620048a6565b62001dc08362001877565b1562001de05760405162461bcd60e51b815260040162000a1390620048cd565b62001dec83836200260c565b62000c868333600162002bd7565b3362001e056200133f565b6001600160a01b03161462000d705760405162461bcd60e51b815260040162000a139062004823565b3362001e396200133f565b6001600160a01b03161462001e625760405162461bcd60e51b815260040162000a139062004823565b61013280546001600160a01b0319166001600160a01b0392909216919091179055565b3362001e906200133f565b6001600160a01b03161462001eb95760405162461bcd60e51b815260040162000a139062004823565b62001ec48162002d86565b600090815261012e6020526040812080546001600160a81b03191681556001810180546001600160a01b03199081169091556002820180548216905560038201839055600482019290925560050180549091169055565b3362001f266200133f565b6001600160a01b03161462001f4f5760405162461bcd60e51b815260040162000a139062004823565b6001600160a01b03811662001fb65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000a13565b6065546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3606580546001600160a01b0319166001600160a01b0392909216919091179055565b336200201d6200133f565b6001600160a01b031614620020465760405162461bcd60e51b815260040162000a139062004823565b620020506200133f565b6001600160a01b0316336001600160a01b031614806200207b5750610131546001600160a01b031633145b620020be5760405162461bcd60e51b815260206004820152601260248201527116948e88139bdd08185d5d1a1bdc9a5e995960721b604482015260640162000a13565b6001600160a01b038116600090815261012d602052604090205460ff16620021295760405162461bcd60e51b815260206004820152601d60248201527f5a523a20436f6e74726f6c6c657220646f6573206e6f74206578697374000000604482015260640162000a13565b6001600160a01b038116600081815261012d6020526040808220805460ff19169055517f33d83959be2573f5453b12eb9d43b3499bc57d96bd2f067ba44803c859e811139190a250565b600054610100900460ff1680620021895750303b155b8062002198575060005460ff16155b620021b75760405162461bcd60e51b815260040162000a139062004980565b600054610100900460ff16158015620021da576000805461ffff19166101011790555b6001600160a01b038816620021ff57620021f960008033600062002e5b565b62002222565b61013087905561013180546001600160a01b0319166001600160a01b038a161790555b61013280546001600160a01b0319166001600160a01b0384161790556200224862002f30565b620022bd86868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a01819004810282018101909252888152925088915087908190840183828082843760009201919091525062002fd592505050565b8015620022d0576000805461ff00191690555b5050505050505050565b6000620022e7826200241e565b6200234a5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840162000a13565b600062002357836200242d565b9050806001600160a01b0316846001600160a01b03161480620023955750836001600160a01b03166200238a8462000ade565b6001600160a01b0316145b80620023c657506001600160a01b038082166000908152609b602090815260408083209388168352929052205460ff165b949350505050565b620023db83838362003073565b61013254604051631c9f41b760e11b81526001600160a01b0385811660048301528481166024830152604482018490529091169063393e836e9060640162000e29565b600062000e8960988362002a23565b600062000e89826040518060600160405280602981526020016200554e602991396098919062002a3c565b6000818152609a6020526040902080546001600160a01b0319166001600160a01b03841690811790915581906200248f826200242d565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b606081620024ed5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156200251d57806200250481620047c8565b9150620025159050600a83620049e4565b9150620024f1565b6000816001600160401b038111156200253a576200253a62004067565b6040519080825280601f01601f19166020018201604052801562002565576020820181803683370190505b509050815b851562002603576200257e60018262004966565b905060006200258f600a88620049e4565b6200259c90600a620049fb565b620025a8908862004966565b620025b590603062004a1d565b905060008160f81b905080848481518110620025d557620025d56200474b565b60200101906001600160f81b031916908160001a905350620025f9600a89620049e4565b975050506200256a565b50949350505050565b6200261882826200320f565b610132546040516302e76c3560e31b81526001600160a01b039091169063173b61a8906200264d908590859060040162004a45565b600060405180830381600087803b1580156200266857600080fd5b505af11580156200267d573d6000803e3d6000fd5b505050505050565b600062000e89825490565b600062000e86838362003230565b600080865111620026e35760405162461bcd60e51b815260206004820152600e60248201526d5a523a20456d707479206e616d6560901b604482015260640162000a13565b600087815261012e60205260409020600501546001600160a01b0316156200274e5760405162461bcd60e51b815260206004820152601960248201527f5a523a20506172656e7420697320737562636f6e747261637400000000000000604482015260640162000a13565b610130548714620027a25762002764876200241e565b620027a25760405162461bcd60e51b815260206004820152600d60248201526c16948e88139bc81c185c995b9d609a1b604482015260640162000a13565b8551602080880191909120604080518084018b9052808201839052815180820383018152606090910190915280519201919091203390620027e68a828a8562002e5b565b620027f281886200320f565b84156200283957600081815261012e602052604090206001810180546001600160a01b038b166001600160a01b0319909116179055805460ff60a01b1916600160a01b1790555b85156200285657600081815261012e602052604090206003018690555b61013260009054906101000a90046001600160a01b03166001600160a01b0316630738d081828b868e8d888e8e6040518963ffffffff1660e01b8152600401620028a898979695949392919062004a60565b600060405180830381600087803b158015620028c357600080fd5b505af1158015620028d8573d6000803e3d6000fd5b50929c9b505050505050505050505050565b620028f7848484620023ce565b6200290584848484620032bb565b620012fb5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606482015260840162000a13565b60c95460ff16620029b95760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640162000a13565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080808062002a14868662003395565b909450925050505b9250929050565b6000818152600183016020526040812054151562000e86565b6000620023c684848462003437565b60c95460ff161562002a935760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640162000a13565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258620029e63390565b801562002b30573362002adc836200105f565b6001600160a01b03161462002b055760405162461bcd60e51b815260040162000a1390620048a6565b62002b108262001877565b156200126d5760405162461bcd60e51b815260040162000a1390620048cd565b62002b3b8262001877565b62002b7a5760405162461bcd60e51b815260206004820152600e60248201526d16948e88139bdd081b1bd8dad95960921b604482015260640162000a13565b600082815261012e60205260409020600101546001600160a01b031633146200126d5760405162461bcd60e51b815260206004820152600e60248201526d2d291d102737ba103637b1b5b2b960911b604482015260640162000a13565b600083815261012e6020526040908190206001810180546001600160a01b0319166001600160a01b03868116918217909255825460ff60a01b1916600160a01b8615159081029190911790935561013254935163e43ad7d560e01b81526004810188905260248101919091526044810192909252919091169063e43ad7d59060640162000e29565b60608162002c845750506040805180820190915260018152600360fc1b602082015290565b8160005b811562002cb4578062002c9b81620047c8565b915062002cac9050600a83620049e4565b915062002c88565b6000816001600160401b0381111562002cd15762002cd162004067565b6040519080825280601f01601f19166020018201604052801562002cfc576020820181803683370190505b509050600062002d0e60018462004966565b90508593505b8315620026035762002d28600a8562004acd565b62002d3590603062004858565b60f81b828262002d458162004ae4565b93508151811062002d5a5762002d5a6200474b565b60200101906001600160f81b031916908160001a90535062002d7e600a85620049e4565b935062002d14565b600062002d93826200242d565b905062002da381600084620034a8565b62002db060008362002458565b6000828152609e60205260409020805462002dcb90620047e6565b15905062002dec576000828152609e6020526040812062002dec9162003ddd565b6001600160a01b038116600090815260976020526040902062002e10908362003511565b5062002e1e6098836200351f565b5060405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b62002e6782846200352d565b6040805160e0810182526001600160a01b03938416815260006020808301828152838501838152958716606085019081526080850184815260a086019a8b5260c0860185815299855261012e909352949092209251835492511515600160a01b026001600160a81b03199093169087161791909117825592516001820180549186166001600160a01b0319928316179055915160028201805491861691841691909117905591516003830155935160048201559151600590920180549290911691909216179055565b600054610100900460ff168062002f465750303b155b8062002f55575060005460ff16155b62002f745760405162461bcd60e51b815260040162000a139062004980565b600054610100900460ff1615801562002f97576000805461ffff19166101011790555b62002fa16200365d565b62002fab620036d8565b62002fb562003751565b62002fbf6200365d565b801562002fd2576000805461ff00191690555b50565b600054610100900460ff168062002feb5750303b155b8062002ffa575060005460ff16155b620030195760405162461bcd60e51b815260040162000a139062004980565b600054610100900460ff161580156200303c576000805461ffff19166101011790555b620030466200365d565b62003050620036d8565b6200305c8383620037d7565b801562000c86576000805461ff0019169055505050565b826001600160a01b031662003088826200242d565b6001600160a01b031614620030f25760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b606482015260840162000a13565b6001600160a01b038216620031565760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840162000a13565b62003163838383620034a8565b6200317060008262002458565b6001600160a01b038316600090815260976020526040902062003194908262003511565b506001600160a01b0382166000908152609760205260409020620031b99082620038a0565b50620031c860988284620038ae565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000828152609e60209081526040909120825162000c869284019062003e1c565b81546000908210620032905760405162461bcd60e51b815260206004820152602260248201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604482015261647360f01b606482015260840162000a13565b826000018281548110620032a857620032a86200474b565b9060005260206000200154905092915050565b60006001600160a01b0384163b620032d657506001620023c6565b60006200335c630a85bd0160e11b33888787604051602401620032fd949392919062004afe565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050506040518060600160405280603281526020016200551c603291396001600160a01b0388169190620038c6565b905060008180602001905181019062003376919062004b3d565b6001600160e01b031916630a85bd0160e11b1492505050949350505050565b815460009081908310620033f75760405162461bcd60e51b815260206004820152602260248201527f456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e604482015261647360f01b606482015260840162000a13565b60008460000184815481106200341157620034116200474b565b906000526020600020906002020190508060000154816001015492509250509250929050565b600082815260018401602052604081205482816200346a5760405162461bcd60e51b815260040162000a13919062004009565b50846200347960018362004966565b815481106200348c576200348c6200474b565b9060005260206000209060020201600101549150509392505050565b60c95460ff161562000c865760405162461bcd60e51b815260206004820152602b60248201527f4552433732315061757361626c653a20746f6b656e207472616e73666572207760448201526a1a1a5b19481c185d5cd95960aa1b606482015260840162000a13565b600062000e868383620038d7565b600062000e868383620039dc565b6001600160a01b038216620035855760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640162000a13565b62003590816200241e565b15620035df5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640162000a13565b620035ed60008383620034a8565b6001600160a01b0382166000908152609760205260409020620036119082620038a0565b506200362060988284620038ae565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600054610100900460ff1680620036735750303b155b8062003682575060005460ff16155b620036a15760405162461bcd60e51b815260040162000a139062004980565b600054610100900460ff1615801562002fbf576000805461ffff1916610101179055801562002fd2576000805461ff001916905550565b600054610100900460ff1680620036ee5750303b155b80620036fd575060005460ff16155b6200371c5760405162461bcd60e51b815260040162000a139062004980565b600054610100900460ff161580156200373f576000805461ffff19166101011790555b62002fbf6301ffc9a760e01b62003af4565b600054610100900460ff1680620037675750303b155b8062003776575060005460ff16155b620037955760405162461bcd60e51b815260040162000a139062004980565b600054610100900460ff16158015620037b8576000805461ffff19166101011790555b60c9805460ff19169055801562002fd2576000805461ff001916905550565b600054610100900460ff1680620037ed5750303b155b80620037fc575060005460ff16155b6200381b5760405162461bcd60e51b815260040162000a139062004980565b600054610100900460ff161580156200383e576000805461ffff19166101011790555b82516200385390609c90602086019062003e1c565b5081516200386990609d90602085019062003e1c565b506200387c6380ac58cd60e01b62003af4565b6200388e635b5e139f60e01b62003af4565b6200305c63780e9d6360e01b62003af4565b600062000e86838362003b75565b6000620023c684846001600160a01b03851662003bc7565b6060620023c6848460008562003c70565b60008181526001830160205260408120548015620039d1576000620038fe60018362004966565b8554909150600090620039149060019062004966565b905060008660000182815481106200393057620039306200474b565b90600052602060002001549050808760000184815481106200395657620039566200474b565b6000918252602090912001556200396f83600162004858565b6000828152600189016020526040902055865487908062003994576200399462004b5d565b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505062000e89565b600091505062000e89565b60008181526001830160205260408120548015620039d157600062003a0360018362004966565b855490915060009062003a199060019062004966565b9050600086600001828154811062003a355762003a356200474b565b906000526020600020906002020190508087600001848154811062003a5e5762003a5e6200474b565b6000918252602090912082546002909202019081556001918201549082015562003a8a90849062004858565b81546000908152600189016020526040902055865487908062003ab15762003ab162004b5d565b600082815260208082206002600019909401938402018281556001908101839055929093558881528982019092526040822091909155945062000e899350505050565b6001600160e01b0319808216141562003b505760405162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015260640162000a13565b6001600160e01b0319166000908152603360205260409020805460ff19166001179055565b600081815260018301602052604081205462003bbe5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000e89565b50600062000e89565b60008281526001840160205260408120548062003c2e575050604080518082018252838152602080820184815286546001818101895560008981528481209551600290930290950191825591519082015586548684528188019092529290912055620013bf565b828562003c3d60018462004966565b8154811062003c505762003c506200474b565b9060005260206000209060020201600101819055506000915050620013bf565b60608247101562003cd35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840162000a13565b843b62003d235760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000a13565b600080866001600160a01b0316858760405162003d41919062004b73565b60006040518083038185875af1925050503d806000811462003d80576040519150601f19603f3d011682016040523d82523d6000602084013e62003d85565b606091505b5091509150620018338282866060831562003da2575081620013bf565b82511562003db35782518084602001fd5b8160405162461bcd60e51b815260040162000a13919062004009565b61098a8062004b9283390190565b50805462003deb90620047e6565b6000825580601f1062003dfc575050565b601f01602090049060005260206000209081019062002fd2919062003eab565b82805462003e2a90620047e6565b90600052602060002090601f01602090048101928262003e4e576000855562003e99565b82601f1062003e6957805160ff191683800117855562003e99565b8280016001018555821562003e99579182015b8281111562003e9957825182559160200191906001019062003e7c565b5062003ea792915062003eab565b5090565b5b8082111562003ea7576000815560010162003eac565b6001600160e01b03198116811462002fd257600080fd5b60006020828403121562003eec57600080fd5b8135620013bf8162003ec2565b6001600160a01b038116811462002fd257600080fd5b6000806000806060858703121562003f2657600080fd5b843562003f338162003ef9565b9350602085013562003f458162003ef9565b925060408501356001600160401b038082111562003f6257600080fd5b818701915087601f83011262003f7757600080fd5b81358181111562003f8757600080fd5b8860208260051b850101111562003f9d57600080fd5b95989497505060200194505050565b60005b8381101562003fc957818101518382015260200162003faf565b83811115620012fb5750506000910152565b6000815180845262003ff581602086016020860162003fac565b601f01601f19169290920160200192915050565b60208152600062000e86602083018462003fdb565b6000602082840312156200403157600080fd5b5035919050565b600080604083850312156200404c57600080fd5b8235620040598162003ef9565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620040a857620040a862004067565b604052919050565b60006001600160401b03831115620040cc57620040cc62004067565b620040e1601f8401601f19166020016200407d565b9050828152838383011115620040f657600080fd5b828260208301376000602084830101529392505050565b600082601f8301126200411f57600080fd5b62000e8683833560208501620040b0565b600080600080608085870312156200414757600080fd5b84356001600160401b038111156200415e57600080fd5b6200416c878288016200410d565b97602087013597506040870135966060013595509350505050565b6000806000606084860312156200419d57600080fd5b8335620041aa8162003ef9565b92506020840135620041bc8162003ef9565b929592945050506040919091013590565b60008060408385031215620041e157600080fd5b50508035926020909101359150565b801515811462002fd257600080fd5b600080600080600080600060e0888a0312156200421b57600080fd5b8735965060208801356001600160401b03808211156200423a57600080fd5b620042488b838c016200410d565b975060408a013591506200425c8262003ef9565b909550606089013590808211156200427357600080fd5b50620042828a828b016200410d565b9450506080880135925060a08801356200429c81620041f0565b915060c0880135620042ae8162003ef9565b8091505092959891949750929550565b60008060408385031215620042d257600080fd5b8235915060208301356001600160401b03811115620042f057600080fd5b620042fe858286016200410d565b9150509250929050565b6000602082840312156200431b57600080fd5b8135620013bf8162003ef9565b6000806000606084860312156200433e57600080fd5b83356001600160401b03808211156200435657600080fd5b62004364878388016200410d565b94506020915081860135818111156200437c57600080fd5b8601601f810188136200438e57600080fd5b803582811115620043a357620043a362004067565b8060051b9250620043b68484016200407d565b818152928201840192848101908a851115620043d157600080fd5b928501925b84841015620043f157833582529285019290850190620043d6565b979a979950505050604095909501359450505050565b600080600080600080600080610100898b0312156200442557600080fd5b8835975060208901359650604089013595506060890135945060808901356200444e8162003ef9565b935060a08901356001600160401b038111156200446a57600080fd5b620044788b828c016200410d565b93505060c0890135915060e08901356200449281620041f0565b809150509295985092959890939650565b60008060408385031215620044b757600080fd5b823591506020830135620044cb81620041f0565b809150509250929050565b60008060408385031215620044ea57600080fd5b8235620044f78162003ef9565b91506020830135620044cb81620041f0565b60008060008060008060c087890312156200452357600080fd5b8635955060208701356001600160401b03808211156200454257600080fd5b620045508a838b016200410d565b965060408901359150620045648262003ef9565b909450606088013590808211156200457b57600080fd5b506200458a89828a016200410d565b9350506080870135915060a0870135620045a481620041f0565b809150509295509295509295565b60008060008060808587031215620045c957600080fd5b8435620045d68162003ef9565b93506020850135620045e88162003ef9565b92506040850135915060608501356001600160401b038111156200460b57600080fd5b8501601f810187136200461d57600080fd5b6200462e87823560208401620040b0565b91505092959194509250565b600080604083850312156200464e57600080fd5b82356200465b8162003ef9565b91506020830135620044cb8162003ef9565b60008083601f8401126200468057600080fd5b5081356001600160401b038111156200469857600080fd5b60208301915083602082850101111562002a1c57600080fd5b600080600080600080600060a0888a031215620046cd57600080fd5b8735620046da8162003ef9565b96506020880135955060408801356001600160401b0380821115620046fe57600080fd5b6200470c8b838c016200466d565b909750955060608a01359150808211156200472657600080fd5b50620047358a828b016200466d565b9094509250506080880135620042ae8162003ef9565b634e487b7160e01b600052603260045260246000fd5b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b6000600019821415620047df57620047df620047b2565b5060010190565b600181811c90821680620047fb57607f821691505b602082108114156200481d57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082198211156200486e576200486e620047b2565b500190565b600083516200488781846020880162003fac565b8351908301906200489d81836020880162003fac565b01949350505050565b6020808252600d908201526c2d291d102737ba1037bbb732b960991b604082015260600190565b60208082526013908201527216948e8813595d1859185d18481b1bd8dad959606a1b604082015260600190565b6000602082840312156200490d57600080fd5b8151620013bf81620041f0565b6020808252601290820152712d291d102737ba1031b7b73a3937b63632b960711b604082015260600190565b6000602082840312156200495957600080fd5b8151620013bf8162003ef9565b6000828210156200497b576200497b620047b2565b500390565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b600082620049f657620049f6620049ce565b500490565b600081600019048311821515161562004a185762004a18620047b2565b500290565b600060ff821660ff84168060ff0382111562004a3d5762004a3d620047b2565b019392505050565b828152604060208201526000620023c6604083018462003fdb565b60006101008a835280602084015262004a7c8184018b62003fdb565b604084018a9052606084018990526001600160a01b038881166080860152871660a085015283810360c0850152905062004ab7818662003fdb565b9150508260e08301529998505050505050505050565b60008262004adf5762004adf620049ce565b500690565b60008162004af65762004af6620047b2565b506000190190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009062004b339083018462003fdb565b9695505050505050565b60006020828403121562004b5057600080fd5b8151620013bf8162003ec2565b634e487b7160e01b600052603160045260246000fd5b6000825162004b8781846020870162003fac565b919091019291505056fe608060405260405161098a38038061098a8339810160408190526100229161048b565b61004d60017fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5161054b565b6000805160206109438339815191521461006957610069610570565b6100758282600061007c565b50506105f0565b61008583610147565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a26000825111806100c65750805b1561014257610140836001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561010c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101309190610586565b836102d860201b6100291760201c565b505b505050565b61015a8161030460201b6100551760201c565b6101b95760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b61022d816001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061021e9190610586565b61030460201b6100551760201c565b6102925760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b60648201526084016101b0565b806102b760008051602061094383398151915260001b61031360201b6100641760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b60606102fd838360405180606001604052806027815260200161096360279139610316565b9392505050565b6001600160a01b03163b151590565b90565b60606001600160a01b0384163b61037e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016101b0565b600080856001600160a01b03168560405161039991906105a1565b600060405180830381855af49150503d80600081146103d4576040519150601f19603f3d011682016040523d82523d6000602084013e6103d9565b606091505b5090925090506103ea8282866103f4565b9695505050505050565b606083156104035750816102fd565b8251156104135782518084602001fd5b8160405162461bcd60e51b81526004016101b091906105bd565b80516001600160a01b038116811461044457600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561047a578181015183820152602001610462565b838111156101405750506000910152565b6000806040838503121561049e57600080fd5b6104a78361042d565b60208401519092506001600160401b03808211156104c457600080fd5b818501915085601f8301126104d857600080fd5b8151818111156104ea576104ea610449565b604051601f8201601f19908116603f0116810190838211818310171561051257610512610449565b8160405282815288602084870101111561052b57600080fd5b61053c83602083016020880161045f565b80955050505050509250929050565b60008282101561056b57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b60006020828403121561059857600080fd5b6102fd8261042d565b600082516105b381846020870161045f565b9190910192915050565b60208152600082518060208401526105dc81604085016020870161045f565b601f01601f19169190910160400192915050565b610344806105ff6000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610067565b610100565b565b606061004e83836040518060600160405280602781526020016102e860279139610124565b9392505050565b6001600160a01b03163b151590565b90565b600061009a7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50546001600160a01b031690565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100fb919061023f565b905090565b3660008037600080366000845af43d6000803e80801561011f573d6000f35b3d6000fd5b60606001600160a01b0384163b6101915760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101ac9190610298565b600060405180830381855af49150503d80600081146101e7576040519150601f19603f3d011682016040523d82523d6000602084013e6101ec565b606091505b50915091506101fc828286610206565b9695505050505050565b6060831561021557508161004e565b8251156102255782518084602001fd5b8160405162461bcd60e51b815260040161018891906102b4565b60006020828403121561025157600080fd5b81516001600160a01b038116811461004e57600080fd5b60005b8381101561028357818101518382015260200161026b565b83811115610292576000848401525b50505050565b600082516102aa818460208701610268565b9190910192915050565b60208152600082518060208401526102d3816040850160208701610268565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122055616f0067da9b451ef6e679a6be4993dd58dc01b3f1471748a0be203af7820064736f6c634300080b0033a3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65644552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656ea264697066735822122095cbb93a990df55011a3220b9371a6ad6047d11a4ab80d889abe5c6470f7ab5564736f6c634300080b0033

Deployed Bytecode

0x60806040523480156200001157600080fd5b5060043610620003a45760003560e01c80637efcc90d11620001f9578063be21eccd1162000119578063e985e9c511620000af578063f2fde38b1162000086578063f2fde38b1462000965578063f6a74ed7146200097c578063fb7b395e1462000993578063fda9b94a146200099e57600080fd5b8063e985e9c514620008f8578063ea0458041462000937578063ec62558d146200094e57600080fd5b8063cfa3c13211620000f0578063cfa3c132146200088c578063d428bc7714620008a3578063da72c1e814620008ba578063da8c229e14620008d157600080fd5b8063be21eccd1462000847578063be25304e146200085e578063c87b56dd146200087557600080fd5b80639c4f6c6d116200018f578063a7fc7a071162000166578063a7fc7a0714620007d2578063aca05acc14620007e9578063b429afeb1462000800578063b88d4fde146200083057600080fd5b80639c4f6c6d14620007775780639e942ace146200078e578063a22cb46514620007bb57600080fd5b80638da5cb5b11620001d05780638da5cb5b14620007355780638de2dec9146200073f5780639083709a146200075657806395d89b41146200076d57600080fd5b80637efcc90d14620006e45780637f861b1a14620007145780638456cb59146200072b57600080fd5b80633a47040f11620002e5578063620e42ea116200027b57806370a08231116200025257806370a082311462000685578063715018a6146200069c5780637ad3e55b14620006a65780637da111fe14620006cd57600080fd5b8063620e42ea14620006345780636352211e14620006645780636c0360eb146200067b57600080fd5b806342842e0e11620002bc57806342842e0e14620005e55780634f6ccce714620005fc57806359659e9014620006135780635c975abb146200062857600080fd5b80633a47040f14620005af5780633f4ba83a14620005c457806341d01e7c14620005ce57600080fd5b806318160ddd116200035b5780632f745c5911620003325780632f745c5914620004c557806334038d4814620004dc5780633446106714620004f357806337aa32ba146200059a57600080fd5b806318160ddd146200047e57806323b872dd14620004975780632566193f14620004ae57600080fd5b806301ffc9a714620003a9578063059fb6f714620003ee57806306fdde031462000407578063081812fc1462000420578063095ea7b314620004505780630bfb66c51462000467575b600080fd5b620003d9620003ba36600462003ed9565b6001600160e01b03191660009081526033602052604090205460ff1690565b60405190151581526020015b60405180910390f35b62000405620003ff36600462003f0f565b620009b5565b005b6200041162000a44565b604051620003e5919062004009565b62000437620004313660046200401e565b62000ade565b6040516001600160a01b039091168152602001620003e5565b620004056200046136600462004038565b62000b6a565b620004056200047836600462004130565b62000c8b565b6200048862000d33565b604051908152602001620003e5565b62000405620004a836600462004187565b62000d46565b62000405620004bf366004620041cd565b62000d7d565b62000488620004d636600462004038565b62000e62565b62000488620004ed366004620041ff565b62000e8f565b62000554620005043660046200401e565b61012e602052600090815260409020805460018201546002830154600384015460048501546005909501546001600160a01b0380861696600160a01b90960460ff16959481169493811693911687565b604080516001600160a01b0398891681529615156020880152948716948601949094529185166060850152608084015260a083015290911660c082015260e001620003e5565b6101315462000437906001600160a01b031681565b6101325462000437906001600160a01b031681565b6200040562000f7d565b62000405620005df366004620042be565b62000fbd565b62000405620005f636600462004187565b6200102a565b620004886200060d3660046200401e565b62001047565b61012f5462000437906001600160a01b031681565b60c95460ff16620003d9565b62000437620006453660046200401e565b600090815261012e60205260409020600101546001600160a01b031690565b62000437620006753660046200401e565b6200105f565b620004116200110e565b620004886200069636600462004308565b6200111f565b62000405620011af565b62000488620006b73660046200401e565b600090815261012e602052604090206003015490565b62000405620006de366004620042be565b6200122d565b62000437620006f53660046200401e565b600090815261012e60205260409020600201546001600160a01b031690565b620004056200072536600462004328565b62001271565b6200040562001301565b620004376200133f565b620003d9620007503660046200401e565b620013b1565b620004056200076736600462004407565b620013c6565b6200041162001550565b6200040562000788366004620044a3565b62001561565b620004376200079f3660046200401e565b600090815261012e60205260409020546001600160a01b031690565b62000405620007cc366004620044d6565b6200157a565b62000405620007e336600462004308565b62001641565b62000488620007fa36600462004509565b62001772565b620003d96200081136600462004308565b6001600160a01b0316600090815261012d602052604090205460ff1690565b6200040562000841366004620045b2565b6200183e565b620003d9620008583660046200401e565b62001877565b620004886200086f366004620041ff565b62001894565b62000411620008863660046200401e565b62001b90565b620004886200089d3660046200401e565b62001d18565b62000405620008b4366004620042be565b62001d7f565b62000405620008cb36600462004187565b62001dfa565b620003d9620008e236600462004308565b61012d6020526000908152604090205460ff1681565b620003d9620009093660046200463a565b6001600160a01b039182166000908152609b6020908152604080832093909416825291909152205460ff1690565b620004056200094836600462004308565b62001e2e565b620004056200095f3660046200401e565b62001e85565b620004056200097636600462004308565b62001f1b565b620004056200098d36600462004308565b62002012565b620004886101305481565b62000405620009af366004620046b1565b62002173565b60005b8181101562000a3d576000838383818110620009d857620009d86200474b565b905060200201359050620009f4620009ed3390565b82620022da565b62000a1c5760405162461bcd60e51b815260040162000a139062004761565b60405180910390fd5b62000a29868683620023ce565b5062000a3581620047c8565b9050620009b8565b5050505050565b6060609c805462000a5590620047e6565b80601f016020809104026020016040519081016040528092919081815260200182805462000a8390620047e6565b801562000ad45780601f1062000aa85761010080835404028352916020019162000ad4565b820191906000526020600020905b81548152906001019060200180831162000ab657829003601f168201915b5050505050905090565b600062000aeb826200241e565b62000b4e5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840162000a13565b506000908152609a60205260409020546001600160a01b031690565b600062000b77826200242d565b9050806001600160a01b0316836001600160a01b0316141562000be75760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840162000a13565b336001600160a01b038216148062000c06575062000c06813362000909565b62000c7a5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840162000a13565b62000c86838362002458565b505050565b3362000c966200133f565b6001600160a01b03161462000cbf5760405162461bcd60e51b815260040162000a139062004823565b60005b8181101562000a3d5762000d1e62000cdf6200060d838762004858565b8662000cf662000cf0858862004858565b620024c8565b60405160200162000d0992919062004873565b6040516020818303038152906040526200260c565b8062000d2a81620047c8565b91505062000cc2565b600062000d41609862002685565b905090565b62000d5133620009ed565b62000d705760405162461bcd60e51b815260040162000a139062004761565b62000c86838383620023ce565b813362000d8a826200105f565b6001600160a01b03161462000db35760405162461bcd60e51b815260040162000a1390620048a6565b62000dbe8362001877565b1562000dde5760405162461bcd60e51b815260040162000a1390620048cd565b600083815261012e602052604090819020600301839055610132549051636f88668760e11b815260048101859052602481018490526001600160a01b039091169063df10cd0e906044015b600060405180830381600087803b15801562000e4457600080fd5b505af115801562000e59573d6000803e3d6000fd5b50505050505050565b6001600160a01b038216600090815260976020526040812062000e86908362002690565b90505b92915050565b33600090815261012d602052604081205460ff1615801562000f2057506101325460405163b429afeb60e01b81523360048201526001600160a01b039091169063b429afeb906024016020604051808303816000875af115801562000ef8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f1e9190620048fa565b155b1562000f405760405162461bcd60e51b815260040162000a13906200491a565b600062000f528989898989896200269e565b905062000f7187848360405180602001604052806000815250620028ea565b98975050505050505050565b3362000f886200133f565b6001600160a01b03161462000fb15760405162461bcd60e51b815260040162000a139062004823565b62000fbb6200296e565b565b813362000fca826200105f565b6001600160a01b03161462000ff35760405162461bcd60e51b815260040162000a1390620048a6565b62000ffe8362001877565b156200101e5760405162461bcd60e51b815260040162000a1390620048cd565b62000c8683836200260c565b62000c86838383604051806020016040528060008152506200183e565b6000806200105760988462002a03565b509392505050565b60006200106e60988362002a23565b156200109d5762000e89826040518060600160405280602981526020016200554e602991396098919062002a3c565b610132546040516331a9108f60e11b8152600481018490526001600160a01b0390911690636352211e90602401602060405180830381865afa158015620010e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000e89919062004946565b6060609f805462000a5590620047e6565b60006001600160a01b0382166200118c5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840162000a13565b6001600160a01b038216600090815260976020526040902062000e899062002685565b33620011ba6200133f565b6001600160a01b031614620011e35760405162461bcd60e51b815260040162000a139062004823565b6065546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3606580546001600160a01b0319169055565b33620012386200133f565b6001600160a01b031614620012615760405162461bcd60e51b815260040162000a139062004823565b6200126d82826200260c565b5050565b336200127c6200133f565b6001600160a01b031614620012a55760405162461bcd60e51b815260040162000a139062004823565b60005b8251811015620012fb57620012e6838281518110620012cb57620012cb6200474b565b60200260200101518562000cf6848662000cf0919062004858565b80620012f281620047c8565b915050620012a8565b50505050565b336200130c6200133f565b6001600160a01b031614620013355760405162461bcd60e51b815260040162000a139062004823565b62000fbb62002a4b565b6101325460408051638da5cb5b60e01b815290516000926001600160a01b031691638da5cb5b9160048083019260209291908290030181865afa1580156200138b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000d41919062004946565b600080620013bf836200241e565b9392505050565b33600090815261012d602052604090205460ff161580156200145757506101325460405163b429afeb60e01b81523360048201526001600160a01b039091169063b429afeb906024016020604051808303816000875af11580156200142f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014559190620048fa565b155b15620014775760405162461bcd60e51b815260040162000a13906200491a565b600062001485878762004966565b11620014d45760405162461bcd60e51b815260206004820152601960248201527f496e76616c6964206e756d626572206f6620646f6d61696e7300000000000000604482015260640162000a13565b6000865b8681101562001544576200152d8a620014f662000cf08c8562004858565b88886200150386620024c8565b6040516020016200151692919062004873565b60405160208183030381529060405288886200269e565b9150806200153b81620047c8565b915050620014d8565b50505050505050505050565b6060609d805462000a5590620047e6565b6200156d828262002ac9565b6200126d82338362002bd7565b6001600160a01b038216331415620015d55760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640162000a13565b336000818152609b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6200164b6200133f565b6001600160a01b0316336001600160a01b03161480620016765750610131546001600160a01b031633145b620016b95760405162461bcd60e51b815260206004820152601260248201527116948e88139bdd08185d5d1a1bdc9a5e995960721b604482015260640162000a13565b6001600160a01b038116600090815261012d602052604090205460ff1615620017255760405162461bcd60e51b815260206004820152601f60248201527f5a523a20436f6e74726f6c6c657220697320616c726561647920616464656400604482015260640162000a13565b6001600160a01b038116600081815261012d6020526040808220805460ff19166001179055517f0a8bb31534c0ed46f380cb867bd5c803a189ced9a764e30b3a4991a9901d74749190a250565b33600090815261012d602052604081205460ff161580156200180357506101325460405163b429afeb60e01b81523360048201526001600160a01b039091169063b429afeb906024016020604051808303816000875af1158015620017db573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620018019190620048fa565b155b15620018235760405162461bcd60e51b815260040162000a13906200491a565b620018338787878787876200269e565b979650505050505050565b6200184a3383620022da565b620018695760405162461bcd60e51b815260040162000a139062004761565b620012fb84848484620028ea565b600090815261012e6020526040902054600160a01b900460ff1690565b33600090815261012d602052604081205460ff161580156200192557506101325460405163b429afeb60e01b81523360048201526001600160a01b039091169063b429afeb906024016020604051808303816000875af1158015620018fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019239190620048fa565b155b15620019455760405162461bcd60e51b815260040162000a13906200491a565b6000620019578989898989896200269e565b9050600061013260009054906101000a90046001600160a01b03166001600160a01b031663e1cc84906040518163ffffffff1660e01b8152600401602060405180830381865afa158015620019b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019d6919062004946565b604051620019e49062003dcf565b6001600160a01b039091168152604060208201819052600090820152606001604051809103906000f08015801562001a20573d6000803e3d6000fd5b5061013254604051637ed4dca560e11b81523060048201526024810185905260a06044820152601160a4820152705a657230204e616d65205365727669636560781b60c482015260e06064820152600360e4820152625a4e5360e81b6101048201526001600160a01b03918216608482015291925082169063fda9b94a9061012401600060405180830381600087803b15801562001abd57600080fd5b505af115801562001ad2573d6000803e3d6000fd5b505050600083815261012e60205260409081902060050180546001600160a01b0319166001600160a01b03858116918217909255610132549251633f7baeb960e01b815260048101879052602481019190915291169150633f7baeb990604401600060405180830381600087803b15801562001b4d57600080fd5b505af115801562001b62573d6000803e3d6000fd5b5050505062001b8388858460405180602001604052806000815250620028ea565b5098975050505050505050565b606062001b9d826200241e565b62001c035760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840162000a13565b6000828152609e60205260408120805462001c1e90620047e6565b80601f016020809104026020016040519081016040528092919081815260200182805462001c4c90620047e6565b801562001c9d5780601f1062001c715761010080835404028352916020019162001c9d565b820191906000526020600020905b81548152906001019060200180831162001c7f57829003601f168201915b50505050509050600062001cb06200110e565b905080516000141562001cc4575092915050565b81511562001cf957808260405160200162001ce192919062004873565b60405160208183030381529060405292505050919050565b8062001d058562002c5f565b60405160200162001ce192919062004873565b600062001d25826200241e565b62001d685760405162461bcd60e51b815260206004820152601260248201527116948e88111bd95cc81b9bdd08195e1a5cdd60721b604482015260640162000a13565b50600090815261012e602052604090206004015490565b813362001d8c826200105f565b6001600160a01b03161462001db55760405162461bcd60e51b815260040162000a1390620048a6565b62001dc08362001877565b1562001de05760405162461bcd60e51b815260040162000a1390620048cd565b62001dec83836200260c565b62000c868333600162002bd7565b3362001e056200133f565b6001600160a01b03161462000d705760405162461bcd60e51b815260040162000a139062004823565b3362001e396200133f565b6001600160a01b03161462001e625760405162461bcd60e51b815260040162000a139062004823565b61013280546001600160a01b0319166001600160a01b0392909216919091179055565b3362001e906200133f565b6001600160a01b03161462001eb95760405162461bcd60e51b815260040162000a139062004823565b62001ec48162002d86565b600090815261012e6020526040812080546001600160a81b03191681556001810180546001600160a01b03199081169091556002820180548216905560038201839055600482019290925560050180549091169055565b3362001f266200133f565b6001600160a01b03161462001f4f5760405162461bcd60e51b815260040162000a139062004823565b6001600160a01b03811662001fb65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000a13565b6065546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3606580546001600160a01b0319166001600160a01b0392909216919091179055565b336200201d6200133f565b6001600160a01b031614620020465760405162461bcd60e51b815260040162000a139062004823565b620020506200133f565b6001600160a01b0316336001600160a01b031614806200207b5750610131546001600160a01b031633145b620020be5760405162461bcd60e51b815260206004820152601260248201527116948e88139bdd08185d5d1a1bdc9a5e995960721b604482015260640162000a13565b6001600160a01b038116600090815261012d602052604090205460ff16620021295760405162461bcd60e51b815260206004820152601d60248201527f5a523a20436f6e74726f6c6c657220646f6573206e6f74206578697374000000604482015260640162000a13565b6001600160a01b038116600081815261012d6020526040808220805460ff19169055517f33d83959be2573f5453b12eb9d43b3499bc57d96bd2f067ba44803c859e811139190a250565b600054610100900460ff1680620021895750303b155b8062002198575060005460ff16155b620021b75760405162461bcd60e51b815260040162000a139062004980565b600054610100900460ff16158015620021da576000805461ffff19166101011790555b6001600160a01b038816620021ff57620021f960008033600062002e5b565b62002222565b61013087905561013180546001600160a01b0319166001600160a01b038a161790555b61013280546001600160a01b0319166001600160a01b0384161790556200224862002f30565b620022bd86868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a01819004810282018101909252888152925088915087908190840183828082843760009201919091525062002fd592505050565b8015620022d0576000805461ff00191690555b5050505050505050565b6000620022e7826200241e565b6200234a5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840162000a13565b600062002357836200242d565b9050806001600160a01b0316846001600160a01b03161480620023955750836001600160a01b03166200238a8462000ade565b6001600160a01b0316145b80620023c657506001600160a01b038082166000908152609b602090815260408083209388168352929052205460ff165b949350505050565b620023db83838362003073565b61013254604051631c9f41b760e11b81526001600160a01b0385811660048301528481166024830152604482018490529091169063393e836e9060640162000e29565b600062000e8960988362002a23565b600062000e89826040518060600160405280602981526020016200554e602991396098919062002a3c565b6000818152609a6020526040902080546001600160a01b0319166001600160a01b03841690811790915581906200248f826200242d565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b606081620024ed5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156200251d57806200250481620047c8565b9150620025159050600a83620049e4565b9150620024f1565b6000816001600160401b038111156200253a576200253a62004067565b6040519080825280601f01601f19166020018201604052801562002565576020820181803683370190505b509050815b851562002603576200257e60018262004966565b905060006200258f600a88620049e4565b6200259c90600a620049fb565b620025a8908862004966565b620025b590603062004a1d565b905060008160f81b905080848481518110620025d557620025d56200474b565b60200101906001600160f81b031916908160001a905350620025f9600a89620049e4565b975050506200256a565b50949350505050565b6200261882826200320f565b610132546040516302e76c3560e31b81526001600160a01b039091169063173b61a8906200264d908590859060040162004a45565b600060405180830381600087803b1580156200266857600080fd5b505af11580156200267d573d6000803e3d6000fd5b505050505050565b600062000e89825490565b600062000e86838362003230565b600080865111620026e35760405162461bcd60e51b815260206004820152600e60248201526d5a523a20456d707479206e616d6560901b604482015260640162000a13565b600087815261012e60205260409020600501546001600160a01b0316156200274e5760405162461bcd60e51b815260206004820152601960248201527f5a523a20506172656e7420697320737562636f6e747261637400000000000000604482015260640162000a13565b610130548714620027a25762002764876200241e565b620027a25760405162461bcd60e51b815260206004820152600d60248201526c16948e88139bc81c185c995b9d609a1b604482015260640162000a13565b8551602080880191909120604080518084018b9052808201839052815180820383018152606090910190915280519201919091203390620027e68a828a8562002e5b565b620027f281886200320f565b84156200283957600081815261012e602052604090206001810180546001600160a01b038b166001600160a01b0319909116179055805460ff60a01b1916600160a01b1790555b85156200285657600081815261012e602052604090206003018690555b61013260009054906101000a90046001600160a01b03166001600160a01b0316630738d081828b868e8d888e8e6040518963ffffffff1660e01b8152600401620028a898979695949392919062004a60565b600060405180830381600087803b158015620028c357600080fd5b505af1158015620028d8573d6000803e3d6000fd5b50929c9b505050505050505050505050565b620028f7848484620023ce565b6200290584848484620032bb565b620012fb5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606482015260840162000a13565b60c95460ff16620029b95760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640162000a13565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080808062002a14868662003395565b909450925050505b9250929050565b6000818152600183016020526040812054151562000e86565b6000620023c684848462003437565b60c95460ff161562002a935760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640162000a13565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258620029e63390565b801562002b30573362002adc836200105f565b6001600160a01b03161462002b055760405162461bcd60e51b815260040162000a1390620048a6565b62002b108262001877565b156200126d5760405162461bcd60e51b815260040162000a1390620048cd565b62002b3b8262001877565b62002b7a5760405162461bcd60e51b815260206004820152600e60248201526d16948e88139bdd081b1bd8dad95960921b604482015260640162000a13565b600082815261012e60205260409020600101546001600160a01b031633146200126d5760405162461bcd60e51b815260206004820152600e60248201526d2d291d102737ba103637b1b5b2b960911b604482015260640162000a13565b600083815261012e6020526040908190206001810180546001600160a01b0319166001600160a01b03868116918217909255825460ff60a01b1916600160a01b8615159081029190911790935561013254935163e43ad7d560e01b81526004810188905260248101919091526044810192909252919091169063e43ad7d59060640162000e29565b60608162002c845750506040805180820190915260018152600360fc1b602082015290565b8160005b811562002cb4578062002c9b81620047c8565b915062002cac9050600a83620049e4565b915062002c88565b6000816001600160401b0381111562002cd15762002cd162004067565b6040519080825280601f01601f19166020018201604052801562002cfc576020820181803683370190505b509050600062002d0e60018462004966565b90508593505b8315620026035762002d28600a8562004acd565b62002d3590603062004858565b60f81b828262002d458162004ae4565b93508151811062002d5a5762002d5a6200474b565b60200101906001600160f81b031916908160001a90535062002d7e600a85620049e4565b935062002d14565b600062002d93826200242d565b905062002da381600084620034a8565b62002db060008362002458565b6000828152609e60205260409020805462002dcb90620047e6565b15905062002dec576000828152609e6020526040812062002dec9162003ddd565b6001600160a01b038116600090815260976020526040902062002e10908362003511565b5062002e1e6098836200351f565b5060405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b62002e6782846200352d565b6040805160e0810182526001600160a01b03938416815260006020808301828152838501838152958716606085019081526080850184815260a086019a8b5260c0860185815299855261012e909352949092209251835492511515600160a01b026001600160a81b03199093169087161791909117825592516001820180549186166001600160a01b0319928316179055915160028201805491861691841691909117905591516003830155935160048201559151600590920180549290911691909216179055565b600054610100900460ff168062002f465750303b155b8062002f55575060005460ff16155b62002f745760405162461bcd60e51b815260040162000a139062004980565b600054610100900460ff1615801562002f97576000805461ffff19166101011790555b62002fa16200365d565b62002fab620036d8565b62002fb562003751565b62002fbf6200365d565b801562002fd2576000805461ff00191690555b50565b600054610100900460ff168062002feb5750303b155b8062002ffa575060005460ff16155b620030195760405162461bcd60e51b815260040162000a139062004980565b600054610100900460ff161580156200303c576000805461ffff19166101011790555b620030466200365d565b62003050620036d8565b6200305c8383620037d7565b801562000c86576000805461ff0019169055505050565b826001600160a01b031662003088826200242d565b6001600160a01b031614620030f25760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b606482015260840162000a13565b6001600160a01b038216620031565760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840162000a13565b62003163838383620034a8565b6200317060008262002458565b6001600160a01b038316600090815260976020526040902062003194908262003511565b506001600160a01b0382166000908152609760205260409020620031b99082620038a0565b50620031c860988284620038ae565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000828152609e60209081526040909120825162000c869284019062003e1c565b81546000908210620032905760405162461bcd60e51b815260206004820152602260248201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604482015261647360f01b606482015260840162000a13565b826000018281548110620032a857620032a86200474b565b9060005260206000200154905092915050565b60006001600160a01b0384163b620032d657506001620023c6565b60006200335c630a85bd0160e11b33888787604051602401620032fd949392919062004afe565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050506040518060600160405280603281526020016200551c603291396001600160a01b0388169190620038c6565b905060008180602001905181019062003376919062004b3d565b6001600160e01b031916630a85bd0160e11b1492505050949350505050565b815460009081908310620033f75760405162461bcd60e51b815260206004820152602260248201527f456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e604482015261647360f01b606482015260840162000a13565b60008460000184815481106200341157620034116200474b565b906000526020600020906002020190508060000154816001015492509250509250929050565b600082815260018401602052604081205482816200346a5760405162461bcd60e51b815260040162000a13919062004009565b50846200347960018362004966565b815481106200348c576200348c6200474b565b9060005260206000209060020201600101549150509392505050565b60c95460ff161562000c865760405162461bcd60e51b815260206004820152602b60248201527f4552433732315061757361626c653a20746f6b656e207472616e73666572207760448201526a1a1a5b19481c185d5cd95960aa1b606482015260840162000a13565b600062000e868383620038d7565b600062000e868383620039dc565b6001600160a01b038216620035855760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640162000a13565b62003590816200241e565b15620035df5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640162000a13565b620035ed60008383620034a8565b6001600160a01b0382166000908152609760205260409020620036119082620038a0565b506200362060988284620038ae565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600054610100900460ff1680620036735750303b155b8062003682575060005460ff16155b620036a15760405162461bcd60e51b815260040162000a139062004980565b600054610100900460ff1615801562002fbf576000805461ffff1916610101179055801562002fd2576000805461ff001916905550565b600054610100900460ff1680620036ee5750303b155b80620036fd575060005460ff16155b6200371c5760405162461bcd60e51b815260040162000a139062004980565b600054610100900460ff161580156200373f576000805461ffff19166101011790555b62002fbf6301ffc9a760e01b62003af4565b600054610100900460ff1680620037675750303b155b8062003776575060005460ff16155b620037955760405162461bcd60e51b815260040162000a139062004980565b600054610100900460ff16158015620037b8576000805461ffff19166101011790555b60c9805460ff19169055801562002fd2576000805461ff001916905550565b600054610100900460ff1680620037ed5750303b155b80620037fc575060005460ff16155b6200381b5760405162461bcd60e51b815260040162000a139062004980565b600054610100900460ff161580156200383e576000805461ffff19166101011790555b82516200385390609c90602086019062003e1c565b5081516200386990609d90602085019062003e1c565b506200387c6380ac58cd60e01b62003af4565b6200388e635b5e139f60e01b62003af4565b6200305c63780e9d6360e01b62003af4565b600062000e86838362003b75565b6000620023c684846001600160a01b03851662003bc7565b6060620023c6848460008562003c70565b60008181526001830160205260408120548015620039d1576000620038fe60018362004966565b8554909150600090620039149060019062004966565b905060008660000182815481106200393057620039306200474b565b90600052602060002001549050808760000184815481106200395657620039566200474b565b6000918252602090912001556200396f83600162004858565b6000828152600189016020526040902055865487908062003994576200399462004b5d565b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505062000e89565b600091505062000e89565b60008181526001830160205260408120548015620039d157600062003a0360018362004966565b855490915060009062003a199060019062004966565b9050600086600001828154811062003a355762003a356200474b565b906000526020600020906002020190508087600001848154811062003a5e5762003a5e6200474b565b6000918252602090912082546002909202019081556001918201549082015562003a8a90849062004858565b81546000908152600189016020526040902055865487908062003ab15762003ab162004b5d565b600082815260208082206002600019909401938402018281556001908101839055929093558881528982019092526040822091909155945062000e899350505050565b6001600160e01b0319808216141562003b505760405162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015260640162000a13565b6001600160e01b0319166000908152603360205260409020805460ff19166001179055565b600081815260018301602052604081205462003bbe5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000e89565b50600062000e89565b60008281526001840160205260408120548062003c2e575050604080518082018252838152602080820184815286546001818101895560008981528481209551600290930290950191825591519082015586548684528188019092529290912055620013bf565b828562003c3d60018462004966565b8154811062003c505762003c506200474b565b9060005260206000209060020201600101819055506000915050620013bf565b60608247101562003cd35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840162000a13565b843b62003d235760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000a13565b600080866001600160a01b0316858760405162003d41919062004b73565b60006040518083038185875af1925050503d806000811462003d80576040519150601f19603f3d011682016040523d82523d6000602084013e62003d85565b606091505b5091509150620018338282866060831562003da2575081620013bf565b82511562003db35782518084602001fd5b8160405162461bcd60e51b815260040162000a13919062004009565b61098a8062004b9283390190565b50805462003deb90620047e6565b6000825580601f1062003dfc575050565b601f01602090049060005260206000209081019062002fd2919062003eab565b82805462003e2a90620047e6565b90600052602060002090601f01602090048101928262003e4e576000855562003e99565b82601f1062003e6957805160ff191683800117855562003e99565b8280016001018555821562003e99579182015b8281111562003e9957825182559160200191906001019062003e7c565b5062003ea792915062003eab565b5090565b5b8082111562003ea7576000815560010162003eac565b6001600160e01b03198116811462002fd257600080fd5b60006020828403121562003eec57600080fd5b8135620013bf8162003ec2565b6001600160a01b038116811462002fd257600080fd5b6000806000806060858703121562003f2657600080fd5b843562003f338162003ef9565b9350602085013562003f458162003ef9565b925060408501356001600160401b038082111562003f6257600080fd5b818701915087601f83011262003f7757600080fd5b81358181111562003f8757600080fd5b8860208260051b850101111562003f9d57600080fd5b95989497505060200194505050565b60005b8381101562003fc957818101518382015260200162003faf565b83811115620012fb5750506000910152565b6000815180845262003ff581602086016020860162003fac565b601f01601f19169290920160200192915050565b60208152600062000e86602083018462003fdb565b6000602082840312156200403157600080fd5b5035919050565b600080604083850312156200404c57600080fd5b8235620040598162003ef9565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620040a857620040a862004067565b604052919050565b60006001600160401b03831115620040cc57620040cc62004067565b620040e1601f8401601f19166020016200407d565b9050828152838383011115620040f657600080fd5b828260208301376000602084830101529392505050565b600082601f8301126200411f57600080fd5b62000e8683833560208501620040b0565b600080600080608085870312156200414757600080fd5b84356001600160401b038111156200415e57600080fd5b6200416c878288016200410d565b97602087013597506040870135966060013595509350505050565b6000806000606084860312156200419d57600080fd5b8335620041aa8162003ef9565b92506020840135620041bc8162003ef9565b929592945050506040919091013590565b60008060408385031215620041e157600080fd5b50508035926020909101359150565b801515811462002fd257600080fd5b600080600080600080600060e0888a0312156200421b57600080fd5b8735965060208801356001600160401b03808211156200423a57600080fd5b620042488b838c016200410d565b975060408a013591506200425c8262003ef9565b909550606089013590808211156200427357600080fd5b50620042828a828b016200410d565b9450506080880135925060a08801356200429c81620041f0565b915060c0880135620042ae8162003ef9565b8091505092959891949750929550565b60008060408385031215620042d257600080fd5b8235915060208301356001600160401b03811115620042f057600080fd5b620042fe858286016200410d565b9150509250929050565b6000602082840312156200431b57600080fd5b8135620013bf8162003ef9565b6000806000606084860312156200433e57600080fd5b83356001600160401b03808211156200435657600080fd5b62004364878388016200410d565b94506020915081860135818111156200437c57600080fd5b8601601f810188136200438e57600080fd5b803582811115620043a357620043a362004067565b8060051b9250620043b68484016200407d565b818152928201840192848101908a851115620043d157600080fd5b928501925b84841015620043f157833582529285019290850190620043d6565b979a979950505050604095909501359450505050565b600080600080600080600080610100898b0312156200442557600080fd5b8835975060208901359650604089013595506060890135945060808901356200444e8162003ef9565b935060a08901356001600160401b038111156200446a57600080fd5b620044788b828c016200410d565b93505060c0890135915060e08901356200449281620041f0565b809150509295985092959890939650565b60008060408385031215620044b757600080fd5b823591506020830135620044cb81620041f0565b809150509250929050565b60008060408385031215620044ea57600080fd5b8235620044f78162003ef9565b91506020830135620044cb81620041f0565b60008060008060008060c087890312156200452357600080fd5b8635955060208701356001600160401b03808211156200454257600080fd5b620045508a838b016200410d565b965060408901359150620045648262003ef9565b909450606088013590808211156200457b57600080fd5b506200458a89828a016200410d565b9350506080870135915060a0870135620045a481620041f0565b809150509295509295509295565b60008060008060808587031215620045c957600080fd5b8435620045d68162003ef9565b93506020850135620045e88162003ef9565b92506040850135915060608501356001600160401b038111156200460b57600080fd5b8501601f810187136200461d57600080fd5b6200462e87823560208401620040b0565b91505092959194509250565b600080604083850312156200464e57600080fd5b82356200465b8162003ef9565b91506020830135620044cb8162003ef9565b60008083601f8401126200468057600080fd5b5081356001600160401b038111156200469857600080fd5b60208301915083602082850101111562002a1c57600080fd5b600080600080600080600060a0888a031215620046cd57600080fd5b8735620046da8162003ef9565b96506020880135955060408801356001600160401b0380821115620046fe57600080fd5b6200470c8b838c016200466d565b909750955060608a01359150808211156200472657600080fd5b50620047358a828b016200466d565b9094509250506080880135620042ae8162003ef9565b634e487b7160e01b600052603260045260246000fd5b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b6000600019821415620047df57620047df620047b2565b5060010190565b600181811c90821680620047fb57607f821691505b602082108114156200481d57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082198211156200486e576200486e620047b2565b500190565b600083516200488781846020880162003fac565b8351908301906200489d81836020880162003fac565b01949350505050565b6020808252600d908201526c2d291d102737ba1037bbb732b960991b604082015260600190565b60208082526013908201527216948e8813595d1859185d18481b1bd8dad959606a1b604082015260600190565b6000602082840312156200490d57600080fd5b8151620013bf81620041f0565b6020808252601290820152712d291d102737ba1031b7b73a3937b63632b960711b604082015260600190565b6000602082840312156200495957600080fd5b8151620013bf8162003ef9565b6000828210156200497b576200497b620047b2565b500390565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b600082620049f657620049f6620049ce565b500490565b600081600019048311821515161562004a185762004a18620047b2565b500290565b600060ff821660ff84168060ff0382111562004a3d5762004a3d620047b2565b019392505050565b828152604060208201526000620023c6604083018462003fdb565b60006101008a835280602084015262004a7c8184018b62003fdb565b604084018a9052606084018990526001600160a01b038881166080860152871660a085015283810360c0850152905062004ab7818662003fdb565b9150508260e08301529998505050505050505050565b60008262004adf5762004adf620049ce565b500690565b60008162004af65762004af6620047b2565b506000190190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009062004b339083018462003fdb565b9695505050505050565b60006020828403121562004b5057600080fd5b8151620013bf8162003ec2565b634e487b7160e01b600052603160045260246000fd5b6000825162004b8781846020870162003fac565b919091019291505056fe608060405260405161098a38038061098a8339810160408190526100229161048b565b61004d60017fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5161054b565b6000805160206109438339815191521461006957610069610570565b6100758282600061007c565b50506105f0565b61008583610147565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a26000825111806100c65750805b1561014257610140836001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561010c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101309190610586565b836102d860201b6100291760201c565b505b505050565b61015a8161030460201b6100551760201c565b6101b95760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b61022d816001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061021e9190610586565b61030460201b6100551760201c565b6102925760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b60648201526084016101b0565b806102b760008051602061094383398151915260001b61031360201b6100641760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b60606102fd838360405180606001604052806027815260200161096360279139610316565b9392505050565b6001600160a01b03163b151590565b90565b60606001600160a01b0384163b61037e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016101b0565b600080856001600160a01b03168560405161039991906105a1565b600060405180830381855af49150503d80600081146103d4576040519150601f19603f3d011682016040523d82523d6000602084013e6103d9565b606091505b5090925090506103ea8282866103f4565b9695505050505050565b606083156104035750816102fd565b8251156104135782518084602001fd5b8160405162461bcd60e51b81526004016101b091906105bd565b80516001600160a01b038116811461044457600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561047a578181015183820152602001610462565b838111156101405750506000910152565b6000806040838503121561049e57600080fd5b6104a78361042d565b60208401519092506001600160401b03808211156104c457600080fd5b818501915085601f8301126104d857600080fd5b8151818111156104ea576104ea610449565b604051601f8201601f19908116603f0116810190838211818310171561051257610512610449565b8160405282815288602084870101111561052b57600080fd5b61053c83602083016020880161045f565b80955050505050509250929050565b60008282101561056b57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b60006020828403121561059857600080fd5b6102fd8261042d565b600082516105b381846020870161045f565b9190910192915050565b60208152600082518060208401526105dc81604085016020870161045f565b601f01601f19169190910160400192915050565b610344806105ff6000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610067565b610100565b565b606061004e83836040518060600160405280602781526020016102e860279139610124565b9392505050565b6001600160a01b03163b151590565b90565b600061009a7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50546001600160a01b031690565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100fb919061023f565b905090565b3660008037600080366000845af43d6000803e80801561011f573d6000f35b3d6000fd5b60606001600160a01b0384163b6101915760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101ac9190610298565b600060405180830381855af49150503d80600081146101e7576040519150601f19603f3d011682016040523d82523d6000602084013e6101ec565b606091505b50915091506101fc828286610206565b9695505050505050565b6060831561021557508161004e565b8251156102255782518084602001fd5b8160405162461bcd60e51b815260040161018891906102b4565b60006020828403121561025157600080fd5b81516001600160a01b038116811461004e57600080fd5b60005b8381101561028357818101518382015260200161026b565b83811115610292576000848401525b50505050565b600082516102aa818460208701610268565b9190910192915050565b60208152600082518060208401526102d3816040850160208701610268565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122055616f0067da9b451ef6e679a6be4993dd58dc01b3f1471748a0be203af7820064736f6c634300080b0033a3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65644552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656ea264697066735822122095cbb93a990df55011a3220b9371a6ad6047d11a4ab80d889abe5c6470f7ab5564736f6c634300080b0033

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  ]

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.