ETH Price: $3,173.42 (+3.73%)

Token

Hero (HERO)
 

Overview

Max Total Supply

232 HERO

Holders

115

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Balance
5 HERO
0x7a23116e81dd8a0a9760086c3d0504f2c8a553a5
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

10,000 pixelated heroes with unique traits and abilities. Every hero grants you the ability to play Pixel War, the first NFT strategy RPG, and unlock exclusive NFTs.

# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
Hero

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 26 : Hero.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/interfaces/IERC2981.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

import "./ERC998TopDown.sol";
import "./IItem.sol";

/// @title Hero
/// @notice Hero is a composable NFT designed to equip other ERC1155 tokens
contract Hero is ERC721Enumerable, ERC998TopDown, Ownable, EIP712, IERC2981 {
  using ERC165Checker for address;

  struct MintVoucher {
    uint256 price;
    address wallet;
    bytes signature;
  }

  struct BulkChangeVoucher {
    uint256 tokenId;
    address itemContractAddress;
    uint256[] itemsToEquip;
    uint256[] amountsToEquip;
    uint256[] slotsToEquip;
    uint256[] itemsToUnequip;
    uint256[] amountsToUnequip;
    bytes signature;
  }

  struct Item {
    address itemAddress;
    uint256 id;
  }

  event BulkChanges(
    uint256 tokenId,
    uint256[] itemsToEquip,
    uint256[] amountsToEquip,
    uint256[] slotsToEquip,
    uint256[] itemsToUnequip,
    uint256[] amountsToUnequip,
    address heroOwner
  );

  event ItemsClaimed(uint256 tokenId);

  bytes4 internal constant ERC_1155_INTERFACE = 0xd9b67a26;

  mapping(address => bool) private _allowedMinters;

  string private constant SIGNING_DOMAIN = "Hero";
  string private constant SIGNATURE_VERSION = "1";

  address public primarySalesReceiver;
  address public royaltyReceiver;
  uint8 public royaltyPercentage;
  string private baseUri;
  uint256 public maxSupply;

  string private _contractURI;
  using Counters for Counters.Counter;
  Counters.Counter private _heroCounter;
  mapping(address => uint256) private mintNonce;
  mapping(uint256 => uint256) private claimNonce;
  string public provenanceHash;

  constructor(
    uint256 maxSupply_,
    string memory uri_,
    address payable signer_,
    address payable primarySalesReceiver_,
    address payable royaltyReceiver_,
    uint8 royaltyPercentage_,
    string memory contractURI_,
    string memory provenanceHash_
  ) ERC998TopDown("Hero", "HERO") EIP712(SIGNING_DOMAIN, SIGNATURE_VERSION) {
    _allowedMinters[signer_] = true;
    maxSupply = maxSupply_;
    _heroCounter.increment();
    baseUri = uri_;
    primarySalesReceiver = primarySalesReceiver_;
    royaltyReceiver = royaltyReceiver_;
    royaltyPercentage = royaltyPercentage_;
    _contractURI = contractURI_;
    provenanceHash = provenanceHash_;
  }

  function contractURI() public view returns (string memory) {
    return _contractURI;
  }

  function setContractURI(string memory contractURI_) external {
    _contractURI = contractURI_;
  }

  function addSigner(address signer_) public onlyOwner {
    _allowedMinters[signer_] = true;
  }

  function disableSigner(address signer_) public onlyOwner {
    _allowedMinters[signer_] = false;
  }

  function getMintNonce(address msgSigner) external view returns (uint256) {
    return mintNonce[msgSigner];
  }

  function getClaimNonce(uint256 tokenId) external view returns (uint256) {
    return claimNonce[tokenId];
  }

  function supportsInterface(bytes4 interfaceId)
    public
    view
    virtual
    override(ERC721Enumerable, ERC721, IERC165)
    returns (bool)
  {
    return
      type(IERC2981).interfaceId == interfaceId ||
      super.supportsInterface(interfaceId);
  }

  modifier onlyAuthorized(uint256 _tokenId) {
    require(
      _isApprovedOrOwner(msg.sender, _tokenId),
      "Hero: Caller is not owner nor approved"
    );
    _;
  }

  function bulkChanges(BulkChangeVoucher calldata bulkChangeVoucher)
    external
    onlyAuthorized(bulkChangeVoucher.tokenId)
  {
    address signer = _verifyBulkChangeData(bulkChangeVoucher, false);
    require(
      _allowedMinters[signer] == true,
      "Signature invalid or unauthorized"
    );

    _transferItemOut(
      bulkChangeVoucher.tokenId,
      ownerOf(bulkChangeVoucher.tokenId),
      bulkChangeVoucher.itemContractAddress,
      bulkChangeVoucher.itemsToUnequip,
      bulkChangeVoucher.amountsToUnequip
    );

    _transferItemIn(
      bulkChangeVoucher.tokenId,
      _msgSender(),
      bulkChangeVoucher.itemContractAddress,
      bulkChangeVoucher.itemsToEquip,
      bulkChangeVoucher.amountsToEquip
    );

    emit BulkChanges(
      bulkChangeVoucher.tokenId,
      bulkChangeVoucher.itemsToEquip,
      bulkChangeVoucher.amountsToEquip,
      bulkChangeVoucher.slotsToEquip,
      bulkChangeVoucher.itemsToUnequip,
      bulkChangeVoucher.amountsToUnequip,
      ownerOf(bulkChangeVoucher.tokenId)
    );
  }

  function mint(MintVoucher calldata voucher) external payable {
    require(msg.value == voucher.price, "Voucher: Invalid price amount");

    uint256 currentHeroCounter = _heroCounter.current();
    require(currentHeroCounter <= maxSupply, "Hero: No more heroes available");
    address signer = _verifyMintData(voucher);

    require(
      _allowedMinters[signer] == true,
      "Signature invalid or unauthorized"
    );

    require(_msgSender() == voucher.wallet, "Hero: Invalid wallet");
    mintNonce[_msgSender()]++;

    _safeMint(_msgSender(), currentHeroCounter);
    (bool paymentSucess, ) = payable(primarySalesReceiver).call{
      value: msg.value
    }("");
    require(paymentSucess, "Hero: Payment failed");
    _heroCounter.increment();
  }

  function claimItems(BulkChangeVoucher calldata voucher)
    external
    onlyAuthorized(voucher.tokenId)
  {
    address signer = _verifyBulkChangeData(voucher, true);

    require(
      _allowedMinters[signer] == true,
      "Signature invalid or unauthorized"
    );

    claimNonce[voucher.tokenId]++;

    IItem(voucher.itemContractAddress).claimFromHero(
      owner(),
      address(this),
      voucher.itemsToEquip,
      voucher.amountsToEquip,
      toBytes(voucher.tokenId)
    );
    emit ItemsClaimed(voucher.tokenId);
  }

  function setUri(string memory uri_) public onlyOwner {
    baseUri = uri_;
  }

  function tokenURI(uint256 tokenId)
    public
    view
    virtual
    override
    returns (string memory)
  {
    require(_exists(tokenId), "Hero: URI query for nonexistent token");

    return string(abi.encodePacked(baseUri, Strings.toString(tokenId)));
  }

  function _transferItemIn(
    uint256 _tokenId,
    address _operator,
    address _itemAddress,
    uint256[] memory _itemIds,
    uint256[] memory _amounts
  ) internal {
    if (_itemAddress.supportsInterface(ERC_1155_INTERFACE)) {
      IERC1155(_itemAddress).safeBatchTransferFrom(
        _operator,
        address(this),
        _itemIds,
        _amounts,
        toBytes(_tokenId)
      );
    } else {
      require(false, "Hero: Item does not support ERC-1155 standards");
    }
  }

  function _transferItemOut(
    uint256 _tokenId,
    address _owner,
    address _itemAddress,
    uint256[] memory _unequipItemIds,
    uint256[] memory _amountsToUnequip
  ) internal {
    _safeBatchTransferChild1155From(
      _tokenId,
      _owner,
      _itemAddress,
      _unequipItemIds,
      _amountsToUnequip,
      toBytes(_tokenId)
    );
  }

  function _hashMintData(MintVoucher calldata voucher)
    internal
    view
    returns (bytes32)
  {
    bytes memory changeInfo = abi.encodePacked(voucher.price, voucher.wallet);

    bytes memory domainInfo = abi.encodePacked(
      this.getChainID(),
      SIGNING_DOMAIN,
      SIGNATURE_VERSION,
      address(this),
      mintNonce[_msgSender()]
    );

    return
      ECDSA.toEthSignedMessageHash(
        keccak256(abi.encodePacked(changeInfo, domainInfo))
      );
  }

  function _hashBulkChangeData(
    BulkChangeVoucher calldata voucher,
    bool includeNonce
  ) internal view returns (bytes32) {
    bytes memory firstPart = abi.encodePacked(
      voucher.tokenId,
      voucher.itemContractAddress,
      voucher.itemsToEquip,
      voucher.amountsToEquip,
      voucher.slotsToEquip,
      voucher.itemsToUnequip
    );

    bytes memory secondPart = abi.encodePacked(
      voucher.amountsToUnequip,
      this.getChainID(),
      SIGNING_DOMAIN,
      SIGNATURE_VERSION,
      address(this)
    );

    if (includeNonce) {
      bytes memory nonce = abi.encodePacked(claimNonce[voucher.tokenId]);
      return
        ECDSA.toEthSignedMessageHash(
          keccak256(abi.encodePacked(firstPart, secondPart, nonce))
        );
    } else {
      return
        ECDSA.toEthSignedMessageHash(
          keccak256(abi.encodePacked(firstPart, secondPart))
        );
    }
  }

  function _verifyMintData(MintVoucher calldata voucher)
    internal
    view
    returns (address)
  {
    bytes32 digest = _hashMintData(voucher);
    return ECDSA.recover(digest, voucher.signature);
  }

  function _verifyBulkChangeData(
    BulkChangeVoucher calldata voucher,
    bool includeNonce
  ) internal view returns (address) {
    bytes32 digest = _hashBulkChangeData(voucher, includeNonce);
    return ECDSA.recover(digest, voucher.signature);
  }

  function setRoyalty(address creator, uint8 _royaltyPercentage)
    public
    onlyOwner
  {
    royaltyReceiver = creator;
    royaltyPercentage = _royaltyPercentage;
  }

  /// @notice Called with the sale price to determine how much royalty
  //          is owed and to whom.
  /// @param tokenId - the NFT asset queried for royalty information (not used)
  /// @param _salePrice - sale price of the NFT asset specified by _tokenId
  /// @return receiver - address of who should be sent the royalty payment
  /// @return royaltyAmount - the royalty payment amount for _value sale price
  function royaltyInfo(uint256 tokenId, uint256 _salePrice)
    external
    view
    override(IERC2981)
    returns (address receiver, uint256 royaltyAmount)
  {
    uint256 _royalties = (_salePrice * royaltyPercentage) / 100;
    return (royaltyReceiver, _royalties);
  }

  function onERC1155Received(
    address operator,
    address from,
    uint256 id,
    uint256 amount,
    bytes memory data
  ) public override returns (bytes4) {
    require(
      operator == address(this),
      "Only the Hero contract can pull items in"
    );
    return super.onERC1155Received(operator, from, id, amount, data);
  }

  function onERC1155BatchReceived(
    address operator,
    address from,
    uint256[] memory ids,
    uint256[] memory values,
    bytes memory data
  ) public override returns (bytes4) {
    require(
      operator == address(this),
      "Only the Hero contract can pull items in"
    );
    return super.onERC1155BatchReceived(operator, from, ids, values, data);
  }

  function _beforeTokenTransfer(
    address from,
    address to,
    uint256 tokenId
  ) internal virtual override(ERC721, ERC721Enumerable) {
    super._beforeTokenTransfer(from, to, tokenId);
  }

  function getChainID() external view returns (uint256) {
    uint256 id;
    assembly {
      id := chainid()
    }
    return id;
  }

  function toBytes(uint256 x) internal pure returns (bytes memory b) {
    b = new bytes(32);
    assembly {
      mstore(add(b, 32), x)
    }
  }
}

File 2 of 26 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "./IERC721Enumerable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

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

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

    /**
     * @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 override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}

File 3 of 26 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

File 4 of 26 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 5 of 26 : ERC165Checker.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Checker.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

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

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

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

        return interfaceIdsSupported;
    }

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

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

        // all interfaces supported
        return true;
    }

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

File 6 of 26 : draft-EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)

pragma solidity ^0.8.0;

import "./ECDSA.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712 {
    /* solhint-disable var-name-mixedcase */
    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
    uint256 private immutable _CACHED_CHAIN_ID;
    address private immutable _CACHED_THIS;

    bytes32 private immutable _HASHED_NAME;
    bytes32 private immutable _HASHED_VERSION;
    bytes32 private immutable _TYPE_HASH;

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        bytes32 typeHash = keccak256(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        );
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
        _CACHED_CHAIN_ID = block.chainid;
        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
        _CACHED_THIS = address(this);
        _TYPE_HASH = typeHash;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
            return _CACHED_DOMAIN_SEPARATOR;
        } else {
            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
        }
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }
}

File 7 of 26 : IERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 *
 * _Available since v4.5._
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount);
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

File 9 of 26 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 10 of 26 : ERC998TopDown.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

import "./IERC998ERC1155TopDown.sol";

contract ERC998TopDown is ERC721, IERC998ERC1155TopDown {
  using EnumerableSet for EnumerableSet.AddressSet;
  using EnumerableSet for EnumerableSet.UintSet;

  // _balances[tokenId][child address][child tokenId] = amount
  mapping(uint256 => mapping(address => mapping(uint256 => uint256)))
    internal _balances1155;

  mapping(uint256 => EnumerableSet.AddressSet) internal _child1155Contracts;
  mapping(uint256 => mapping(address => EnumerableSet.UintSet))
    internal _childrenForChild1155Contracts;

  constructor(string memory name, string memory symbol) ERC721(name, symbol) {}

  /**
   * @dev Gives child balance for a specific child 1155 contract and child id.
   */
  function child1155Balance(
    uint256 tokenId,
    address childContract,
    uint256 childTokenId
  ) public view override returns (uint256) {
    return _balances1155[tokenId][childContract][childTokenId];
  }

  /**
   * @dev Gives list of child 1155 contracts where token ID has childs.
   */
  function child1155ContractsFor(uint256 tokenId)
    public
    view
    override
    returns (address[] memory)
  {
    address[] memory childContracts = new address[](
      _child1155Contracts[tokenId].length()
    );

    for (uint256 i = 0; i < _child1155Contracts[tokenId].length(); i++) {
      childContracts[i] = _child1155Contracts[tokenId].at(i);
    }

    return childContracts;
  }

  /**
   * @dev Gives list of owned child IDs on a child 1155 contract by token ID.
   */
  function child1155IdsForOn(uint256 tokenId, address childContract)
    public
    view
    override
    returns (uint256[] memory)
  {
    uint256[] memory childTokenIds = new uint256[](
      _childrenForChild1155Contracts[tokenId][childContract].length()
    );

    for (
      uint256 i = 0;
      i < _childrenForChild1155Contracts[tokenId][childContract].length();
      i++
    ) {
      childTokenIds[i] = _childrenForChild1155Contracts[tokenId][childContract]
        .at(i);
    }

    return childTokenIds;
  }

  /**
   * @dev Transfers batch of child 1155 tokens from a token ID.
   */
  function _safeBatchTransferChild1155From(
    uint256 fromTokenId,
    address to,
    address childContract,
    uint256[] memory childTokenIds,
    uint256[] memory amounts,
    bytes memory data
  ) internal {
    require(
      childTokenIds.length == amounts.length,
      "ERC998: ids and amounts length mismatch"
    );
    require(to != address(0), "ERC998: transfer to the zero address");

    address operator = _msgSender();
    require(
      ownerOf(fromTokenId) == operator ||
        isApprovedForAll(ownerOf(fromTokenId), operator),
      "ERC998: caller is not owner nor approved"
    );

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

      _removeChild1155(fromTokenId, childContract, childTokenId, amount);
    }

    ERC1155(childContract).safeBatchTransferFrom(
      address(this),
      to,
      childTokenIds,
      amounts,
      data
    );
    emit TransferBatchChild1155(
      fromTokenId,
      to,
      childContract,
      childTokenIds,
      amounts
    );
  }

  /**
   * @dev Receives a child token, the receiver token ID must be encoded in the
   * field data. Operator is the account who initiated the transfer.
   */
  function onERC1155Received(
    address operator,
    address from,
    uint256 id,
    uint256 amount,
    bytes memory data
  ) public virtual override returns (bytes4) {
    require(
      data.length == 32,
      "ERC998: data must contain the unique uint256 tokenId to transfer the child token to"
    );

    uint256 _receiverTokenId;
    uint256 _index = msg.data.length - 32;
    assembly {
      _receiverTokenId := calldataload(_index)
    }

    _receiveChild1155(_receiverTokenId, msg.sender, id, amount);
    emit ReceivedChild1155(from, _receiverTokenId, msg.sender, id, amount);

    return this.onERC1155Received.selector;
  }

  /**
   * @dev Receives a batch of child tokens, the receiver token ID must be
   * encoded in the field data. Operator is the account who initiated the transfer.
   */
  function onERC1155BatchReceived(
    address operator,
    address from,
    uint256[] memory ids,
    uint256[] memory values,
    bytes memory data
  ) public virtual override returns (bytes4) {
    require(
      data.length == 32,
      "ERC998: data must contain the unique uint256 tokenId to transfer the child token to"
    );
    require(
      ids.length == values.length,
      "ERC1155: ids and values length mismatch"
    );

    uint256 _receiverTokenId;
    uint256 _index = msg.data.length - 32;
    assembly {
      _receiverTokenId := calldataload(_index)
    }

    for (uint256 i = 0; i < ids.length; i++) {
      _receiveChild1155(_receiverTokenId, msg.sender, ids[i], values[i]);
      emit ReceivedChild1155(
        from,
        _receiverTokenId,
        msg.sender,
        ids[i],
        values[i]
      );
    }

    return this.onERC1155BatchReceived.selector;
  }

  /**
   * @dev Update bookkeeping when a 998 is sent a child 1155 token.
   */
  function _receiveChild1155(
    uint256 tokenId,
    address childContract,
    uint256 childTokenId,
    uint256 amount
  ) internal virtual {
    if (!_child1155Contracts[tokenId].contains(childContract)) {
      _child1155Contracts[tokenId].add(childContract);
    }

    if (_balances1155[tokenId][childContract][childTokenId] == 0) {
      _childrenForChild1155Contracts[tokenId][childContract].add(childTokenId);
    }

    _balances1155[tokenId][childContract][childTokenId] += amount;
  }

  /**
   * @dev Update bookkeeping when a child 1155 token is removed from a 998.
   */
  function _removeChild1155(
    uint256 tokenId,
    address childContract,
    uint256 childTokenId,
    uint256 amount
  ) internal virtual {
    require(
      amount != 0 ||
        _balances1155[tokenId][childContract][childTokenId] >= amount,
      "ERC998: insufficient child balance for transfer"
    );

    _balances1155[tokenId][childContract][childTokenId] -= amount;
    if (_balances1155[tokenId][childContract][childTokenId] == 0) {
      _childrenForChild1155Contracts[tokenId][childContract].remove(
        childTokenId
      );
      if (
        _childrenForChild1155Contracts[tokenId][childContract].length() == 0
      ) {
        _child1155Contracts[tokenId].remove(childContract);
      }
    }
  }
}

File 11 of 26 : IItem.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.13;

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IItem {
  function claimFromHero(
    address signer,
    address to,
    uint256[] memory items,
    uint256[] memory amounts,
    bytes memory data
  ) external;
}

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

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

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

        _transfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

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

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

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

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

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

File 13 of 26 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @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);

    /**
     * @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 14 of 26 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 17 of 26 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

import "../Strings.sol";

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

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

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

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

File 22 of 26 : ERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.0;

import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
    using Address for address;

    // Mapping from token ID to account balances
    mapping(uint256 => mapping(address => uint256)) private _balances;

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

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;

    /**
     * @dev See {_setURI}.
     */
    constructor(string memory uri_) {
        _setURI(uri_);
    }

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

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) public view virtual override returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
        require(account != address(0), "ERC1155: balance query for the zero address");
        return _balances[id][account];
    }

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

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

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

        return batchBalances;
    }

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

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

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );
        _safeTransferFrom(from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: transfer caller is not owner nor approved"
        );
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }
        _balances[id][to] += amount;

        emit TransferSingle(operator, from, to, id, amount);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

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

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
            _balances[id][to] += amount;
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        _balances[id][to] += amount;
        emit TransferSingle(operator, address(0), to, id, amount);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] += amounts[i];
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `amount` tokens of token type `id`.
     */
    function _burn(
        address from,
        uint256 id,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }

        emit TransferSingle(operator, from, address(0), id, amount);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(
        address from,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

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

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
        }

        emit TransferBatch(operator, from, address(0), ids, amounts);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC1155: setting approval status for self");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155Receiver.onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

File 24 of 26 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

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

            if (lastIndex != toDeleteIndex) {
                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] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // 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) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}

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

pragma solidity ^0.8.13;
pragma experimental ABIEncoderV2;

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

interface IERC998ERC1155TopDown is IERC721, IERC1155Receiver {
  event ReceivedChild1155(
    address indexed from,
    uint256 indexed toTokenId,
    address indexed childContract,
    uint256 childTokenId,
    uint256 amount
  );
  event TransferSingleChild1155(
    uint256 indexed fromTokenId,
    address indexed to,
    address indexed childContract,
    uint256 childTokenId,
    uint256 amount
  );
  event TransferBatchChild1155(
    uint256 indexed fromTokenId,
    address indexed to,
    address indexed childContract,
    uint256[] childTokenIds,
    uint256[] amounts
  );

  function child1155ContractsFor(uint256 tokenId)
    external
    view
    returns (address[] memory childContracts);

  function child1155IdsForOn(uint256 tokenId, address childContract)
    external
    view
    returns (uint256[] memory childIds);

  function child1155Balance(
    uint256 tokenId,
    address childContract,
    uint256 childTokenId
  ) external view returns (uint256);
}

File 26 of 26 : IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

import "../IERC1155.sol";

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"maxSupply_","type":"uint256"},{"internalType":"string","name":"uri_","type":"string"},{"internalType":"address payable","name":"signer_","type":"address"},{"internalType":"address payable","name":"primarySalesReceiver_","type":"address"},{"internalType":"address payable","name":"royaltyReceiver_","type":"address"},{"internalType":"uint8","name":"royaltyPercentage_","type":"uint8"},{"internalType":"string","name":"contractURI_","type":"string"},{"internalType":"string","name":"provenanceHash_","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"itemsToEquip","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"amountsToEquip","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"slotsToEquip","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"itemsToUnequip","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"amountsToUnequip","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"heroOwner","type":"address"}],"name":"BulkChanges","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ItemsClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"childContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"childTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ReceivedChild1155","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"childContract","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"childTokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"TransferBatchChild1155","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"childContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"childTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TransferSingleChild1155","type":"event"},{"inputs":[{"internalType":"address","name":"signer_","type":"address"}],"name":"addSigner","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":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"itemContractAddress","type":"address"},{"internalType":"uint256[]","name":"itemsToEquip","type":"uint256[]"},{"internalType":"uint256[]","name":"amountsToEquip","type":"uint256[]"},{"internalType":"uint256[]","name":"slotsToEquip","type":"uint256[]"},{"internalType":"uint256[]","name":"itemsToUnequip","type":"uint256[]"},{"internalType":"uint256[]","name":"amountsToUnequip","type":"uint256[]"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct Hero.BulkChangeVoucher","name":"bulkChangeVoucher","type":"tuple"}],"name":"bulkChanges","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"childContract","type":"address"},{"internalType":"uint256","name":"childTokenId","type":"uint256"}],"name":"child1155Balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"child1155ContractsFor","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"childContract","type":"address"}],"name":"child1155IdsForOn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"itemContractAddress","type":"address"},{"internalType":"uint256[]","name":"itemsToEquip","type":"uint256[]"},{"internalType":"uint256[]","name":"amountsToEquip","type":"uint256[]"},{"internalType":"uint256[]","name":"slotsToEquip","type":"uint256[]"},{"internalType":"uint256[]","name":"itemsToUnequip","type":"uint256[]"},{"internalType":"uint256[]","name":"amountsToUnequip","type":"uint256[]"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct Hero.BulkChangeVoucher","name":"voucher","type":"tuple"}],"name":"claimItems","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"signer_","type":"address"}],"name":"disableSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getClaimNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"msgSigner","type":"address"}],"name":"getMintNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"address","name":"wallet","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct Hero.MintVoucher","name":"voucher","type":"tuple"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"primarySalesReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"provenanceHash","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"royaltyPercentage","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"royaltyReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"contractURI_","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creator","type":"address"},{"internalType":"uint8","name":"_royaltyPercentage","type":"uint8"}],"name":"setRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri_","type":"string"}],"name":"setUri","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":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101406040523480156200001257600080fd5b5060405162004c4f38038062004c4f83398101604081905262000035916200045d565b604051806040016040528060048152602001634865726f60e01b815250604051806040016040528060018152602001603160f81b815250604051806040016040528060048152602001634865726f60e01b815250604051806040016040528060048152602001634845524f60e01b81525081818160009080519060200190620000c0929190620002bb565b508051620000d6906001906020840190620002bb565b5050505050620000f5620000ef6200025c60201b60201c565b62000260565b815160208084019190912082518383012060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81880181905281830187905260608201869052608082019490945230818401528151808203909301835260c00190528051940193909320919290916080523060c05261012052505050506001600160a01b0386166000908152600e60209081526040909120805460ff191660011790556012899055620001c89060149062001971620002b2821b17901c565b8651620001dd9060119060208a0190620002bb565b50600f80546001600160a01b0319166001600160a01b0387811691909117909155601080549186166001600160a81b031990921691909117600160a01b60ff861602179055815162000237906013906020850190620002bb565b5080516200024d906017906020840190620002bb565b50505050505050505062000580565b3390565b600d80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80546001019055565b828054620002c99062000544565b90600052602060002090601f016020900481019282620002ed576000855562000338565b82601f106200030857805160ff191683800117855562000338565b8280016001018555821562000338579182015b82811115620003385782518255916020019190600101906200031b565b50620003469291506200034a565b5090565b5b808211156200034657600081556001016200034b565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200038957600080fd5b81516001600160401b0380821115620003a657620003a662000361565b604051601f8301601f19908116603f01168101908282118183101715620003d157620003d162000361565b81604052838152602092508683858801011115620003ee57600080fd5b600091505b83821015620004125785820183015181830184015290820190620003f3565b83821115620004245760008385830101525b9695505050505050565b80516001600160a01b03811681146200044657600080fd5b919050565b805160ff811681146200044657600080fd5b600080600080600080600080610100898b0312156200047b57600080fd5b885160208a01519098506001600160401b03808211156200049b57600080fd5b620004a98c838d0162000377565b9850620004b960408c016200042e565b9750620004c960608c016200042e565b9650620004d960808c016200042e565b9550620004e960a08c016200044b565b945060c08b01519150808211156200050057600080fd5b6200050e8c838d0162000377565b935060e08b01519150808211156200052557600080fd5b50620005348b828c0162000377565b9150509295985092959890939650565b600181811c908216806200055957607f821691505b6020821081036200057a57634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e0516101005161012051614691620005be6000396000505060005050600050506000505060005050600050506146916000f3fe6080604052600436106102515760003560e01c8063938e3d7b11610139578063c6ab67a3116100b6578063e8a3d4851161007a578063e8a3d48514610775578063e985e9c51461078a578063eb12d61e146107aa578063f23a6e61146107ca578063f2fde38b146107ea578063ffdfd3181461080a57600080fd5b8063c6ab67a3146106ea578063c87b56dd146106ff578063d2fab2da1461071f578063d5abeb011461073f578063dfae7d441461075557600080fd5b8063a22cb465116100fd578063a22cb4651461063e578063a471bf8d1461065e578063b88d4fde14610671578063b8a6fe3b14610691578063bc197c81146106b157600080fd5b8063938e3d7b1461059357806395d89b41146105b3578063976acdff146105c85780639b642de1146105fe5780639fbc87131461061e57600080fd5b80632f745c59116101d25780636352211e116101965780636352211e146104c057806370a08231146104e0578063715018a614610500578063782f5423146105155780638a71bb2d146105425780638da5cb5b1461057557600080fd5b80632f745c59146104205780633c8619e41461044057806342842e0e1461046d5780634f6ccce71461048d578063564b81ef146104ad57600080fd5b806318160ddd1161021957806318160ddd1461035f57806323b872dd1461037457806327086336146103945780632a55205a146103b45780632f3b6516146103f357600080fd5b806301a002101461025657806301ffc9a7146102b357806306fdde03146102e3578063081812fc14610305578063095ea7b31461033d575b600080fd5b34801561026257600080fd5b506102a061027136600461375a565b6000928352600a602090815260408085206001600160a01b039490941685529281528284209184525290205490565b6040519081526020015b60405180910390f35b3480156102bf57600080fd5b506102d36102ce3660046137a5565b61082a565b60405190151581526020016102aa565b3480156102ef57600080fd5b506102f8610855565b6040516102aa919061381a565b34801561031157600080fd5b5061032561032036600461382d565b6108e7565b6040516001600160a01b0390911681526020016102aa565b34801561034957600080fd5b5061035d610358366004613846565b610981565b005b34801561036b57600080fd5b506008546102a0565b34801561038057600080fd5b5061035d61038f366004613870565b610a96565b3480156103a057600080fd5b5061035d6103af36600461389c565b610ac7565b3480156103c057600080fd5b506103d46103cf3660046138b7565b610b12565b604080516001600160a01b0390931683526020830191909152016102aa565b3480156103ff57600080fd5b506102a061040e36600461382d565b60009081526016602052604090205490565b34801561042c57600080fd5b506102a061043b366004613846565b610b56565b34801561044c57600080fd5b5061046061045b36600461382d565b610bec565b6040516102aa91906138d9565b34801561047957600080fd5b5061035d610488366004613870565b610cc6565b34801561049957600080fd5b506102a06104a836600461382d565b610ce1565b3480156104b957600080fd5b50466102a0565b3480156104cc57600080fd5b506103256104db36600461382d565b610d74565b3480156104ec57600080fd5b506102a06104fb36600461389c565b610deb565b34801561050c57600080fd5b5061035d610e72565b34801561052157600080fd5b50610535610530366004613926565b610ea8565b6040516102aa919061398d565b34801561054e57600080fd5b5060105461056390600160a01b900460ff1681565b60405160ff90911681526020016102aa565b34801561058157600080fd5b50600d546001600160a01b0316610325565b34801561059f57600080fd5b5061035d6105ae366004613a3d565b610fb2565b3480156105bf57600080fd5b506102f8610fc9565b3480156105d457600080fd5b506102a06105e336600461389c565b6001600160a01b031660009081526015602052604090205490565b34801561060a57600080fd5b5061035d610619366004613a3d565b610fd8565b34801561062a57600080fd5b50601054610325906001600160a01b031681565b34801561064a57600080fd5b5061035d610659366004613a93565b611015565b61035d61066c366004613aca565b611020565b34801561067d57600080fd5b5061035d61068c366004613b24565b61125f565b34801561069d57600080fd5b5061035d6106ac366004613b8b565b611291565b3480156106bd57600080fd5b506106d16106cc366004613c3c565b6112ea565b6040516001600160e01b031990911681526020016102aa565b3480156106f657600080fd5b506102f861132b565b34801561070b57600080fd5b506102f861071a36600461382d565b6113b9565b34801561072b57600080fd5b5061035d61073a366004613ce5565b611460565b34801561074b57600080fd5b506102a060125481565b34801561076157600080fd5b50600f54610325906001600160a01b031681565b34801561078157600080fd5b506102f86116a2565b34801561079657600080fd5b506102d36107a5366004613d20565b6116b1565b3480156107b657600080fd5b5061035d6107c536600461389c565b6116df565b3480156107d657600080fd5b506106d16107e5366004613d4a565b61172d565b3480156107f657600080fd5b5061035d61080536600461389c565b611764565b34801561081657600080fd5b5061035d610825366004613ce5565b6117ff565b600063152a902d60e11b6001600160e01b03198316148061084f575061084f8261197a565b92915050565b60606000805461086490613dae565b80601f016020809104026020016040519081016040528092919081815260200182805461089090613dae565b80156108dd5780601f106108b2576101008083540402835291602001916108dd565b820191906000526020600020905b8154815290600101906020018083116108c057829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166109655760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b600061098c82610d74565b9050806001600160a01b0316836001600160a01b0316036109f95760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161095c565b336001600160a01b0382161480610a155750610a1581336116b1565b610a875760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161095c565b610a91838361199f565b505050565b610aa03382611a0d565b610abc5760405162461bcd60e51b815260040161095c90613de8565b610a91838383611ae4565b600d546001600160a01b03163314610af15760405162461bcd60e51b815260040161095c90613e39565b6001600160a01b03166000908152600e60205260409020805460ff19169055565b60105460009081908190606490610b3390600160a01b900460ff1686613e84565b610b3d9190613eb9565b6010546001600160a01b031693509150505b9250929050565b6000610b6183610deb565b8210610bc35760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161095c565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6000818152600b6020526040812060609190610c0790611c8b565b6001600160401b03811115610c1e57610c1e6139a0565b604051908082528060200260200182016040528015610c47578160200160208202803683370190505b50905060005b6000848152600b60205260409020610c6490611c8b565b811015610cbf576000848152600b60205260409020610c839082611c95565b828281518110610c9557610c95613ecd565b6001600160a01b039092166020928302919091019091015280610cb781613ee3565b915050610c4d565b5092915050565b610a918383836040518060200160405280600081525061125f565b6000610cec60085490565b8210610d4f5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161095c565b60088281548110610d6257610d62613ecd565b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b03168061084f5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161095c565b60006001600160a01b038216610e565760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161095c565b506001600160a01b031660009081526003602052604090205490565b600d546001600160a01b03163314610e9c5760405162461bcd60e51b815260040161095c90613e39565b610ea66000611ca8565b565b6000828152600c602090815260408083206001600160a01b0385168452909152812060609190610ed790611c8b565b6001600160401b03811115610eee57610eee6139a0565b604051908082528060200260200182016040528015610f17578160200160208202803683370190505b50905060005b6000858152600c602090815260408083206001600160a01b03881684529091529020610f4890611c8b565b811015610faa576000858152600c602090815260408083206001600160a01b03881684529091529020610f7b9082611c95565b828281518110610f8d57610f8d613ecd565b602090810291909101015280610fa281613ee3565b915050610f1d565b509392505050565b8051610fc59060139060208401906136a5565b5050565b60606001805461086490613dae565b600d546001600160a01b031633146110025760405162461bcd60e51b815260040161095c90613e39565b8051610fc59060119060208401906136a5565b610fc5338383611cfa565b348135146110705760405162461bcd60e51b815260206004820152601d60248201527f566f75636865723a20496e76616c696420707269636520616d6f756e74000000604482015260640161095c565b600061107b60145490565b90506012548111156110cf5760405162461bcd60e51b815260206004820152601e60248201527f4865726f3a204e6f206d6f7265206865726f657320617661696c61626c650000604482015260640161095c565b60006110da83611dc8565b6001600160a01b0381166000908152600e602052604090205490915060ff16151560011461111a5760405162461bcd60e51b815260040161095c90613efc565b61112a604084016020850161389c565b6001600160a01b0316336001600160a01b0316146111815760405162461bcd60e51b815260206004820152601460248201527312195c9bce88125b9d985b1a59081dd85b1b195d60621b604482015260640161095c565b33600090815260156020526040812080549161119c83613ee3565b91905055506111b16111ab3390565b83611e21565b600f546040516000916001600160a01b03169034908381818185875af1925050503d80600081146111fe576040519150601f19603f3d011682016040523d82523d6000602084013e611203565b606091505b505090508061124b5760405162461bcd60e51b815260206004820152601460248201527312195c9bce8814185e5b595b9d0819985a5b195960621b604482015260640161095c565b611259601480546001019055565b50505050565b6112693383611a0d565b6112855760405162461bcd60e51b815260040161095c90613de8565b61125984848484611e3b565b600d546001600160a01b031633146112bb5760405162461bcd60e51b815260040161095c90613e39565b6010805460ff909216600160a01b026001600160a81b03199092166001600160a01b0390931692909217179055565b60006001600160a01b03861630146113145760405162461bcd60e51b815260040161095c90613f3d565b6113218686868686611e6e565b9695505050505050565b6017805461133890613dae565b80601f016020809104026020016040519081016040528092919081815260200182805461136490613dae565b80156113b15780601f10611386576101008083540402835291602001916113b1565b820191906000526020600020905b81548152906001019060200180831161139457829003601f168201915b505050505081565b6000818152600260205260409020546060906001600160a01b031661142e5760405162461bcd60e51b815260206004820152602560248201527f4865726f3a2055524920717565727920666f72206e6f6e6578697374656e74206044820152643a37b5b2b760d91b606482015260840161095c565b601161143983612000565b60405160200161144a929190613fa1565b6040516020818303038152906040529050919050565b803561146c3382611a0d565b6114885760405162461bcd60e51b815260040161095c90614047565b6000611495836000612100565b6001600160a01b0381166000908152600e602052604090205490915060ff1615156001146114d55760405162461bcd60e51b815260040161095c90613efc565b61157683356114e381610d74565b6114f3604087016020880161389c565b61150060a088018861408d565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061153f9250505060c089018961408d565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061212092505050565b61160f83353361158c604087016020880161389c565b611599604088018861408d565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506115d892505050606089018961408d565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061213d92505050565b7f29051e3cd9820352c380e4c671cb37f4eba6497379a9ed1084523146f1bfe529833561163f604086018661408d565b61164c606088018861408d565b61165960808a018a61408d565b61166660a08c018c61408d565b61167360c08e018e61408d565b61167d8f35610d74565b6040516116959c9b9a9998979695949392919061410c565b60405180910390a1505050565b60606013805461086490613dae565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b600d546001600160a01b031633146117095760405162461bcd60e51b815260040161095c90613e39565b6001600160a01b03166000908152600e60205260409020805460ff19166001179055565b60006001600160a01b03861630146117575760405162461bcd60e51b815260040161095c90613f3d565b611321868686868661222e565b600d546001600160a01b0316331461178e5760405162461bcd60e51b815260040161095c90613e39565b6001600160a01b0381166117f35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161095c565b6117fc81611ca8565b50565b803561180b3382611a0d565b6118275760405162461bcd60e51b815260040161095c90614047565b6000611834836001612100565b6001600160a01b0381166000908152600e602052604090205490915060ff1615156001146118745760405162461bcd60e51b815260040161095c90613efc565b8235600090815260166020526040812080549161189083613ee3565b909155506118a69050604084016020850161389c565b6001600160a01b031663f1ca9d2d6118c6600d546001600160a01b031690565b306118d4604088018861408d565b6118e160608a018a61408d565b6118eb8b356122cd565b6040518863ffffffff1660e01b815260040161190d979695949392919061419a565b600060405180830381600087803b15801561192757600080fd5b505af115801561193b573d6000803e3d6000fd5b5050604051853581527ffcfed02b0b40bef346c5670125d4b90255c170c7ca20474c0be81f2be6274a9192506020019050611695565b80546001019055565b60006001600160e01b0319821663780e9d6360e01b148061084f575061084f826122f7565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906119d482610d74565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b0316611a865760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161095c565b6000611a9183610d74565b9050806001600160a01b0316846001600160a01b03161480611ab85750611ab881856116b1565b80611adc5750836001600160a01b0316611ad1846108e7565b6001600160a01b0316145b949350505050565b826001600160a01b0316611af782610d74565b6001600160a01b031614611b5b5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161095c565b6001600160a01b038216611bbd5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161095c565b611bc8838383612347565b611bd360008261199f565b6001600160a01b0383166000908152600360205260408120805460019290611bfc9084906141fc565b90915550506001600160a01b0382166000908152600360205260408120805460019290611c2a908490614213565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600061084f825490565b6000611ca18383612352565b9392505050565b600d80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b031603611d5b5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161095c565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b600080611dd48361237c565b9050611ca181611de7604086018661422b565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061252c92505050565b610fc5828260405180602001604052806000815250612548565b611e46848484611ae4565b611e528484848461257b565b6112595760405162461bcd60e51b815260040161095c90614271565b60008151602014611e915760405162461bcd60e51b815260040161095c906142c3565b8251845114611ef25760405162461bcd60e51b815260206004820152602760248201527f455243313135353a2069647320616e642076616c756573206c656e677468206d6044820152660d2e6dac2e8c6d60cb1b606482015260840161095c565b600080611f006020366141fc565b90508035915060005b8651811015611feb57611f508333898481518110611f2957611f29613ecd565b6020026020010151898581518110611f4357611f43613ecd565b602002602001015161267c565b336001600160a01b031683896001600160a01b03167fd7888948ee7a8c63f452e7acd7a939ceb46066e16f52de72c8fa328e28f2aad18a8581518110611f9857611f98613ecd565b60200260200101518a8681518110611fb257611fb2613ecd565b6020026020010151604051611fd1929190918252602082015260400190565b60405180910390a480611fe381613ee3565b915050611f09565b5063bc197c8160e01b98975050505050505050565b6060816000036120275750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612051578061203b81613ee3565b915061204a9050600a83613eb9565b915061202b565b6000816001600160401b0381111561206b5761206b6139a0565b6040519080825280601f01601f191660200182016040528015612095576020820181803683370190505b5090505b8415611adc576120aa6001836141fc565b91506120b7600a8661433c565b6120c2906030614213565b60f81b8183815181106120d7576120d7613ecd565b60200101906001600160f81b031916908160001a9053506120f9600a86613eb9565b9450612099565b60008061210d8484612756565b9050611adc81611de760e087018761422b565b61213685858585856121318b6122cd565b612903565b5050505050565b6121576001600160a01b038416636cdb3d1360e11b612b75565b156121cf57826001600160a01b0316632eb2c2d6853085856121788b6122cd565b6040518663ffffffff1660e01b8152600401612198959493929190614350565b600060405180830381600087803b1580156121b257600080fd5b505af11580156121c6573d6000803e3d6000fd5b50505050612136565b60405162461bcd60e51b815260206004820152602e60248201527f4865726f3a204974656d20646f6573206e6f7420737570706f7274204552432d60448201526d31313535207374616e646172647360901b606482015260840161095c565b600081516020146122515760405162461bcd60e51b815260040161095c906142c3565b60008061225f6020366141fc565b9050803591506122718233888861267c565b6040805187815260208101879052339184916001600160a01b038b16917fd7888948ee7a8c63f452e7acd7a939ceb46066e16f52de72c8fa328e28f2aad1910160405180910390a45063f23a6e6160e01b979650505050505050565b60408051602080825281830190925260609160208201818036833750505060208101929092525090565b60006001600160e01b031982166380ac58cd60e01b148061232857506001600160e01b03198216635b5e139f60e01b145b8061084f57506301ffc9a760e01b6001600160e01b031983161461084f565b610a91838383612b91565b600082600001828154811061236957612369613ecd565b9060005260206000200154905092915050565b6000808235612391604085016020860161389c565b6040516020016123b892919091825260601b6001600160601b031916602082015260340190565b60405160208183030381529060405290506000306001600160a01b031663564b81ef6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612409573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061242d91906143ae565b604051806040016040528060048152602001634865726f60e01b815250604051806040016040528060018152602001603160f81b81525030601560006124703390565b6001600160a01b03166001600160a01b03168152602001908152602001600020546040516020016124a59594939291906143c7565b6040516020818303038152906040529050611adc82826040516020016124cc929190614425565b60408051601f1981840301815282825280516020918201207f19457468657265756d205369676e6564204d6573736167653a0a33320000000084830152603c8085019190915282518085039091018152605c909301909152815191012090565b600080600061253b8585612c49565b91509150610faa81612cb4565b6125528383612e6a565b61255f600084848461257b565b610a915760405162461bcd60e51b815260040161095c90614271565b60006001600160a01b0384163b1561267157604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906125bf903390899088908890600401614454565b6020604051808303816000875af19250505080156125fa575060408051601f3d908101601f191682019092526125f791810190614487565b60015b612657573d808015612628576040519150601f19603f3d011682016040523d82523d6000602084013e61262d565b606091505b50805160000361264f5760405162461bcd60e51b815260040161095c90614271565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611adc565b506001949350505050565b6000848152600b602052604090206126949084612fb8565b6126b2576000848152600b602052604090206126b09084612fda565b505b6000848152600a602090815260408083206001600160a01b038716845282528083208584529091528120549003612711576000848152600c602090815260408083206001600160a01b0387168452909152902061270f9083612fef565b505b6000848152600a602090815260408083206001600160a01b038716845282528083208584529091528120805483929061274b908490614213565b909155505050505050565b600080833561276b604086016020870161389c565b612778604087018761408d565b612785606089018961408d565b61279260808b018b61408d565b61279f60a08d018d61408d565b6040516020016127b89a999897969594939291906144d1565b60408051601f19818403018152919052905060006127d960c086018661408d565b306001600160a01b031663564b81ef6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612817573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061283b91906143ae565b60408051808201825260048152634865726f60e01b6020808301919091528251808401845260018152603160f81b81830152925161287f969594939130910161452a565b604051602081830303815290604052905083156128e45784356000908152601660209081526040808320548151928301520160405160208183030381529060405290506128da8383836040516020016124cc9392919061458e565b935050505061084f565b6128fa82826040516020016124cc929190614425565b9250505061084f565b81518351146129645760405162461bcd60e51b815260206004820152602760248201527f4552433939383a2069647320616e6420616d6f756e7473206c656e677468206d6044820152660d2e6dac2e8c6d60cb1b606482015260840161095c565b6001600160a01b0385166129c65760405162461bcd60e51b8152602060048201526024808201527f4552433939383a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161095c565b33806129d188610d74565b6001600160a01b031614806129f357506129f36129ed88610d74565b826116b1565b612a505760405162461bcd60e51b815260206004820152602860248201527f4552433939383a2063616c6c6572206973206e6f74206f776e6572206e6f7220604482015267185c1c1c9bdd995960c21b606482015260840161095c565b60005b8451811015612ab7576000858281518110612a7057612a70613ecd565b602002602001015190506000858381518110612a8e57612a8e613ecd565b60200260200101519050612aa48a898484612ffb565b505080612ab090613ee3565b9050612a53565b50604051631759616b60e11b81526001600160a01b03861690632eb2c2d690612aec9030908a90899089908990600401614350565b600060405180830381600087803b158015612b0657600080fd5b505af1158015612b1a573d6000803e3d6000fd5b50505050846001600160a01b0316866001600160a01b0316887f83730c6482dabefeeec86d872d92bcd6a09df1ca6b3a6cbb17d07591339f15db8787604051612b649291906145d1565b60405180910390a450505050505050565b6000612b808361317e565b8015611ca15750611ca183836131b1565b6001600160a01b038316612bec57612be781600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b612c0f565b816001600160a01b0316836001600160a01b031614612c0f57612c0f8382613290565b6001600160a01b038216612c2657610a918161332d565b826001600160a01b0316826001600160a01b031614610a9157610a9182826133dc565b6000808251604103612c7f5760208301516040840151606085015160001a612c7387828585613420565b94509450505050610b4f565b8251604003612ca85760208301516040840151612c9d86838361350d565b935093505050610b4f565b50600090506002610b4f565b6000816004811115612cc857612cc86145f6565b03612cd05750565b6001816004811115612ce457612ce46145f6565b03612d315760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161095c565b6002816004811115612d4557612d456145f6565b03612d925760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161095c565b6003816004811115612da657612da66145f6565b03612dfe5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161095c565b6004816004811115612e1257612e126145f6565b036117fc5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161095c565b6001600160a01b038216612ec05760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161095c565b6000818152600260205260409020546001600160a01b031615612f255760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161095c565b612f3160008383612347565b6001600160a01b0382166000908152600360205260408120805460019290612f5a908490614213565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160a01b03811660009081526001830160205260408120541515611ca1565b6000611ca1836001600160a01b038416613546565b6000611ca18383613546565b8015158061303357506000848152600a602090815260408083206001600160a01b038716845282528083208584529091529020548111155b6130975760405162461bcd60e51b815260206004820152602f60248201527f4552433939383a20696e73756666696369656e74206368696c642062616c616e60448201526e31b2903337b9103a3930b739b332b960891b606482015260840161095c565b6000848152600a602090815260408083206001600160a01b03871684528252808320858452909152812080548392906130d19084906141fc565b90915550506000848152600a602090815260408083206001600160a01b038716845282528083208584529091528120549003611259576000848152600c602090815260408083206001600160a01b038716845290915290206131339083613595565b506000848152600c602090815260408083206001600160a01b0387168452909152902061315f90611c8b565b600003611259576000848152600b6020526040902061213690846135a1565b6000613191826301ffc9a760e01b6131b1565b801561084f57506131aa826001600160e01b03196131b1565b1592915050565b604080516001600160e01b0319831660248083019190915282518083039091018152604490910182526020810180516001600160e01b03166301ffc9a760e01b179052905160009190829081906001600160a01b038716906175309061321890869061460c565b6000604051808303818686fa925050503d8060008114613254576040519150601f19603f3d011682016040523d82523d6000602084013e613259565b606091505b5091509150602081511015613274576000935050505061084f565b8180156113215750808060200190518101906113219190614628565b6000600161329d84610deb565b6132a791906141fc565b6000838152600760205260409020549091508082146132fa576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061333f906001906141fc565b6000838152600960205260408120546008805493945090928490811061336757613367613ecd565b90600052602060002001549050806008838154811061338857613388613ecd565b60009182526020808320909101929092558281526009909152604080822084905585825281205560088054806133c0576133c0614645565b6001900381819060005260206000200160009055905550505050565b60006133e783610deb565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156134575750600090506003613504565b8460ff16601b1415801561346f57508460ff16601c14155b156134805750600090506004613504565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156134d4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166134fd57600060019250925050613504565b9150600090505b94509492505050565b6000806001600160ff1b0383168161352a60ff86901c601b614213565b905061353887828885613420565b935093505050935093915050565b600081815260018301602052604081205461358d5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561084f565b50600061084f565b6000611ca183836135b2565b6000611ca1836001600160a01b0384165b6000818152600183016020526040812054801561369b5760006135d66001836141fc565b85549091506000906135ea906001906141fc565b905081811461364f57600086600001828154811061360a5761360a613ecd565b906000526020600020015490508087600001848154811061362d5761362d613ecd565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061366057613660614645565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061084f565b600091505061084f565b8280546136b190613dae565b90600052602060002090601f0160209004810192826136d35760008555613719565b82601f106136ec57805160ff1916838001178555613719565b82800160010185558215613719579182015b828111156137195782518255916020019190600101906136fe565b50613725929150613729565b5090565b5b80821115613725576000815560010161372a565b80356001600160a01b038116811461375557600080fd5b919050565b60008060006060848603121561376f57600080fd5b8335925061377f6020850161373e565b9150604084013590509250925092565b6001600160e01b0319811681146117fc57600080fd5b6000602082840312156137b757600080fd5b8135611ca18161378f565b60005b838110156137dd5781810151838201526020016137c5565b838111156112595750506000910152565b600081518084526138068160208601602086016137c2565b601f01601f19169290920160200192915050565b602081526000611ca160208301846137ee565b60006020828403121561383f57600080fd5b5035919050565b6000806040838503121561385957600080fd5b6138628361373e565b946020939093013593505050565b60008060006060848603121561388557600080fd5b61388e8461373e565b925061377f6020850161373e565b6000602082840312156138ae57600080fd5b611ca18261373e565b600080604083850312156138ca57600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b8181101561391a5783516001600160a01b0316835292840192918401916001016138f5565b50909695505050505050565b6000806040838503121561393957600080fd5b823591506139496020840161373e565b90509250929050565b600081518084526020808501945080840160005b8381101561398257815187529582019590820190600101613966565b509495945050505050565b602081526000611ca16020830184613952565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156139de576139de6139a0565b604052919050565b60006001600160401b038311156139ff576139ff6139a0565b613a12601f8401601f19166020016139b6565b9050828152838383011115613a2657600080fd5b828260208301376000602084830101529392505050565b600060208284031215613a4f57600080fd5b81356001600160401b03811115613a6557600080fd5b8201601f81018413613a7657600080fd5b611adc848235602084016139e6565b80151581146117fc57600080fd5b60008060408385031215613aa657600080fd5b613aaf8361373e565b91506020830135613abf81613a85565b809150509250929050565b600060208284031215613adc57600080fd5b81356001600160401b03811115613af257600080fd5b820160608185031215611ca157600080fd5b600082601f830112613b1557600080fd5b611ca1838335602085016139e6565b60008060008060808587031215613b3a57600080fd5b613b438561373e565b9350613b516020860161373e565b92506040850135915060608501356001600160401b03811115613b7357600080fd5b613b7f87828801613b04565b91505092959194509250565b60008060408385031215613b9e57600080fd5b613ba78361373e565b9150602083013560ff81168114613abf57600080fd5b600082601f830112613bce57600080fd5b813560206001600160401b03821115613be957613be96139a0565b8160051b613bf88282016139b6565b9283528481018201928281019087851115613c1257600080fd5b83870192505b84831015613c3157823582529183019190830190613c18565b979650505050505050565b600080600080600060a08688031215613c5457600080fd5b613c5d8661373e565b9450613c6b6020870161373e565b935060408601356001600160401b0380821115613c8757600080fd5b613c9389838a01613bbd565b94506060880135915080821115613ca957600080fd5b613cb589838a01613bbd565b93506080880135915080821115613ccb57600080fd5b50613cd888828901613b04565b9150509295509295909350565b600060208284031215613cf757600080fd5b81356001600160401b03811115613d0d57600080fd5b82016101008185031215611ca157600080fd5b60008060408385031215613d3357600080fd5b613d3c8361373e565b91506139496020840161373e565b600080600080600060a08688031215613d6257600080fd5b613d6b8661373e565b9450613d796020870161373e565b9350604086013592506060860135915060808601356001600160401b03811115613da257600080fd5b613cd888828901613b04565b600181811c90821680613dc257607f821691505b602082108103613de257634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615613e9e57613e9e613e6e565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613ec857613ec8613ea3565b500490565b634e487b7160e01b600052603260045260246000fd5b600060018201613ef557613ef5613e6e565b5060010190565b60208082526021908201527f5369676e617475726520696e76616c6964206f7220756e617574686f72697a656040820152601960fa1b606082015260800190565b60208082526028908201527f4f6e6c7920746865204865726f20636f6e74726163742063616e2070756c6c2060408201526734ba32b6b99034b760c11b606082015260800190565b60008151613f978185602086016137c2565b9290920192915050565b600080845481600182811c915080831680613fbd57607f831692505b60208084108203613fdc57634e487b7160e01b86526022600452602486fd5b818015613ff057600181146140015761402e565b60ff1986168952848901965061402e565b60008b81526020902060005b868110156140265781548b82015290850190830161400d565b505084890196505b50505050505061403e8185613f85565b95945050505050565b60208082526026908201527f4865726f3a2043616c6c6572206973206e6f74206f776e6572206e6f722061706040820152651c1c9bdd995960d21b606082015260800190565b6000808335601e198436030181126140a457600080fd5b8301803591506001600160401b038211156140be57600080fd5b6020019150600581901b3603821315610b4f57600080fd5b81835260006001600160fb1b038311156140ef57600080fd5b8260051b8083602087013760009401602001938452509192915050565b8c815260e06020820152600061412660e083018d8f6140d6565b8281036040840152614139818c8e6140d6565b9050828103606084015261414e818a8c6140d6565b9050828103608084015261416381888a6140d6565b905082810360a08401526141788186886140d6565b91505060018060a01b03831660c08301529d9c50505050505050505050505050565b6001600160a01b0388811682528716602082015260a0604082018190526000906141c790830187896140d6565b82810360608401526141da8186886140d6565b905082810360808401526141ee81856137ee565b9a9950505050505050505050565b60008282101561420e5761420e613e6e565b500390565b6000821982111561422657614226613e6e565b500190565b6000808335601e1984360301811261424257600080fd5b8301803591506001600160401b0382111561425c57600080fd5b602001915036819003821315610b4f57600080fd5b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526053908201527f4552433939383a2064617461206d75737420636f6e7461696e2074686520756e60408201527f697175652075696e7432353620746f6b656e496420746f207472616e7366657260608201527220746865206368696c6420746f6b656e20746f60681b608082015260a00190565b60008261434b5761434b613ea3565b500690565b6001600160a01b0386811682528516602082015260a06040820181905260009061437c90830186613952565b828103606084015261438e8186613952565b905082810360808401526143a281856137ee565b98975050505050505050565b6000602082840312156143c057600080fd5b5051919050565b858152600085516143df816020850160208a016137c2565b808301905085516143f7816020840160208a016137c2565b60609590951b6001600160601b03191660209190950190810194909452505060348201526054019392505050565b600083516144378184602088016137c2565b83519083019061444b8183602088016137c2565b01949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090611321908301846137ee565b60006020828403121561449957600080fd5b8151611ca18161378f565b60006001600160fb1b038311156144ba57600080fd5b8260051b8083863760009401938452509192915050565b8a81526bffffffffffffffffffffffff198a60601b166020820152600061451a61451361450c614505603486018d8f6144a4565b8a8c6144a4565b87896144a4565b84866144a4565b9c9b505050505050505050505050565b600061453782888a6144a4565b868152855161454d816020840160208a016137c2565b85519101906145638160208085019089016137c2565b60609490941b6001600160601b03191660209190940190810193909352505060340195945050505050565b600084516145a08184602089016137c2565b8451908301906145b48183602089016137c2565b84519101906145c78183602088016137c2565b0195945050505050565b6040815260006145e46040830185613952565b828103602084015261403e8185613952565b634e487b7160e01b600052602160045260246000fd5b6000825161461e8184602087016137c2565b9190910192915050565b60006020828403121561463a57600080fd5b8151611ca181613a85565b634e487b7160e01b600052603160045260246000fdfea264697066735822122087239072725f49f2fd9535eb12d39945aca3aa9e414e311ab31103862dadf4aa64736f6c634300080d00330000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000010000000000000000000000000049822d805c16553dbfef2b78c2a34a91f0f8dee20000000000000000000000002fd12a10d25c329ebb745d7ad23c3293255894b60000000000000000000000001260c55fb13004250ded7ed94bca3851645bab6f000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000002768747470733a2f2f706978656c7761722e636f6d2f6170692f6865726f2f6d657461646174612f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002f68747470733a2f2f706978656c7761722e636f6d2f6170692f6865726f2f6d657461646174612f636f6e74726163740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004039373138376234663663613164663361313362333062333232313930643562323665623735346362376330626539646432336530636134343038376538303638

Deployed Bytecode

0x6080604052600436106102515760003560e01c8063938e3d7b11610139578063c6ab67a3116100b6578063e8a3d4851161007a578063e8a3d48514610775578063e985e9c51461078a578063eb12d61e146107aa578063f23a6e61146107ca578063f2fde38b146107ea578063ffdfd3181461080a57600080fd5b8063c6ab67a3146106ea578063c87b56dd146106ff578063d2fab2da1461071f578063d5abeb011461073f578063dfae7d441461075557600080fd5b8063a22cb465116100fd578063a22cb4651461063e578063a471bf8d1461065e578063b88d4fde14610671578063b8a6fe3b14610691578063bc197c81146106b157600080fd5b8063938e3d7b1461059357806395d89b41146105b3578063976acdff146105c85780639b642de1146105fe5780639fbc87131461061e57600080fd5b80632f745c59116101d25780636352211e116101965780636352211e146104c057806370a08231146104e0578063715018a614610500578063782f5423146105155780638a71bb2d146105425780638da5cb5b1461057557600080fd5b80632f745c59146104205780633c8619e41461044057806342842e0e1461046d5780634f6ccce71461048d578063564b81ef146104ad57600080fd5b806318160ddd1161021957806318160ddd1461035f57806323b872dd1461037457806327086336146103945780632a55205a146103b45780632f3b6516146103f357600080fd5b806301a002101461025657806301ffc9a7146102b357806306fdde03146102e3578063081812fc14610305578063095ea7b31461033d575b600080fd5b34801561026257600080fd5b506102a061027136600461375a565b6000928352600a602090815260408085206001600160a01b039490941685529281528284209184525290205490565b6040519081526020015b60405180910390f35b3480156102bf57600080fd5b506102d36102ce3660046137a5565b61082a565b60405190151581526020016102aa565b3480156102ef57600080fd5b506102f8610855565b6040516102aa919061381a565b34801561031157600080fd5b5061032561032036600461382d565b6108e7565b6040516001600160a01b0390911681526020016102aa565b34801561034957600080fd5b5061035d610358366004613846565b610981565b005b34801561036b57600080fd5b506008546102a0565b34801561038057600080fd5b5061035d61038f366004613870565b610a96565b3480156103a057600080fd5b5061035d6103af36600461389c565b610ac7565b3480156103c057600080fd5b506103d46103cf3660046138b7565b610b12565b604080516001600160a01b0390931683526020830191909152016102aa565b3480156103ff57600080fd5b506102a061040e36600461382d565b60009081526016602052604090205490565b34801561042c57600080fd5b506102a061043b366004613846565b610b56565b34801561044c57600080fd5b5061046061045b36600461382d565b610bec565b6040516102aa91906138d9565b34801561047957600080fd5b5061035d610488366004613870565b610cc6565b34801561049957600080fd5b506102a06104a836600461382d565b610ce1565b3480156104b957600080fd5b50466102a0565b3480156104cc57600080fd5b506103256104db36600461382d565b610d74565b3480156104ec57600080fd5b506102a06104fb36600461389c565b610deb565b34801561050c57600080fd5b5061035d610e72565b34801561052157600080fd5b50610535610530366004613926565b610ea8565b6040516102aa919061398d565b34801561054e57600080fd5b5060105461056390600160a01b900460ff1681565b60405160ff90911681526020016102aa565b34801561058157600080fd5b50600d546001600160a01b0316610325565b34801561059f57600080fd5b5061035d6105ae366004613a3d565b610fb2565b3480156105bf57600080fd5b506102f8610fc9565b3480156105d457600080fd5b506102a06105e336600461389c565b6001600160a01b031660009081526015602052604090205490565b34801561060a57600080fd5b5061035d610619366004613a3d565b610fd8565b34801561062a57600080fd5b50601054610325906001600160a01b031681565b34801561064a57600080fd5b5061035d610659366004613a93565b611015565b61035d61066c366004613aca565b611020565b34801561067d57600080fd5b5061035d61068c366004613b24565b61125f565b34801561069d57600080fd5b5061035d6106ac366004613b8b565b611291565b3480156106bd57600080fd5b506106d16106cc366004613c3c565b6112ea565b6040516001600160e01b031990911681526020016102aa565b3480156106f657600080fd5b506102f861132b565b34801561070b57600080fd5b506102f861071a36600461382d565b6113b9565b34801561072b57600080fd5b5061035d61073a366004613ce5565b611460565b34801561074b57600080fd5b506102a060125481565b34801561076157600080fd5b50600f54610325906001600160a01b031681565b34801561078157600080fd5b506102f86116a2565b34801561079657600080fd5b506102d36107a5366004613d20565b6116b1565b3480156107b657600080fd5b5061035d6107c536600461389c565b6116df565b3480156107d657600080fd5b506106d16107e5366004613d4a565b61172d565b3480156107f657600080fd5b5061035d61080536600461389c565b611764565b34801561081657600080fd5b5061035d610825366004613ce5565b6117ff565b600063152a902d60e11b6001600160e01b03198316148061084f575061084f8261197a565b92915050565b60606000805461086490613dae565b80601f016020809104026020016040519081016040528092919081815260200182805461089090613dae565b80156108dd5780601f106108b2576101008083540402835291602001916108dd565b820191906000526020600020905b8154815290600101906020018083116108c057829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166109655760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b600061098c82610d74565b9050806001600160a01b0316836001600160a01b0316036109f95760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161095c565b336001600160a01b0382161480610a155750610a1581336116b1565b610a875760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161095c565b610a91838361199f565b505050565b610aa03382611a0d565b610abc5760405162461bcd60e51b815260040161095c90613de8565b610a91838383611ae4565b600d546001600160a01b03163314610af15760405162461bcd60e51b815260040161095c90613e39565b6001600160a01b03166000908152600e60205260409020805460ff19169055565b60105460009081908190606490610b3390600160a01b900460ff1686613e84565b610b3d9190613eb9565b6010546001600160a01b031693509150505b9250929050565b6000610b6183610deb565b8210610bc35760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161095c565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6000818152600b6020526040812060609190610c0790611c8b565b6001600160401b03811115610c1e57610c1e6139a0565b604051908082528060200260200182016040528015610c47578160200160208202803683370190505b50905060005b6000848152600b60205260409020610c6490611c8b565b811015610cbf576000848152600b60205260409020610c839082611c95565b828281518110610c9557610c95613ecd565b6001600160a01b039092166020928302919091019091015280610cb781613ee3565b915050610c4d565b5092915050565b610a918383836040518060200160405280600081525061125f565b6000610cec60085490565b8210610d4f5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161095c565b60088281548110610d6257610d62613ecd565b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b03168061084f5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161095c565b60006001600160a01b038216610e565760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161095c565b506001600160a01b031660009081526003602052604090205490565b600d546001600160a01b03163314610e9c5760405162461bcd60e51b815260040161095c90613e39565b610ea66000611ca8565b565b6000828152600c602090815260408083206001600160a01b0385168452909152812060609190610ed790611c8b565b6001600160401b03811115610eee57610eee6139a0565b604051908082528060200260200182016040528015610f17578160200160208202803683370190505b50905060005b6000858152600c602090815260408083206001600160a01b03881684529091529020610f4890611c8b565b811015610faa576000858152600c602090815260408083206001600160a01b03881684529091529020610f7b9082611c95565b828281518110610f8d57610f8d613ecd565b602090810291909101015280610fa281613ee3565b915050610f1d565b509392505050565b8051610fc59060139060208401906136a5565b5050565b60606001805461086490613dae565b600d546001600160a01b031633146110025760405162461bcd60e51b815260040161095c90613e39565b8051610fc59060119060208401906136a5565b610fc5338383611cfa565b348135146110705760405162461bcd60e51b815260206004820152601d60248201527f566f75636865723a20496e76616c696420707269636520616d6f756e74000000604482015260640161095c565b600061107b60145490565b90506012548111156110cf5760405162461bcd60e51b815260206004820152601e60248201527f4865726f3a204e6f206d6f7265206865726f657320617661696c61626c650000604482015260640161095c565b60006110da83611dc8565b6001600160a01b0381166000908152600e602052604090205490915060ff16151560011461111a5760405162461bcd60e51b815260040161095c90613efc565b61112a604084016020850161389c565b6001600160a01b0316336001600160a01b0316146111815760405162461bcd60e51b815260206004820152601460248201527312195c9bce88125b9d985b1a59081dd85b1b195d60621b604482015260640161095c565b33600090815260156020526040812080549161119c83613ee3565b91905055506111b16111ab3390565b83611e21565b600f546040516000916001600160a01b03169034908381818185875af1925050503d80600081146111fe576040519150601f19603f3d011682016040523d82523d6000602084013e611203565b606091505b505090508061124b5760405162461bcd60e51b815260206004820152601460248201527312195c9bce8814185e5b595b9d0819985a5b195960621b604482015260640161095c565b611259601480546001019055565b50505050565b6112693383611a0d565b6112855760405162461bcd60e51b815260040161095c90613de8565b61125984848484611e3b565b600d546001600160a01b031633146112bb5760405162461bcd60e51b815260040161095c90613e39565b6010805460ff909216600160a01b026001600160a81b03199092166001600160a01b0390931692909217179055565b60006001600160a01b03861630146113145760405162461bcd60e51b815260040161095c90613f3d565b6113218686868686611e6e565b9695505050505050565b6017805461133890613dae565b80601f016020809104026020016040519081016040528092919081815260200182805461136490613dae565b80156113b15780601f10611386576101008083540402835291602001916113b1565b820191906000526020600020905b81548152906001019060200180831161139457829003601f168201915b505050505081565b6000818152600260205260409020546060906001600160a01b031661142e5760405162461bcd60e51b815260206004820152602560248201527f4865726f3a2055524920717565727920666f72206e6f6e6578697374656e74206044820152643a37b5b2b760d91b606482015260840161095c565b601161143983612000565b60405160200161144a929190613fa1565b6040516020818303038152906040529050919050565b803561146c3382611a0d565b6114885760405162461bcd60e51b815260040161095c90614047565b6000611495836000612100565b6001600160a01b0381166000908152600e602052604090205490915060ff1615156001146114d55760405162461bcd60e51b815260040161095c90613efc565b61157683356114e381610d74565b6114f3604087016020880161389c565b61150060a088018861408d565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061153f9250505060c089018961408d565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061212092505050565b61160f83353361158c604087016020880161389c565b611599604088018861408d565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506115d892505050606089018961408d565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061213d92505050565b7f29051e3cd9820352c380e4c671cb37f4eba6497379a9ed1084523146f1bfe529833561163f604086018661408d565b61164c606088018861408d565b61165960808a018a61408d565b61166660a08c018c61408d565b61167360c08e018e61408d565b61167d8f35610d74565b6040516116959c9b9a9998979695949392919061410c565b60405180910390a1505050565b60606013805461086490613dae565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b600d546001600160a01b031633146117095760405162461bcd60e51b815260040161095c90613e39565b6001600160a01b03166000908152600e60205260409020805460ff19166001179055565b60006001600160a01b03861630146117575760405162461bcd60e51b815260040161095c90613f3d565b611321868686868661222e565b600d546001600160a01b0316331461178e5760405162461bcd60e51b815260040161095c90613e39565b6001600160a01b0381166117f35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161095c565b6117fc81611ca8565b50565b803561180b3382611a0d565b6118275760405162461bcd60e51b815260040161095c90614047565b6000611834836001612100565b6001600160a01b0381166000908152600e602052604090205490915060ff1615156001146118745760405162461bcd60e51b815260040161095c90613efc565b8235600090815260166020526040812080549161189083613ee3565b909155506118a69050604084016020850161389c565b6001600160a01b031663f1ca9d2d6118c6600d546001600160a01b031690565b306118d4604088018861408d565b6118e160608a018a61408d565b6118eb8b356122cd565b6040518863ffffffff1660e01b815260040161190d979695949392919061419a565b600060405180830381600087803b15801561192757600080fd5b505af115801561193b573d6000803e3d6000fd5b5050604051853581527ffcfed02b0b40bef346c5670125d4b90255c170c7ca20474c0be81f2be6274a9192506020019050611695565b80546001019055565b60006001600160e01b0319821663780e9d6360e01b148061084f575061084f826122f7565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906119d482610d74565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b0316611a865760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161095c565b6000611a9183610d74565b9050806001600160a01b0316846001600160a01b03161480611ab85750611ab881856116b1565b80611adc5750836001600160a01b0316611ad1846108e7565b6001600160a01b0316145b949350505050565b826001600160a01b0316611af782610d74565b6001600160a01b031614611b5b5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161095c565b6001600160a01b038216611bbd5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161095c565b611bc8838383612347565b611bd360008261199f565b6001600160a01b0383166000908152600360205260408120805460019290611bfc9084906141fc565b90915550506001600160a01b0382166000908152600360205260408120805460019290611c2a908490614213565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600061084f825490565b6000611ca18383612352565b9392505050565b600d80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b031603611d5b5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161095c565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b600080611dd48361237c565b9050611ca181611de7604086018661422b565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061252c92505050565b610fc5828260405180602001604052806000815250612548565b611e46848484611ae4565b611e528484848461257b565b6112595760405162461bcd60e51b815260040161095c90614271565b60008151602014611e915760405162461bcd60e51b815260040161095c906142c3565b8251845114611ef25760405162461bcd60e51b815260206004820152602760248201527f455243313135353a2069647320616e642076616c756573206c656e677468206d6044820152660d2e6dac2e8c6d60cb1b606482015260840161095c565b600080611f006020366141fc565b90508035915060005b8651811015611feb57611f508333898481518110611f2957611f29613ecd565b6020026020010151898581518110611f4357611f43613ecd565b602002602001015161267c565b336001600160a01b031683896001600160a01b03167fd7888948ee7a8c63f452e7acd7a939ceb46066e16f52de72c8fa328e28f2aad18a8581518110611f9857611f98613ecd565b60200260200101518a8681518110611fb257611fb2613ecd565b6020026020010151604051611fd1929190918252602082015260400190565b60405180910390a480611fe381613ee3565b915050611f09565b5063bc197c8160e01b98975050505050505050565b6060816000036120275750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612051578061203b81613ee3565b915061204a9050600a83613eb9565b915061202b565b6000816001600160401b0381111561206b5761206b6139a0565b6040519080825280601f01601f191660200182016040528015612095576020820181803683370190505b5090505b8415611adc576120aa6001836141fc565b91506120b7600a8661433c565b6120c2906030614213565b60f81b8183815181106120d7576120d7613ecd565b60200101906001600160f81b031916908160001a9053506120f9600a86613eb9565b9450612099565b60008061210d8484612756565b9050611adc81611de760e087018761422b565b61213685858585856121318b6122cd565b612903565b5050505050565b6121576001600160a01b038416636cdb3d1360e11b612b75565b156121cf57826001600160a01b0316632eb2c2d6853085856121788b6122cd565b6040518663ffffffff1660e01b8152600401612198959493929190614350565b600060405180830381600087803b1580156121b257600080fd5b505af11580156121c6573d6000803e3d6000fd5b50505050612136565b60405162461bcd60e51b815260206004820152602e60248201527f4865726f3a204974656d20646f6573206e6f7420737570706f7274204552432d60448201526d31313535207374616e646172647360901b606482015260840161095c565b600081516020146122515760405162461bcd60e51b815260040161095c906142c3565b60008061225f6020366141fc565b9050803591506122718233888861267c565b6040805187815260208101879052339184916001600160a01b038b16917fd7888948ee7a8c63f452e7acd7a939ceb46066e16f52de72c8fa328e28f2aad1910160405180910390a45063f23a6e6160e01b979650505050505050565b60408051602080825281830190925260609160208201818036833750505060208101929092525090565b60006001600160e01b031982166380ac58cd60e01b148061232857506001600160e01b03198216635b5e139f60e01b145b8061084f57506301ffc9a760e01b6001600160e01b031983161461084f565b610a91838383612b91565b600082600001828154811061236957612369613ecd565b9060005260206000200154905092915050565b6000808235612391604085016020860161389c565b6040516020016123b892919091825260601b6001600160601b031916602082015260340190565b60405160208183030381529060405290506000306001600160a01b031663564b81ef6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612409573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061242d91906143ae565b604051806040016040528060048152602001634865726f60e01b815250604051806040016040528060018152602001603160f81b81525030601560006124703390565b6001600160a01b03166001600160a01b03168152602001908152602001600020546040516020016124a59594939291906143c7565b6040516020818303038152906040529050611adc82826040516020016124cc929190614425565b60408051601f1981840301815282825280516020918201207f19457468657265756d205369676e6564204d6573736167653a0a33320000000084830152603c8085019190915282518085039091018152605c909301909152815191012090565b600080600061253b8585612c49565b91509150610faa81612cb4565b6125528383612e6a565b61255f600084848461257b565b610a915760405162461bcd60e51b815260040161095c90614271565b60006001600160a01b0384163b1561267157604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906125bf903390899088908890600401614454565b6020604051808303816000875af19250505080156125fa575060408051601f3d908101601f191682019092526125f791810190614487565b60015b612657573d808015612628576040519150601f19603f3d011682016040523d82523d6000602084013e61262d565b606091505b50805160000361264f5760405162461bcd60e51b815260040161095c90614271565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611adc565b506001949350505050565b6000848152600b602052604090206126949084612fb8565b6126b2576000848152600b602052604090206126b09084612fda565b505b6000848152600a602090815260408083206001600160a01b038716845282528083208584529091528120549003612711576000848152600c602090815260408083206001600160a01b0387168452909152902061270f9083612fef565b505b6000848152600a602090815260408083206001600160a01b038716845282528083208584529091528120805483929061274b908490614213565b909155505050505050565b600080833561276b604086016020870161389c565b612778604087018761408d565b612785606089018961408d565b61279260808b018b61408d565b61279f60a08d018d61408d565b6040516020016127b89a999897969594939291906144d1565b60408051601f19818403018152919052905060006127d960c086018661408d565b306001600160a01b031663564b81ef6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612817573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061283b91906143ae565b60408051808201825260048152634865726f60e01b6020808301919091528251808401845260018152603160f81b81830152925161287f969594939130910161452a565b604051602081830303815290604052905083156128e45784356000908152601660209081526040808320548151928301520160405160208183030381529060405290506128da8383836040516020016124cc9392919061458e565b935050505061084f565b6128fa82826040516020016124cc929190614425565b9250505061084f565b81518351146129645760405162461bcd60e51b815260206004820152602760248201527f4552433939383a2069647320616e6420616d6f756e7473206c656e677468206d6044820152660d2e6dac2e8c6d60cb1b606482015260840161095c565b6001600160a01b0385166129c65760405162461bcd60e51b8152602060048201526024808201527f4552433939383a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161095c565b33806129d188610d74565b6001600160a01b031614806129f357506129f36129ed88610d74565b826116b1565b612a505760405162461bcd60e51b815260206004820152602860248201527f4552433939383a2063616c6c6572206973206e6f74206f776e6572206e6f7220604482015267185c1c1c9bdd995960c21b606482015260840161095c565b60005b8451811015612ab7576000858281518110612a7057612a70613ecd565b602002602001015190506000858381518110612a8e57612a8e613ecd565b60200260200101519050612aa48a898484612ffb565b505080612ab090613ee3565b9050612a53565b50604051631759616b60e11b81526001600160a01b03861690632eb2c2d690612aec9030908a90899089908990600401614350565b600060405180830381600087803b158015612b0657600080fd5b505af1158015612b1a573d6000803e3d6000fd5b50505050846001600160a01b0316866001600160a01b0316887f83730c6482dabefeeec86d872d92bcd6a09df1ca6b3a6cbb17d07591339f15db8787604051612b649291906145d1565b60405180910390a450505050505050565b6000612b808361317e565b8015611ca15750611ca183836131b1565b6001600160a01b038316612bec57612be781600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b612c0f565b816001600160a01b0316836001600160a01b031614612c0f57612c0f8382613290565b6001600160a01b038216612c2657610a918161332d565b826001600160a01b0316826001600160a01b031614610a9157610a9182826133dc565b6000808251604103612c7f5760208301516040840151606085015160001a612c7387828585613420565b94509450505050610b4f565b8251604003612ca85760208301516040840151612c9d86838361350d565b935093505050610b4f565b50600090506002610b4f565b6000816004811115612cc857612cc86145f6565b03612cd05750565b6001816004811115612ce457612ce46145f6565b03612d315760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161095c565b6002816004811115612d4557612d456145f6565b03612d925760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161095c565b6003816004811115612da657612da66145f6565b03612dfe5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161095c565b6004816004811115612e1257612e126145f6565b036117fc5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161095c565b6001600160a01b038216612ec05760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161095c565b6000818152600260205260409020546001600160a01b031615612f255760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161095c565b612f3160008383612347565b6001600160a01b0382166000908152600360205260408120805460019290612f5a908490614213565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160a01b03811660009081526001830160205260408120541515611ca1565b6000611ca1836001600160a01b038416613546565b6000611ca18383613546565b8015158061303357506000848152600a602090815260408083206001600160a01b038716845282528083208584529091529020548111155b6130975760405162461bcd60e51b815260206004820152602f60248201527f4552433939383a20696e73756666696369656e74206368696c642062616c616e60448201526e31b2903337b9103a3930b739b332b960891b606482015260840161095c565b6000848152600a602090815260408083206001600160a01b03871684528252808320858452909152812080548392906130d19084906141fc565b90915550506000848152600a602090815260408083206001600160a01b038716845282528083208584529091528120549003611259576000848152600c602090815260408083206001600160a01b038716845290915290206131339083613595565b506000848152600c602090815260408083206001600160a01b0387168452909152902061315f90611c8b565b600003611259576000848152600b6020526040902061213690846135a1565b6000613191826301ffc9a760e01b6131b1565b801561084f57506131aa826001600160e01b03196131b1565b1592915050565b604080516001600160e01b0319831660248083019190915282518083039091018152604490910182526020810180516001600160e01b03166301ffc9a760e01b179052905160009190829081906001600160a01b038716906175309061321890869061460c565b6000604051808303818686fa925050503d8060008114613254576040519150601f19603f3d011682016040523d82523d6000602084013e613259565b606091505b5091509150602081511015613274576000935050505061084f565b8180156113215750808060200190518101906113219190614628565b6000600161329d84610deb565b6132a791906141fc565b6000838152600760205260409020549091508082146132fa576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061333f906001906141fc565b6000838152600960205260408120546008805493945090928490811061336757613367613ecd565b90600052602060002001549050806008838154811061338857613388613ecd565b60009182526020808320909101929092558281526009909152604080822084905585825281205560088054806133c0576133c0614645565b6001900381819060005260206000200160009055905550505050565b60006133e783610deb565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156134575750600090506003613504565b8460ff16601b1415801561346f57508460ff16601c14155b156134805750600090506004613504565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156134d4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166134fd57600060019250925050613504565b9150600090505b94509492505050565b6000806001600160ff1b0383168161352a60ff86901c601b614213565b905061353887828885613420565b935093505050935093915050565b600081815260018301602052604081205461358d5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561084f565b50600061084f565b6000611ca183836135b2565b6000611ca1836001600160a01b0384165b6000818152600183016020526040812054801561369b5760006135d66001836141fc565b85549091506000906135ea906001906141fc565b905081811461364f57600086600001828154811061360a5761360a613ecd565b906000526020600020015490508087600001848154811061362d5761362d613ecd565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061366057613660614645565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061084f565b600091505061084f565b8280546136b190613dae565b90600052602060002090601f0160209004810192826136d35760008555613719565b82601f106136ec57805160ff1916838001178555613719565b82800160010185558215613719579182015b828111156137195782518255916020019190600101906136fe565b50613725929150613729565b5090565b5b80821115613725576000815560010161372a565b80356001600160a01b038116811461375557600080fd5b919050565b60008060006060848603121561376f57600080fd5b8335925061377f6020850161373e565b9150604084013590509250925092565b6001600160e01b0319811681146117fc57600080fd5b6000602082840312156137b757600080fd5b8135611ca18161378f565b60005b838110156137dd5781810151838201526020016137c5565b838111156112595750506000910152565b600081518084526138068160208601602086016137c2565b601f01601f19169290920160200192915050565b602081526000611ca160208301846137ee565b60006020828403121561383f57600080fd5b5035919050565b6000806040838503121561385957600080fd5b6138628361373e565b946020939093013593505050565b60008060006060848603121561388557600080fd5b61388e8461373e565b925061377f6020850161373e565b6000602082840312156138ae57600080fd5b611ca18261373e565b600080604083850312156138ca57600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b8181101561391a5783516001600160a01b0316835292840192918401916001016138f5565b50909695505050505050565b6000806040838503121561393957600080fd5b823591506139496020840161373e565b90509250929050565b600081518084526020808501945080840160005b8381101561398257815187529582019590820190600101613966565b509495945050505050565b602081526000611ca16020830184613952565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156139de576139de6139a0565b604052919050565b60006001600160401b038311156139ff576139ff6139a0565b613a12601f8401601f19166020016139b6565b9050828152838383011115613a2657600080fd5b828260208301376000602084830101529392505050565b600060208284031215613a4f57600080fd5b81356001600160401b03811115613a6557600080fd5b8201601f81018413613a7657600080fd5b611adc848235602084016139e6565b80151581146117fc57600080fd5b60008060408385031215613aa657600080fd5b613aaf8361373e565b91506020830135613abf81613a85565b809150509250929050565b600060208284031215613adc57600080fd5b81356001600160401b03811115613af257600080fd5b820160608185031215611ca157600080fd5b600082601f830112613b1557600080fd5b611ca1838335602085016139e6565b60008060008060808587031215613b3a57600080fd5b613b438561373e565b9350613b516020860161373e565b92506040850135915060608501356001600160401b03811115613b7357600080fd5b613b7f87828801613b04565b91505092959194509250565b60008060408385031215613b9e57600080fd5b613ba78361373e565b9150602083013560ff81168114613abf57600080fd5b600082601f830112613bce57600080fd5b813560206001600160401b03821115613be957613be96139a0565b8160051b613bf88282016139b6565b9283528481018201928281019087851115613c1257600080fd5b83870192505b84831015613c3157823582529183019190830190613c18565b979650505050505050565b600080600080600060a08688031215613c5457600080fd5b613c5d8661373e565b9450613c6b6020870161373e565b935060408601356001600160401b0380821115613c8757600080fd5b613c9389838a01613bbd565b94506060880135915080821115613ca957600080fd5b613cb589838a01613bbd565b93506080880135915080821115613ccb57600080fd5b50613cd888828901613b04565b9150509295509295909350565b600060208284031215613cf757600080fd5b81356001600160401b03811115613d0d57600080fd5b82016101008185031215611ca157600080fd5b60008060408385031215613d3357600080fd5b613d3c8361373e565b91506139496020840161373e565b600080600080600060a08688031215613d6257600080fd5b613d6b8661373e565b9450613d796020870161373e565b9350604086013592506060860135915060808601356001600160401b03811115613da257600080fd5b613cd888828901613b04565b600181811c90821680613dc257607f821691505b602082108103613de257634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615613e9e57613e9e613e6e565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613ec857613ec8613ea3565b500490565b634e487b7160e01b600052603260045260246000fd5b600060018201613ef557613ef5613e6e565b5060010190565b60208082526021908201527f5369676e617475726520696e76616c6964206f7220756e617574686f72697a656040820152601960fa1b606082015260800190565b60208082526028908201527f4f6e6c7920746865204865726f20636f6e74726163742063616e2070756c6c2060408201526734ba32b6b99034b760c11b606082015260800190565b60008151613f978185602086016137c2565b9290920192915050565b600080845481600182811c915080831680613fbd57607f831692505b60208084108203613fdc57634e487b7160e01b86526022600452602486fd5b818015613ff057600181146140015761402e565b60ff1986168952848901965061402e565b60008b81526020902060005b868110156140265781548b82015290850190830161400d565b505084890196505b50505050505061403e8185613f85565b95945050505050565b60208082526026908201527f4865726f3a2043616c6c6572206973206e6f74206f776e6572206e6f722061706040820152651c1c9bdd995960d21b606082015260800190565b6000808335601e198436030181126140a457600080fd5b8301803591506001600160401b038211156140be57600080fd5b6020019150600581901b3603821315610b4f57600080fd5b81835260006001600160fb1b038311156140ef57600080fd5b8260051b8083602087013760009401602001938452509192915050565b8c815260e06020820152600061412660e083018d8f6140d6565b8281036040840152614139818c8e6140d6565b9050828103606084015261414e818a8c6140d6565b9050828103608084015261416381888a6140d6565b905082810360a08401526141788186886140d6565b91505060018060a01b03831660c08301529d9c50505050505050505050505050565b6001600160a01b0388811682528716602082015260a0604082018190526000906141c790830187896140d6565b82810360608401526141da8186886140d6565b905082810360808401526141ee81856137ee565b9a9950505050505050505050565b60008282101561420e5761420e613e6e565b500390565b6000821982111561422657614226613e6e565b500190565b6000808335601e1984360301811261424257600080fd5b8301803591506001600160401b0382111561425c57600080fd5b602001915036819003821315610b4f57600080fd5b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526053908201527f4552433939383a2064617461206d75737420636f6e7461696e2074686520756e60408201527f697175652075696e7432353620746f6b656e496420746f207472616e7366657260608201527220746865206368696c6420746f6b656e20746f60681b608082015260a00190565b60008261434b5761434b613ea3565b500690565b6001600160a01b0386811682528516602082015260a06040820181905260009061437c90830186613952565b828103606084015261438e8186613952565b905082810360808401526143a281856137ee565b98975050505050505050565b6000602082840312156143c057600080fd5b5051919050565b858152600085516143df816020850160208a016137c2565b808301905085516143f7816020840160208a016137c2565b60609590951b6001600160601b03191660209190950190810194909452505060348201526054019392505050565b600083516144378184602088016137c2565b83519083019061444b8183602088016137c2565b01949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090611321908301846137ee565b60006020828403121561449957600080fd5b8151611ca18161378f565b60006001600160fb1b038311156144ba57600080fd5b8260051b8083863760009401938452509192915050565b8a81526bffffffffffffffffffffffff198a60601b166020820152600061451a61451361450c614505603486018d8f6144a4565b8a8c6144a4565b87896144a4565b84866144a4565b9c9b505050505050505050505050565b600061453782888a6144a4565b868152855161454d816020840160208a016137c2565b85519101906145638160208085019089016137c2565b60609490941b6001600160601b03191660209190940190810193909352505060340195945050505050565b600084516145a08184602089016137c2565b8451908301906145b48183602089016137c2565b84519101906145c78183602088016137c2565b0195945050505050565b6040815260006145e46040830185613952565b828103602084015261403e8185613952565b634e487b7160e01b600052602160045260246000fd5b6000825161461e8184602087016137c2565b9190910192915050565b60006020828403121561463a57600080fd5b8151611ca181613a85565b634e487b7160e01b600052603160045260246000fdfea264697066735822122087239072725f49f2fd9535eb12d39945aca3aa9e414e311ab31103862dadf4aa64736f6c634300080d0033

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

0000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000010000000000000000000000000049822d805c16553dbfef2b78c2a34a91f0f8dee20000000000000000000000002fd12a10d25c329ebb745d7ad23c3293255894b60000000000000000000000001260c55fb13004250ded7ed94bca3851645bab6f000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000002768747470733a2f2f706978656c7761722e636f6d2f6170692f6865726f2f6d657461646174612f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002f68747470733a2f2f706978656c7761722e636f6d2f6170692f6865726f2f6d657461646174612f636f6e74726163740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004039373138376234663663613164663361313362333062333232313930643562323665623735346362376330626539646432336530636134343038376538303638

-----Decoded View---------------
Arg [0] : maxSupply_ (uint256): 10000
Arg [1] : uri_ (string): https://pixelwar.com/api/hero/metadata/
Arg [2] : signer_ (address): 0x49822D805C16553DbfEF2B78c2A34a91f0f8DEE2
Arg [3] : primarySalesReceiver_ (address): 0x2FD12A10d25c329eBb745d7Ad23C3293255894B6
Arg [4] : royaltyReceiver_ (address): 0x1260c55Fb13004250dEd7eD94bCa3851645BaB6f
Arg [5] : royaltyPercentage_ (uint8): 10
Arg [6] : contractURI_ (string): https://pixelwar.com/api/hero/metadata/contract
Arg [7] : provenanceHash_ (string): 97187b4f6ca1df3a13b30b322190d5b26eb754cb7c0be9dd23e0ca44087e8068

-----Encoded View---------------
17 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000002710
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [2] : 00000000000000000000000049822d805c16553dbfef2b78c2a34a91f0f8dee2
Arg [3] : 0000000000000000000000002fd12a10d25c329ebb745d7ad23c3293255894b6
Arg [4] : 0000000000000000000000001260c55fb13004250ded7ed94bca3851645bab6f
Arg [5] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [7] : 00000000000000000000000000000000000000000000000000000000000001c0
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000027
Arg [9] : 68747470733a2f2f706978656c7761722e636f6d2f6170692f6865726f2f6d65
Arg [10] : 7461646174612f00000000000000000000000000000000000000000000000000
Arg [11] : 000000000000000000000000000000000000000000000000000000000000002f
Arg [12] : 68747470733a2f2f706978656c7761722e636f6d2f6170692f6865726f2f6d65
Arg [13] : 7461646174612f636f6e74726163740000000000000000000000000000000000
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [15] : 3937313837623466366361316466336131336233306233323231393064356232
Arg [16] : 3665623735346362376330626539646432336530636134343038376538303638


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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