ETH Price: $2,630.04 (+2.21%)

Token

Adventurer (ADVT)
 

Overview

Max Total Supply

23 ADVT

Holders

13

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Filtered by Token Holder
sympathy4.eth
Balance
5 ADVT
0xbab84de5f42e363d340cb9c870bded8e58c38b77
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
Adventurer

Compiler Version
v0.8.3+commit.8d00100c

Optimization Enabled:
Yes with 10 runs

Other Settings:
default evmVersion
File 1 of 23 : Adventurer.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "./ERC998TopDown.sol";
import "./ILootmart.sol";

interface IRegistry {
  function isValid721Contract(address _contract) external view returns (bool);
  function isValid1155Contract(address _contract) external view returns (bool);
  function isValidContract(address _contract) external view returns (bool);
  function isValidItemType(string memory _itemType) external view returns (bool);
}

/// @title Adventurer
/// @author Gary Thung
/// @notice Adventurer is a composable NFT designed to equip other ERC721 and ERC1155 tokens
contract Adventurer is ERC721Enumerable, ERC998TopDown, Ownable {
  using ERC165Checker for address;

  struct Item {
    address itemAddress;
    uint256 id;
  }

  event Equipped(uint256 indexed tokenId, address indexed itemAddress, uint256 indexed itemId, string itemType);
  event Unequipped(uint256 indexed tokenId, address indexed itemAddress, uint256 indexed itemId, string itemType);

  mapping(uint256 => mapping(string => Item)) public equipped;

  bytes4 internal constant ERC_721_INTERFACE = 0x80ac58cd;
  bytes4 internal constant ERC_1155_INTERFACE = 0xd9b67a26;

  IRegistry internal registry;

  constructor(address _registry) ERC998TopDown("Adventurer", "ADVT") {
    registry = IRegistry(_registry);
  }

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

  /**
   * @dev Ensure caller affecting an adventurer is authorized.
   */
  modifier onlyAuthorized(uint256 _tokenId) {
    require(_isApprovedOrOwner(msg.sender, _tokenId), "Adventurer: Caller is not owner nor approved");
    _;
  }

  // MINTING //

  function mint() external {
    _safeMint(_msgSender(), totalSupply());
  }

  function mintToAccount(address _account) external {
    _safeMint(_account, totalSupply());
  }

  // EQUIPPING/UNEQUIPPING //

  /**
   * @dev Execute a series of equips followed by a series of unequips.
   *
   * NOTE: Clients should reduce the changes down to the simplest set.
   * For example, imagine an Adventurer with a head equipped and the goal is to equip a new head item.
   * Calling bulkChanges with both a new head to equip and a head unequip will result in the Adventurer
   * ultimately having no head equipped. The simplest change would be to do only an equip.
   */
  function bulkChanges(
    uint256 _tokenId,
    address[] memory _equipItemAddresses,
    uint256[] memory _equipItemIds,
    string[] memory _unequipItemTypes
  ) external onlyAuthorized(_tokenId) {
    // Execute equips
    for (uint256 i = 0; i < _equipItemAddresses.length; i++) {
      _equip(_tokenId, _equipItemAddresses[i], _equipItemIds[i]);
    }

    // Execute unequips
    for (uint256 i = 0; i < _unequipItemTypes.length; i++) {
      _unequip(_tokenId, _unequipItemTypes[i]);
    }
  }

  /**
   * @dev Equip an item.
   */
  function equip(
    uint256 _tokenId,
    address _itemAddress,
    uint256 _itemId
  ) external onlyAuthorized(_tokenId) {
    _equip(_tokenId, _itemAddress, _itemId);
  }

  /**
   * @dev Equip a list of items.
   */
  function equipBulk(
    uint256 _tokenId,
    address[] memory _itemAddresses,
    uint256[] memory _itemIds
  ) external onlyAuthorized(_tokenId) {
    for (uint256 i = 0; i < _itemAddresses.length; i++) {
      _equip(_tokenId, _itemAddresses[i], _itemIds[i]);
    }
  }

  /**
   * @dev Unequip an item.
   */
  function unequip(
    uint256 _tokenId,
    string memory _itemType
  ) external onlyAuthorized(_tokenId) {
    _unequip(_tokenId, _itemType);
  }

  /**
   * @dev Unequip a list of items.
   */
  function unequipBulk(
    uint256 _tokenId,
    string[] memory _itemTypes
  ) external onlyAuthorized(_tokenId) {
    for (uint256 i = 0; i < _itemTypes.length; i++) {
      _unequip(_tokenId, _itemTypes[i]);
    }
  }

  // LOGIC //

  /**
   * @dev Execute inbound transfer from a component contract to this contract.
   */
  function _transferItemIn(
    uint256 _tokenId,
    address _operator,
    address _itemAddress,
    uint256 _itemId
  ) internal {
    if (_itemAddress.supportsInterface(ERC_721_INTERFACE)) {
      IERC721(_itemAddress).safeTransferFrom(_operator, address(this), _itemId, toBytes(_tokenId));
    } else if (_itemAddress.supportsInterface(ERC_1155_INTERFACE)) {
      IERC1155(_itemAddress).safeTransferFrom(_operator, address(this), _itemId, 1, toBytes(_tokenId));
    } else {
      require(false, "Adventurer: Item does not support ERC-721 nor ERC-1155 standards");
    }
  }

  /**
   * @dev Execute outbound transfer of a child token.
   */
  function _transferItemOut(
    uint256 _tokenId,
    address _owner,
    address _itemAddress,
    uint256 _itemId
  ) internal {
    if (child721Balance(_tokenId, _itemAddress, _itemId) == 1) {
      safeTransferChild721From(_tokenId, _owner, _itemAddress, _itemId, "");
    } else if (child1155Balance(_tokenId, _itemAddress, _itemId) >= 1) {
      safeTransferChild1155From(_tokenId, _owner, _itemAddress, _itemId, 1, "");
    }
  }

  /**
   * @dev Execute the logic required to equip a single item. This involves:
   *
   * 1. Checking that the component contract is registered
   * 2. Check that the item type is valid
   * 3. Mark the new item as equipped
   * 4. Transfer the new item to this contract
   * 5. Transfer the old item back to the owner
   */
  function _equip(
    uint256 _tokenId,
    address _itemAddress,
    uint256 _itemId
  ) internal {
    require(registry.isValidContract(_itemAddress), "Adventurer: Item contract must be in the registry");

    string memory itemType = ILootmart(_itemAddress).itemTypeFor(_itemId);
    require(registry.isValidItemType(itemType), "Adventurer: Invalid item type");

    // Get current item
    Item memory item = equipped[_tokenId][itemType];
    address currentItemAddress = item.itemAddress;
    uint256 currentItemId = item.id;

    // Equip the new item
    equipped[_tokenId][itemType] = Item({ itemAddress: _itemAddress, id: _itemId });

    // Pull in the item
    _transferItemIn(_tokenId, _msgSender(), _itemAddress, _itemId);

    // Send back old item
    if (currentItemAddress != address(0)) {
      _transferItemOut(_tokenId, ownerOf(_tokenId), currentItemAddress, currentItemId);
    }

    emit Equipped(_tokenId, _itemAddress, _itemId, itemType);
  }

  /**
   * @dev Execute the logic required to equip a single item. This involves:
   *
   * 1. Mark the item as unequipped
   * 2. Transfer the item back to the owner
   */
  function _unequip(
    uint256 _tokenId,
    string memory _itemType
  ) internal {
    // Get current item
    Item memory item = equipped[_tokenId][_itemType];
    address currentItemAddress = item.itemAddress;
    uint256 currentItemId = item.id;

    // Mark item unequipped
    delete equipped[_tokenId][_itemType];

    // Send back old item
    _transferItemOut(_tokenId, ownerOf(_tokenId), currentItemAddress, currentItemId);

    emit Unequipped(_tokenId, currentItemAddress, currentItemId, _itemType);
  }

  // CALLBACKS //

  /**
   * @dev Only allow this contract to execute inbound transfers. Executes super's receiver to update underlying bookkeeping.
   */
  function onERC721Received(
    address operator,
    address from,
    uint256 id,
    bytes memory data
  ) public override returns (bytes4) {
    require(operator == address(this), "Adventurer: Only the Adventurer contract can pull items in");
    return super.onERC721Received(operator, from, id, data);
  }

  /**
   * @dev Only allow this contract to execute inbound transfers. Executes super's receiver to update underlying bookkeeping.
   */
  function onERC1155Received(
    address operator,
    address from,
    uint256 id,
    uint256 amount,
    bytes memory data
  ) public override returns (bytes4) {
    require(operator == address(this), "Only the Adventurer contract can pull items in");
    return super.onERC1155Received(operator, from, id, amount, data);
  }

  /**
   * @dev Only allow this contract to execute inbound transfers. Executes super's receiver to update underlying bookkeeping.
   */
  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 Adventurer contract can pull items in");
    return super.onERC1155BatchReceived(operator, from, ids, values, data);
  }

  function _beforeChild721Transfer(
    address operator,
    uint256 fromTokenId,
    address to,
    address childContract,
    uint256 id,
    bytes memory data
  ) internal override virtual {
    super._beforeChild721Transfer(operator, fromTokenId, to, childContract, id, data);
  }

  function _beforeChild1155Transfer(
    address operator,
    uint256 fromTokenId,
    address to,
    address childContract,
    uint256[] memory ids,
    uint256[] memory amounts,
    bytes memory data
  ) internal override virtual {
    super._beforeChild1155Transfer(operator, fromTokenId, to, childContract, ids, amounts, data);
  }

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

  // HELPERS //

  /**
   * @dev Convert uint to bytes.
   */
  function toBytes(uint256 x) internal pure returns (bytes memory b) {
    b = new bytes(32);
    assembly { mstore(add(b, 32), x) }
  }
}

File 2 of 23 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT

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 23 : IERC721.sol
// SPDX-License-Identifier: MIT

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

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

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

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

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

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

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

File 4 of 23 : IERC1155.sol
// SPDX-License-Identifier: MIT

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 5 of 23 : Ownable.sol
// SPDX-License-Identifier: MIT

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() {
        _setOwner(_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 {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 6 of 23 : ERC165Checker.sol
// SPDX-License-Identifier: MIT

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 7 of 23 : ERC998TopDown.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
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 "./IERC998ERC721TopDown.sol";
import "./IERC998ERC1155TopDown.sol";

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

    // What tokens does the 998 own, by child address?
    // _balances[tokenId][child address] = [child tokenId 1, child tokenId 2]
    mapping(uint256 => mapping(address => EnumerableSet.UintSet)) internal _balances721;
    // Which 998s own a a child 721 contract's token?
    // _holdersOf[child address] = [tokenId 1, tokenId 2]
    mapping(address => EnumerableSet.UintSet) internal _holdersOf721;

    // _balances[tokenId][child address][child tokenId] = amount
    mapping(uint256 => mapping(address => mapping(uint256 => uint256))) internal _balances1155;
    // _holdersOf[child address][child tokenId] = [tokenId 1, tokenId 2]
    mapping(address => mapping(uint256 => EnumerableSet.UintSet)) internal _holdersOf1155;

    // What child 721 contracts does a token have children of?
    // _child721Contracts[tokenId] = [child address 1, child address 2]
    mapping(uint256 => EnumerableSet.AddressSet) internal _child721Contracts;
    // What child tokens does a token have for a child 721 contract?
    // _childrenForChild721Contracts[tokenId][child address] = [child tokenId 1, child tokenId 2]
    mapping(uint256 => mapping(address => EnumerableSet.UintSet)) internal _childrenForChild721Contracts;

    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 721 contract.
     */
    function child721Balance(uint256 tokenId, address childContract, uint256 childTokenId) public view override returns (uint256) {
        return _balances721[tokenId][childContract].contains(childTokenId) ? 1 : 0;
    }

    /**
     * @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 721 contracts where token ID has childs.
     */
    function child721ContractsFor(uint256 tokenId) override public view returns (address[] memory) {
        address[] memory childContracts = new address[](_child721Contracts[tokenId].length());

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

        return childContracts;
    }

    /**
     * @dev Gives list of child 1155 contracts where token ID has childs.
     */
    function child1155ContractsFor(uint256 tokenId) override public view 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 721 contract by token ID.
     */
    function child721IdsForOn(uint256 tokenId, address childContract) override public view returns (uint256[] memory) {
        uint256[] memory childTokenIds = new uint256[](_childrenForChild721Contracts[tokenId][childContract].length());

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

        return childTokenIds;
    }

    /**
     * @dev Gives list of owned child IDs on a child 1155 contract by token ID.
     */
    function child1155IdsForOn(uint256 tokenId, address childContract) override public view 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 child 721 token from a token ID.
     */
    function safeTransferChild721From(uint256 fromTokenId, address to, address childContract, uint256 childTokenId, bytes memory data) public override {
        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"
        );

        _beforeChild721Transfer(operator, fromTokenId, to, childContract, childTokenId, data);

        _removeChild721(fromTokenId, childContract, childTokenId);

        ERC721(childContract).safeTransferFrom(address(this), to, childTokenId, data);
        emit TransferChild721(fromTokenId, to, childContract, childTokenId);
    }


    /**
     * @dev Transfers child 1155 token from a token ID.
     */
    function safeTransferChild1155From(uint256 fromTokenId, address to, address childContract, uint256 childTokenId, uint256 amount, bytes memory data) public override {
        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"
        );

        _beforeChild1155Transfer(operator, fromTokenId, to, childContract, _asSingletonArray(childTokenId), _asSingletonArray(amount), data);

        _removeChild1155(fromTokenId, childContract, childTokenId, amount);

        ERC1155(childContract).safeTransferFrom(address(this), to, childTokenId, amount, data);
        emit TransferSingleChild1155(fromTokenId, to, childContract, childTokenId, amount);
    }

    /**
     * @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) public override {
        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"
        );

        _beforeChild1155Transfer(operator, fromTokenId, to, childContract, childTokenIds, amounts, data);

        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 onERC721Received(address operator, address from, uint256 id, bytes memory data) virtual public 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)}

        _receiveChild721(_receiverTokenId, msg.sender, id);
        emit ReceivedChild721(from, _receiverTokenId, msg.sender, id);

        return this.onERC721Received.selector;
    }

    /**
     * @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) virtual public 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) virtual public 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 721 token.
     */
    function _receiveChild721(uint256 tokenId, address childContract, uint256 childTokenId) internal virtual {
        if (!_child721Contracts[tokenId].contains(childContract)) {
            _child721Contracts[tokenId].add(childContract);
        }

        if (!_balances721[tokenId][childContract].contains(childTokenId)) {
            _childrenForChild721Contracts[tokenId][childContract].add(childTokenId);
        }

        _balances721[tokenId][childContract].add(childTokenId);
    }

    /**
     * @dev Update bookkeeping when a child 721 token is removed from a 998.
     */
    function _removeChild721(uint256 tokenId, address childContract, uint256 childTokenId) internal virtual {
        require(_balances721[tokenId][childContract].contains(childTokenId), "ERC998: insufficient child balance for transfer");

        _balances721[tokenId][childContract].remove(childTokenId);
        _holdersOf721[childContract].remove(tokenId);
        _childrenForChild721Contracts[tokenId][childContract].remove(childTokenId);
        if (_childrenForChild721Contracts[tokenId][childContract].length() == 0) {
            _child721Contracts[tokenId].remove(childContract);
        }
    }

    /**
     * @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) {
            _holdersOf1155[childContract][childTokenId].remove(tokenId);
            _childrenForChild1155Contracts[tokenId][childContract].remove(childTokenId);
            if (_childrenForChild1155Contracts[tokenId][childContract].length() == 0) {
                _child1155Contracts[tokenId].remove(childContract);
            }
        }
    }

    function _beforeChild721Transfer(
        address operator,
        uint256 fromTokenId,
        address to,
        address childContract,
        uint256 id,
        bytes memory data
    )
        internal virtual
    { }

    function _beforeChild1155Transfer(
        address operator,
        uint256 fromTokenId,
        address to,
        address childContract,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    )
        internal virtual
    { }

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

File 8 of 23 : ILootmart.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;

// Any component stores need to have this function so that Adventurer can determine what
// type of item it is
interface ILootmart {
  function itemTypeFor(uint256 tokenId) external view returns (string memory);
}

File 9 of 23 : ERC721.sol
// SPDX-License-Identifier: MIT

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

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

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

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

        _transfer(from, to, tokenId);
    }

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

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

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

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _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 || getApproved(tokenId) == spender || isApprovedForAll(owner, 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);
    }

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

    /**
     * @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 of token that is not own");
        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);
    }

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

File 10 of 23 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

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 tokenId);

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

File 11 of 23 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

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 `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 12 of 23 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

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 13 of 23 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

        (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 14 of 23 : Context.sol
// SPDX-License-Identifier: MIT

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 15 of 23 : Strings.sol
// SPDX-License-Identifier: MIT

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 16 of 23 : ERC165.sol
// SPDX-License-Identifier: MIT

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 17 of 23 : IERC165.sol
// SPDX-License-Identifier: MIT

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 18 of 23 : ERC1155.sol
// SPDX-License-Identifier: MIT

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)) internal _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 {
        require(_msgSender() != operator, "ERC1155: setting approval status for self");

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

        _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), 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);

        _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);

        _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 `account`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address account,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(account != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);

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

        _doSafeTransferAcceptanceCheck(operator, address(0), account, 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);

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

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

        address operator = _msgSender();

        _beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");

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

        emit TransferSingle(operator, account, address(0), id, amount);
    }

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

        address operator = _msgSender();

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

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

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

        emit TransferBatch(operator, account, address(0), ids, amounts);
    }

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

    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 19 of 23 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT

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.
        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. 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 20 of 23 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

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 21 of 23 : IERC998ERC721TopDown.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;

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

interface IERC998ERC721TopDown is IERC721, IERC721Receiver {
    event ReceivedChild721(address indexed from, uint256 indexed toTokenId, address indexed childContract, uint256 childTokenId);
    event TransferChild721(uint256 indexed fromTokenId, address indexed to, address indexed childContract, uint256 childTokenId);

    function child721ContractsFor(uint256 tokenId) external view returns (address[] memory childContracts);
    function child721IdsForOn(uint256 tokenId, address childContract) external view returns (uint256[] memory childIds);
    function child721Balance(uint256 tokenId, address childContract, uint256 childTokenId) external view returns(uint256);

    function safeTransferChild721From(uint256 fromTokenId, address to, address childContract, uint256 childTokenId, bytes calldata data) external;
}

File 22 of 23 : IERC998ERC1155TopDown.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
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);

    function safeTransferChild1155From(uint256 fromTokenId, address to, address childContract, uint256 childTokenId, uint256 amount, bytes calldata data) external;
    function safeBatchTransferChild1155From(uint256 fromTokenId, address to, address childContract, uint256[] calldata childTokenIds, uint256[] calldata amounts, bytes calldata data) external;
}

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

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": 10
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_registry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"itemAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"itemId","type":"uint256"},{"indexed":false,"internalType":"string","name":"itemType","type":"string"}],"name":"Equipped","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":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"childContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"childTokenId","type":"uint256"}],"name":"ReceivedChild721","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"}],"name":"TransferChild721","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"itemAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"itemId","type":"uint256"},{"indexed":false,"internalType":"string","name":"itemType","type":"string"}],"name":"Unequipped","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address[]","name":"_equipItemAddresses","type":"address[]"},{"internalType":"uint256[]","name":"_equipItemIds","type":"uint256[]"},{"internalType":"string[]","name":"_unequipItemTypes","type":"string[]"}],"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":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"childContract","type":"address"},{"internalType":"uint256","name":"childTokenId","type":"uint256"}],"name":"child721Balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"child721ContractsFor","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"childContract","type":"address"}],"name":"child721IdsForOn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_itemAddress","type":"address"},{"internalType":"uint256","name":"_itemId","type":"uint256"}],"name":"equip","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address[]","name":"_itemAddresses","type":"address[]"},{"internalType":"uint256[]","name":"_itemIds","type":"uint256[]"}],"name":"equipBulk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"string","name":"","type":"string"}],"name":"equipped","outputs":[{"internalType":"address","name":"itemAddress","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"mintToAccount","outputs":[],"stateMutability":"nonpayable","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":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","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":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"childContract","type":"address"},{"internalType":"uint256[]","name":"childTokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferChild1155From","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"childContract","type":"address"},{"internalType":"uint256","name":"childTokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferChild1155From","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"childContract","type":"address"},{"internalType":"uint256","name":"childTokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferChild721From","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"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":"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"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"string","name":"_itemType","type":"string"}],"name":"unequip","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"string[]","name":"_itemTypes","type":"string[]"}],"name":"unequipBulk","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620045ff380380620045ff8339810160408190526200003491620001dd565b604080518082018252600a81526920b23b32b73a3ab932b960b11b6020808301918252835180850190945260048452631051159560e21b90840152815191929183918391620000869160009162000137565b5080516200009c90600190602084019062000137565b5050505050620000bb620000b5620000e160201b60201c565b620000e5565b601480546001600160a01b0319166001600160a01b03929092169190911790556200024a565b3390565b601280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b82805462000145906200020d565b90600052602060002090601f016020900481019282620001695760008555620001b4565b82601f106200018457805160ff1916838001178555620001b4565b82800160010185558215620001b4579182015b82811115620001b457825182559160200191906001019062000197565b50620001c2929150620001c6565b5090565b5b80821115620001c25760008155600101620001c7565b600060208284031215620001ef578081fd5b81516001600160a01b038116811462000206578182fd5b9392505050565b600181811c908216806200022257607f821691505b602082108114156200024457634e487b7160e01b600052602260045260246000fd5b50919050565b6143a5806200025a6000396000f3fe608060405234801561001057600080fd5b50600436106101cd5760003560e01c806301a00210146101d257806301ffc9a7146101f857806306fdde031461021b578063081812fc14610230578063095ea7b3146102505780631249c58b14610265578063150b7a021461026d57806318160ddd1461028d578063205ec4c21461029557806323b872dd146102a85780632d9b6f57146102bb5780632f745c59146102ce5780633181aa49146102e15780633b25f1af146102f45780633c8619e4146103075780633fe540a91461032757806342842e0e1461033a57806348d0b72c1461034d5780634cadb51c146103bb5780634f6ccce7146103ce5780636352211e146103e157806367b53d75146103f457806370a0823114610407578063715018a61461041a578063782f5423146104225780638da5cb5b1461044257806395d89b411461044a578063a22cb46514610452578063a545da3914610465578063af0bdfea14610478578063b88d4fde1461048b578063bc197c811461049e578063bd1dd40b146104b1578063c87b56dd146104c4578063d50efd70146104d7578063e985e9c5146104ea578063f23a6e61146104fd578063f2fde38b14610510578063ff297a0e14610523575b600080fd5b6101e56101e0366004613adc565b610536565b6040519081526020015b60405180910390f35b61020b61020636600461388b565b610565565b60405190151581526020016101ef565b610223610578565b6040516101ef9190613e9d565b61024361023e366004613935565b61060a565b6040516101ef9190613d19565b61026361025e366004613846565b610697565b005b6102636107a8565b61028061027b366004613749565b6107b7565b6040516101ef9190613e88565b6008546101e5565b6102636102a336600461396f565b61084b565b6102636102b636600461370e565b610a5c565b6102636102c936600461361d565b610a8d565b6101e56102dc366004613846565b610a9d565b6102636102ef366004613a1c565b610b36565b610263610302366004613b69565b610c72565b61031a610315366004613935565b610d68565b6040516101ef9190613e03565b610263610335366004613adc565b610e5e565b61026361034836600461370e565b610e96565b61039c61035b366004613c2e565b60136020908152600092835260409092208151808301840180519281529084019290930191909120915280546001909101546001600160a01b039091169082565b604080516001600160a01b0390931683526020830191909152016101ef565b61031a6103c9366004613935565b610eb1565b6101e56103dc366004613935565b610fa0565b6102436103ef366004613935565b611041565b610263610402366004613a72565b6110b8565b6101e561041536600461361d565b6111fa565b610263611281565b61043561043036600461394d565b6112ba565b6040516101ef9190613e50565b6102436113e0565b6102236113ef565b610263610460366004613810565b6113fe565b6101e5610473366004613adc565b6114cc565b610263610486366004613bea565b611511565b610263610499366004613749565b61157a565b6102806104ac366004613669565b6115ac565b6104356104bf36600461394d565b6115ed565b6102236104d2366004613935565b61170b565b6102636104e5366004613c2e565b6117e3565b61020b6104f8366004613637565b611814565b61028061050b3660046137ae565b611842565b61026361051e36600461361d565b611879565b610263610531366004613b00565b611916565b6000928352600c602090815260408085206001600160a01b039490941685529281528284209184525290205490565b6000610570826119ae565b90505b919050565b6060600080546105879061425f565b80601f01602080910402602001604051908101604052809291908181526020018280546105b39061425f565b80156106005780601f106105d557610100808354040283529160200191610600565b820191906000526020600020905b8154815290600101906020018083116105e357829003601f168201915b5050505050905090565b6000610615826119d3565b61067b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006106a282611041565b9050806001600160a01b0316836001600160a01b031614156107105760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610672565b336001600160a01b038216148061072c575061072c81336104f8565b6107995760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610672565b6107a383836119f0565b505050565b6107b5336008545b611a5e565b565b60006001600160a01b03851630146108345760405162461bcd60e51b815260206004820152603a60248201527f416476656e74757265723a204f6e6c792074686520416476656e74757265722060448201527931b7b73a3930b1ba1031b0b710383ab6361034ba32b6b99034b760311b6064820152608401610672565b61084085858585611a7c565b90505b949350505050565b81518351146108ac5760405162461bcd60e51b815260206004820152602760248201527f4552433939383a2069647320616e6420616d6f756e7473206c656e677468206d6044820152660d2e6dac2e8c6d60cb1b6064820152608401610672565b6001600160a01b0385166108d25760405162461bcd60e51b815260040161067290614012565b33806108dd88611041565b6001600160a01b031614806108ff57506108ff6108f988611041565b82611814565b61091b5760405162461bcd60e51b815260040161067290613eb0565b60005b845181101561099e57600085828151811061094957634e487b7160e01b600052603260045260246000fd5b60200260200101519050600085838151811061097557634e487b7160e01b600052603260045260246000fd5b6020026020010151905061098b8a898484611b1f565b5050806109979061429a565b905061091e565b50604051631759616b60e11b81526001600160a01b03861690632eb2c2d6906109d39030908a90899089908990600401613d2d565b600060405180830381600087803b1580156109ed57600080fd5b505af1158015610a01573d6000803e3d6000fd5b50505050846001600160a01b0316866001600160a01b0316887f83730c6482dabefeeec86d872d92bcd6a09df1ca6b3a6cbb17d07591339f15db8787604051610a4b929190613e63565b60405180910390a450505050505050565b610a663382611c83565b610a825760405162461bcd60e51b8152600401610672906140d9565b6107a3838383611d45565b610a9a816107b060085490565b50565b6000610aa8836111fa565b8210610b0a5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610672565b506001600160a01b03821660009081526006602090815260408083208484529091529020545b92915050565b6001600160a01b038416610b5c5760405162461bcd60e51b815260040161067290614012565b3380610b6787611041565b6001600160a01b03161480610b835750610b836108f987611041565b610b9f5760405162461bcd60e51b815260040161067290613eb0565b610bad818787878787611ede565b610bb8868585611ee3565b604051635c46a7ef60e11b81526001600160a01b0385169063b88d4fde90610bea903090899088908890600401613d8b565b600060405180830381600087803b158015610c0457600080fd5b505af1158015610c18573d6000803e3d6000fd5b50505050836001600160a01b0316856001600160a01b0316877f9246785543aff8b5b156e5909aebd5d321e61df5e10c6670a43c1c4e78e3cedf86604051610c6291815260200190565b60405180910390a4505050505050565b83610c7d3382611c83565b610c995760405162461bcd60e51b81526004016106729061412a565b60005b8451811015610d1057610cfe86868381518110610cc957634e487b7160e01b600052603260045260246000fd5b6020026020010151868481518110610cf157634e487b7160e01b600052603260045260246000fd5b6020026020010151611fef565b80610d088161429a565b915050610c9c565b5060005b8251811015610d6057610d4e86848381518110610d4157634e487b7160e01b600052603260045260246000fd5b6020026020010151612349565b80610d588161429a565b915050610d14565b505050505050565b600081815260106020526040812060609190610d8390612432565b6001600160401b03811115610da857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610dd1578160200160208202803683370190505b50905060005b6000848152601060205260409020610dee90612432565b811015610e57576000848152601060205260409020610e0d908261243c565b828281518110610e2d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039092166020928302919091019091015280610e4f8161429a565b915050610dd7565b5092915050565b82610e693382611c83565b610e855760405162461bcd60e51b81526004016106729061412a565b610e90848484611fef565b50505050565b6107a38383836040518060200160405280600081525061157a565b6000818152600e6020526040812060609190610ecc90612432565b6001600160401b03811115610ef157634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610f1a578160200160208202803683370190505b50905060005b6000848152600e60205260409020610f3790612432565b811015610e57576000848152600e60205260409020610f56908261243c565b828281518110610f7657634e487b7160e01b600052603260045260246000fd5b6001600160a01b039092166020928302919091019091015280610f988161429a565b915050610f20565b6000610fab60085490565b821061100e5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610672565b6008828154811061102f57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b0316806105705760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610672565b6001600160a01b0385166110de5760405162461bcd60e51b815260040161067290614012565b33806110e988611041565b6001600160a01b0316148061110557506111056108f988611041565b6111215760405162461bcd60e51b815260040161067290613eb0565b61113a8188888861113189612448565b610d6089612448565b61114687868686611b1f565b604051637921219560e11b81526001600160a01b0386169063f242432a9061117a9030908a90899089908990600401613dbe565b600060405180830381600087803b15801561119457600080fd5b505af11580156111a8573d6000803e3d6000fd5b50505050846001600160a01b0316866001600160a01b0316887ea198470a602f1d156b20e41b65b907ab137359caceff40e0205ff1858b81fc8787604051610a4b929190918252602082015260400190565b60006001600160a01b0382166112655760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610672565b506001600160a01b031660009081526003602052604090205490565b3361128a6113e0565b6001600160a01b0316146112b05760405162461bcd60e51b8152600401610672906140a4565b6107b560006124a1565b60008281526011602090815260408083206001600160a01b03851684529091528120606091906112e990612432565b6001600160401b0381111561130e57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611337578160200160208202803683370190505b50905060005b60008581526011602090815260408083206001600160a01b0388168452909152902061136890612432565b8110156113d85760008581526011602090815260408083206001600160a01b0388168452909152902061139b908261243c565b8282815181106113bb57634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806113d08161429a565b91505061133d565b509392505050565b6012546001600160a01b031690565b6060600180546105879061425f565b6001600160a01b0382163314156114535760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610672565b3360008181526005602090815260408083206001600160a01b0387168085529252909120805460ff1916841515179055906001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516114c0911515815260200190565b60405180910390a35050565b6000838152600a602090815260408083206001600160a01b038616845290915281206114f890836124f3565b611503576000611506565b60015b60ff16949350505050565b8161151c3382611c83565b6115385760405162461bcd60e51b81526004016106729061412a565b60005b8251811015610e905761156884848381518110610d4157634e487b7160e01b600052603260045260246000fd5b806115728161429a565b91505061153b565b6115843383611c83565b6115a05760405162461bcd60e51b8152600401610672906140d9565b610e90848484846124ff565b60006001600160a01b03861630146115d65760405162461bcd60e51b815260040161067290614056565b6115e38686868686612532565b9695505050505050565b6000828152600f602090815260408083206001600160a01b038516845290915281206060919061161c90612432565b6001600160401b0381111561164157634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561166a578160200160208202803683370190505b50905060005b6000858152600f602090815260408083206001600160a01b0388168452909152902061169b90612432565b8110156113d8576000858152600f602090815260408083206001600160a01b038816845290915290206116ce908261243c565b8282815181106116ee57634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806117038161429a565b915050611670565b6060611716826119d3565b61177a5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610672565b600061179160408051602081019091526000815290565b905060008151116117b157604051806020016040528060008152506117dc565b806117bb846126ea565b6040516020016117cc929190613cea565b6040516020818303038152906040525b9392505050565b816117ee3382611c83565b61180a5760405162461bcd60e51b81526004016106729061412a565b6107a38383612349565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b60006001600160a01b038616301461186c5760405162461bcd60e51b815260040161067290614056565b6115e38686868686612804565b336118826113e0565b6001600160a01b0316146118a85760405162461bcd60e51b8152600401610672906140a4565b6001600160a01b03811661190d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610672565b610a9a816124a1565b826119213382611c83565b61193d5760405162461bcd60e51b81526004016106729061412a565b60005b83518110156119a7576119958585838151811061196d57634e487b7160e01b600052603260045260246000fd5b6020026020010151858481518110610cf157634e487b7160e01b600052603260045260246000fd5b8061199f8161429a565b915050611940565b5050505050565b60006001600160e01b0319821663780e9d6360e01b1480610570575061057082612891565b6000908152600260205260409020546001600160a01b0316151590565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611a2582611041565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b611a788282604051806020016040528060008152506128e1565b5050565b60008151602014611a9f5760405162461bcd60e51b815260040161067290613f99565b600080611aad60203661421c565b905080359150611abe823387612914565b336001600160a01b031682876001600160a01b03167fb00761aee4ba24f247fd2ed53e16133421febde35143e2290cd1d5703dc9102588604051611b0491815260200190565b60405180910390a450630a85bd0160e11b9695505050505050565b80151580611b5757506000848152600c602090815260408083206001600160a01b038716845282528083208584529091529020548111155b611b735760405162461bcd60e51b815260040161067290613f4a565b6000848152600c602090815260408083206001600160a01b0387168452825280832085845290915281208054839290611bad90849061421c565b90915550506000848152600c602090815260408083206001600160a01b03871684528252808320858452909152902054610e90576001600160a01b0383166000908152600d602090815260408083208584529091529020611c0e90856129d4565b5060008481526011602090815260408083206001600160a01b03871684529091529020611c3b90836129d4565b5060008481526011602090815260408083206001600160a01b03871684529091529020611c6790612432565b610e905760008481526010602052604090206119a790846129e0565b6000611c8e826119d3565b611cef5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610672565b6000611cfa83611041565b9050806001600160a01b0316846001600160a01b03161480611d355750836001600160a01b0316611d2a8461060a565b6001600160a01b0316145b8061084357506108438185611814565b826001600160a01b0316611d5882611041565b6001600160a01b031614611dc05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610672565b6001600160a01b038216611e225760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610672565b611e2d8383836129f5565b611e386000826119f0565b6001600160a01b0383166000908152600360205260408120805460019290611e6190849061421c565b90915550506001600160a01b0382166000908152600360205260408120805460019290611e8f9084906141f0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03868116918217909255915184939187169160008051602061433083398151915291a4505050565b610d60565b6000838152600a602090815260408083206001600160a01b03861684529091529020611f0f90826124f3565b611f2b5760405162461bcd60e51b815260040161067290613f4a565b6000838152600a602090815260408083206001600160a01b03861684529091529020611f5790826129d4565b506001600160a01b0382166000908152600b60205260409020611f7a90846129d4565b506000838152600f602090815260408083206001600160a01b03861684529091529020611fa790826129d4565b506000838152600f602090815260408083206001600160a01b03861684529091529020611fd390612432565b6107a3576000838152600e60205260409020610e9090836129e0565b601454604051630eaad48960e01b81526001600160a01b0390911690630eaad4899061201f908590600401613d19565b60206040518083038186803b15801561203757600080fd5b505afa15801561204b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206f919061386f565b6120d55760405162461bcd60e51b815260206004820152603160248201527f416476656e74757265723a204974656d20636f6e7472616374206d75737420626044820152706520696e2074686520726567697374727960781b6064820152608401610672565b6040516377539d8d60e11b8152600481018290526000906001600160a01b0384169063eea73b1a9060240160006040518083038186803b15801561211857600080fd5b505afa15801561212c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261215491908101906138c3565b601454604051631191948d60e21b81529192506001600160a01b031690634646523490612185908490600401613e9d565b60206040518083038186803b15801561219d57600080fd5b505afa1580156121b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d5919061386f565b6122215760405162461bcd60e51b815260206004820152601d60248201527f416476656e74757265723a20496e76616c6964206974656d20747970650000006044820152606401610672565b600084815260136020526040808220905161223d908490613cce565b9081526040805160209281900383018120818301835280546001600160a01b0390811680845260019092015485840181905284518086018652918a16825281860189905260008b8152601390965294849020935192955090939290916122a4908790613cce565b90815260405160209181900382019020825181546001600160a01b0319166001600160a01b039091161781559101516001909101556122eb876122e43390565b8888612a00565b6001600160a01b0382161561230e5761230e8761230789611041565b8484612b5c565b84866001600160a01b0316887f1515558d5839d30cdf2367d28e6355b36fba99478182838a504a9e124c8acb4887604051610a4b9190613e9d565b6000828152601360205260408082209051612365908490613cce565b9081526040805160209281900383018120818301835280546001600160a01b0316808352600190910154848301819052600088815260139095529383902092519194509291906123b6908690613cce565b90815260405190819003602001902080546001600160a01b031916815560006001909101556123e88561230781611041565b80826001600160a01b0316867f44f00888e221ee14f2c2a9acaac00b23de632cd3579f849d77f7be2b76e78ad8876040516124239190613e9d565b60405180910390a45050505050565b6000610570825490565b60006117dc8383612bc0565b6040805160018082528183019092526060916000919060208083019080368337019050509050828160008151811061249057634e487b7160e01b600052603260045260246000fd5b602090810291909101015292915050565b601280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006117dc8383612bf8565b61250a848484611d45565b61251684848484612c10565b610e905760405162461bcd60e51b815260040161067290613ef8565b600081516020146125555760405162461bcd60e51b815260040161067290613f99565b82518451146125b65760405162461bcd60e51b815260206004820152602760248201527f455243313135353a2069647320616e642076616c756573206c656e677468206d6044820152660d2e6dac2e8c6d60cb1b6064820152608401610672565b6000806125c460203661421c565b90508035915060005b86518110156126d55761263083338984815181106125fb57634e487b7160e01b600052603260045260246000fd5b602002602001015189858151811061262357634e487b7160e01b600052603260045260246000fd5b6020026020010151612d1a565b336001600160a01b031683896001600160a01b03166000805160206143508339815191528a858151811061267457634e487b7160e01b600052603260045260246000fd5b60200260200101518a868151811061269c57634e487b7160e01b600052603260045260246000fd5b60200260200101516040516126bb929190918252602082015260400190565b60405180910390a4806126cd8161429a565b9150506125cd565b5063bc197c8160e01b98975050505050505050565b60608161270f57506040805180820190915260018152600360fc1b6020820152610573565b8160005b811561273957806127238161429a565b91506127329050600a83614208565b9150612713565b6000816001600160401b0381111561276157634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561278b576020820181803683370190505b5090505b8415610843576127a060018361421c565b91506127ad600a866142b5565b6127b89060306141f0565b60f81b8183815181106127db57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506127fd600a86614208565b945061278f565b600081516020146128275760405162461bcd60e51b815260040161067290613f99565b60008061283560203661421c565b90508035915061284782338888612d1a565b6040805187815260208101879052339184916001600160a01b038b1691600080516020614350833981519152910160405180910390a45063f23a6e6160e01b979650505050505050565b60006001600160e01b031982166380ac58cd60e01b14806128c257506001600160e01b03198216635b5e139f60e01b145b8061057057506301ffc9a760e01b6001600160e01b0319831614610570565b6128eb8383612df2565b6128f86000848484612c10565b6107a35760405162461bcd60e51b815260040161067290613ef8565b6000838152600e6020526040902061292c9083612f1e565b61294a576000838152600e602052604090206129489083612f33565b505b6000838152600a602090815260408083206001600160a01b0386168452909152902061297690826124f3565b6129a8576000838152600f602090815260408083206001600160a01b038616845290915290206129a69082612f48565b505b6000838152600a602090815260408083206001600160a01b03861684529091529020610e909082612f48565b60006117dc8383612f54565b60006117dc836001600160a01b038416612f54565b6107a3838383613071565b612a1a6001600160a01b0383166380ac58cd60e01b61312e565b15612a9057816001600160a01b031663b88d4fde843084612a3a8961314a565b6040518563ffffffff1660e01b8152600401612a599493929190613d8b565b600060405180830381600087803b158015612a7357600080fd5b505af1158015612a87573d6000803e3d6000fd5b50505050610e90565b612aaa6001600160a01b038316636cdb3d1360e11b61312e565b15612aec57816001600160a01b031663f242432a8430846001612acc8a61314a565b6040518663ffffffff1660e01b8152600401612a59959493929190613dbe565b6040805162461bcd60e51b81526020600482015260248101919091527f416476656e74757265723a204974656d20646f6573206e6f7420737570706f7260448201527f74204552432d373231206e6f72204552432d31313535207374616e64617264736064820152608401610672565b612b678483836114cc565b60011415612b9057612b8b8484848460405180602001604052806000815250610b36565b610e90565b6001612b9d858484610536565b10610e9057610e90848484846001604051806020016040528060008152506110b8565b6000826000018281548110612be557634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b60006001600160a01b0384163b15612d1257604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612c54903390899088908890600401613d8b565b602060405180830381600087803b158015612c6e57600080fd5b505af1925050508015612c9e575060408051601f3d908101601f19168201909252612c9b918101906138a7565b60015b612cf8573d808015612ccc576040519150601f19603f3d011682016040523d82523d6000602084013e612cd1565b606091505b508051612cf05760405162461bcd60e51b815260040161067290613ef8565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610843565b506001610843565b6000848152601060205260409020612d329084612f1e565b612d50576000848152601060205260409020612d4e9084612f33565b505b6000848152600c602090815260408083206001600160a01b03871684528252808320858452909152902054612dad5760008481526011602090815260408083206001600160a01b03871684529091529020612dab9083612f48565b505b6000848152600c602090815260408083206001600160a01b0387168452825280832085845290915281208054839290612de79084906141f0565b909155505050505050565b6001600160a01b038216612e485760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610672565b612e51816119d3565b15612e9d5760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610672565b612ea9600083836129f5565b6001600160a01b0382166000908152600360205260408120805460019290612ed29084906141f0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020614330833981519152908290a45050565b60006117dc836001600160a01b038416612bf8565b60006117dc836001600160a01b038416613174565b60006117dc8383613174565b60008181526001830160205260408120548015613067576000612f7860018361421c565b8554909150600090612f8c9060019061421c565b905081811461300d576000866000018281548110612fba57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080876000018481548110612feb57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b855486908061302c57634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610b30565b6000915050610b30565b6001600160a01b0383166130cc576130c781600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6130ef565b816001600160a01b0316836001600160a01b0316146130ef576130ef83826131be565b6001600160a01b03821661310b576131068161325b565b6107a3565b826001600160a01b0316826001600160a01b0316146107a3576107a38282613334565b600061313983613378565b80156117dc57506117dc83836133ab565b60408051602080825281830190925260609160208201818036833750505060208101929092525090565b60006131808383612bf8565b6131b657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b30565b506000610b30565b600060016131cb846111fa565b6131d5919061421c565b600083815260076020526040902054909150808214613228576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061326d9060019061421c565b600083815260096020526040812054600880549394509092849081106132a357634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080600883815481106132d257634e487b7160e01b600052603260045260246000fd5b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061331857634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b600061333f836111fa565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b600061338b826301ffc9a760e01b6133ab565b801561057057506133a4826001600160e01b03196133ab565b1592915050565b6000806301ffc9a760e01b836040516024016133c79190613e88565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050509050600080856001600160a01b03166175308460405161341a9190613cce565b6000604051808303818686fa925050503d8060008114613456576040519150601f19603f3d011682016040523d82523d6000602084013e61345b565b606091505b50915091506020815110156134765760009350505050610b30565b8180156115e35750808060200190518101906115e3919061386f565b80356001600160a01b038116811461057357600080fd5b600082601f8301126134b9578081fd5b813560206134ce6134c9836141a6565b614176565b80838252828201915082860187848660051b89010111156134ed578586fd5b855b858110156135125761350082613492565b845292840192908401906001016134ef565b5090979650505050505050565b600082601f83011261352f578081fd5b8135602061353f6134c9836141a6565b82815281810190858301855b8581101561351257613562898684358b01016135d1565b8452928401929084019060010161354b565b600082601f830112613584578081fd5b813560206135946134c9836141a6565b80838252828201915082860187848660051b89010111156135b3578586fd5b855b85811015613512578135845292840192908401906001016135b5565b600082601f8301126135e1578081fd5b81356135ef6134c9826141c9565b818152846020838601011115613603578283fd5b816020850160208301379081016020019190915292915050565b60006020828403121561362e578081fd5b6117dc82613492565b60008060408385031215613649578081fd5b61365283613492565b915061366060208401613492565b90509250929050565b600080600080600060a08688031215613680578081fd5b61368986613492565b945061369760208701613492565b935060408601356001600160401b03808211156136b2578283fd5b6136be89838a01613574565b945060608801359150808211156136d3578283fd5b6136df89838a01613574565b935060808801359150808211156136f4578283fd5b50613701888289016135d1565b9150509295509295909350565b600080600060608486031215613722578283fd5b61372b84613492565b925061373960208501613492565b9150604084013590509250925092565b6000806000806080858703121561375e578182fd5b61376785613492565b935061377560208601613492565b92506040850135915060608501356001600160401b03811115613796578182fd5b6137a2878288016135d1565b91505092959194509250565b600080600080600060a086880312156137c5578283fd5b6137ce86613492565b94506137dc60208701613492565b9350604086013592506060860135915060808601356001600160401b03811115613804578182fd5b613701888289016135d1565b60008060408385031215613822578182fd5b61382b83613492565b9150602083013561383b8161430b565b809150509250929050565b60008060408385031215613858578182fd5b61386183613492565b946020939093013593505050565b600060208284031215613880578081fd5b81516117dc8161430b565b60006020828403121561389c578081fd5b81356117dc81614319565b6000602082840312156138b8578081fd5b81516117dc81614319565b6000602082840312156138d4578081fd5b81516001600160401b038111156138e9578182fd5b8201601f810184136138f9578182fd5b80516139076134c9826141c9565b81815285602083850101111561391b578384fd5b61392c826020830160208601614233565b95945050505050565b600060208284031215613946578081fd5b5035919050565b6000806040838503121561395f578182fd5b8235915061366060208401613492565b60008060008060008060c08789031215613987578384fd5b8635955061399760208801613492565b94506139a560408801613492565b935060608701356001600160401b03808211156139c0578283fd5b6139cc8a838b01613574565b945060808901359150808211156139e1578283fd5b6139ed8a838b01613574565b935060a0890135915080821115613a02578283fd5b50613a0f89828a016135d1565b9150509295509295509295565b600080600080600060a08688031215613a33578283fd5b85359450613a4360208701613492565b9350613a5160408701613492565b92506060860135915060808601356001600160401b03811115613804578182fd5b60008060008060008060c08789031215613a8a578384fd5b86359550613a9a60208801613492565b9450613aa860408801613492565b9350606087013592506080870135915060a08701356001600160401b03811115613ad0578182fd5b613a0f89828a016135d1565b600080600060608486031215613af0578081fd5b8335925061373960208501613492565b600080600060608486031215613b14578081fd5b8335925060208401356001600160401b0380821115613b31578283fd5b613b3d878388016134a9565b93506040860135915080821115613b52578283fd5b50613b5f86828701613574565b9150509250925092565b60008060008060808587031215613b7e578182fd5b8435935060208501356001600160401b0380821115613b9b578384fd5b613ba7888389016134a9565b94506040870135915080821115613bbc578384fd5b613bc888838901613574565b93506060870135915080821115613bdd578283fd5b506137a28782880161351f565b60008060408385031215613bfc578182fd5b8235915060208301356001600160401b03811115613c18578182fd5b613c248582860161351f565b9150509250929050565b60008060408385031215613c40578182fd5b8235915060208301356001600160401b03811115613c5c578182fd5b613c24858286016135d1565b6000815180845260208085019450808401835b83811015613c9757815187529582019590820190600101613c7b565b509495945050505050565b60008151808452613cba816020860160208601614233565b601f01601f19169290920160200192915050565b60008251613ce0818460208701614233565b9190910192915050565b60008351613cfc818460208801614233565b835190830190613d10818360208801614233565b01949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a060408201819052600090613d5990830186613c68565b8281036060840152613d6b8186613c68565b90508281036080840152613d7f8185613ca2565b98975050505050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906115e390830184613ca2565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090613df890830184613ca2565b979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015613e445783516001600160a01b031683529284019291840191600101613e1f565b50909695505050505050565b6000602082526117dc6020830184613c68565b600060408252613e766040830185613c68565b828103602084015261392c8185613c68565b6001600160e01b031991909116815260200190565b6000602082526117dc6020830184613ca2565b60208082526028908201527f4552433939383a2063616c6c6572206973206e6f74206f776e6572206e6f7220604082015267185c1c1c9bdd995960c21b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602f908201527f4552433939383a20696e73756666696369656e74206368696c642062616c616e60408201526e31b2903337b9103a3930b739b332b960891b606082015260800190565b60208082526053908201527f4552433939383a2064617461206d75737420636f6e7461696e2074686520756e60408201527f697175652075696e7432353620746f6b656e496420746f207472616e7366657260608201527220746865206368696c6420746f6b656e20746f60681b608082015260a00190565b60208082526024908201527f4552433939383a207472616e7366657220746f20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252602e908201527f4f6e6c792074686520416476656e747572657220636f6e74726163742063616e60408201526d10383ab6361034ba32b6b99034b760911b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252602c908201527f416476656e74757265723a2043616c6c6572206973206e6f74206f776e65722060408201526b1b9bdc88185c1c1c9bdd995960a21b606082015260800190565b604051601f8201601f191681016001600160401b038111828210171561419e5761419e6142f5565b604052919050565b60006001600160401b038211156141bf576141bf6142f5565b5060051b60200190565b60006001600160401b038211156141e2576141e26142f5565b50601f01601f191660200190565b60008219821115614203576142036142c9565b500190565b600082614217576142176142df565b500490565b60008282101561422e5761422e6142c9565b500390565b60005b8381101561424e578181015183820152602001614236565b83811115610e905750506000910152565b600181811c9082168061427357607f821691505b6020821081141561429457634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156142ae576142ae6142c9565b5060010190565b6000826142c4576142c46142df565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114610a9a57600080fd5b6001600160e01b031981168114610a9a57600080fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efd7888948ee7a8c63f452e7acd7a939ceb46066e16f52de72c8fa328e28f2aad1a26469706673582212209e68760259dde37ca52c6021ab1086433a74cacf1cc0e9689507322a5d97e9a464736f6c634300080300330000000000000000000000008a234e50fa8eb9a013e3b9671302e25a332c5c10

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101cd5760003560e01c806301a00210146101d257806301ffc9a7146101f857806306fdde031461021b578063081812fc14610230578063095ea7b3146102505780631249c58b14610265578063150b7a021461026d57806318160ddd1461028d578063205ec4c21461029557806323b872dd146102a85780632d9b6f57146102bb5780632f745c59146102ce5780633181aa49146102e15780633b25f1af146102f45780633c8619e4146103075780633fe540a91461032757806342842e0e1461033a57806348d0b72c1461034d5780634cadb51c146103bb5780634f6ccce7146103ce5780636352211e146103e157806367b53d75146103f457806370a0823114610407578063715018a61461041a578063782f5423146104225780638da5cb5b1461044257806395d89b411461044a578063a22cb46514610452578063a545da3914610465578063af0bdfea14610478578063b88d4fde1461048b578063bc197c811461049e578063bd1dd40b146104b1578063c87b56dd146104c4578063d50efd70146104d7578063e985e9c5146104ea578063f23a6e61146104fd578063f2fde38b14610510578063ff297a0e14610523575b600080fd5b6101e56101e0366004613adc565b610536565b6040519081526020015b60405180910390f35b61020b61020636600461388b565b610565565b60405190151581526020016101ef565b610223610578565b6040516101ef9190613e9d565b61024361023e366004613935565b61060a565b6040516101ef9190613d19565b61026361025e366004613846565b610697565b005b6102636107a8565b61028061027b366004613749565b6107b7565b6040516101ef9190613e88565b6008546101e5565b6102636102a336600461396f565b61084b565b6102636102b636600461370e565b610a5c565b6102636102c936600461361d565b610a8d565b6101e56102dc366004613846565b610a9d565b6102636102ef366004613a1c565b610b36565b610263610302366004613b69565b610c72565b61031a610315366004613935565b610d68565b6040516101ef9190613e03565b610263610335366004613adc565b610e5e565b61026361034836600461370e565b610e96565b61039c61035b366004613c2e565b60136020908152600092835260409092208151808301840180519281529084019290930191909120915280546001909101546001600160a01b039091169082565b604080516001600160a01b0390931683526020830191909152016101ef565b61031a6103c9366004613935565b610eb1565b6101e56103dc366004613935565b610fa0565b6102436103ef366004613935565b611041565b610263610402366004613a72565b6110b8565b6101e561041536600461361d565b6111fa565b610263611281565b61043561043036600461394d565b6112ba565b6040516101ef9190613e50565b6102436113e0565b6102236113ef565b610263610460366004613810565b6113fe565b6101e5610473366004613adc565b6114cc565b610263610486366004613bea565b611511565b610263610499366004613749565b61157a565b6102806104ac366004613669565b6115ac565b6104356104bf36600461394d565b6115ed565b6102236104d2366004613935565b61170b565b6102636104e5366004613c2e565b6117e3565b61020b6104f8366004613637565b611814565b61028061050b3660046137ae565b611842565b61026361051e36600461361d565b611879565b610263610531366004613b00565b611916565b6000928352600c602090815260408085206001600160a01b039490941685529281528284209184525290205490565b6000610570826119ae565b90505b919050565b6060600080546105879061425f565b80601f01602080910402602001604051908101604052809291908181526020018280546105b39061425f565b80156106005780601f106105d557610100808354040283529160200191610600565b820191906000526020600020905b8154815290600101906020018083116105e357829003601f168201915b5050505050905090565b6000610615826119d3565b61067b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006106a282611041565b9050806001600160a01b0316836001600160a01b031614156107105760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610672565b336001600160a01b038216148061072c575061072c81336104f8565b6107995760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610672565b6107a383836119f0565b505050565b6107b5336008545b611a5e565b565b60006001600160a01b03851630146108345760405162461bcd60e51b815260206004820152603a60248201527f416476656e74757265723a204f6e6c792074686520416476656e74757265722060448201527931b7b73a3930b1ba1031b0b710383ab6361034ba32b6b99034b760311b6064820152608401610672565b61084085858585611a7c565b90505b949350505050565b81518351146108ac5760405162461bcd60e51b815260206004820152602760248201527f4552433939383a2069647320616e6420616d6f756e7473206c656e677468206d6044820152660d2e6dac2e8c6d60cb1b6064820152608401610672565b6001600160a01b0385166108d25760405162461bcd60e51b815260040161067290614012565b33806108dd88611041565b6001600160a01b031614806108ff57506108ff6108f988611041565b82611814565b61091b5760405162461bcd60e51b815260040161067290613eb0565b60005b845181101561099e57600085828151811061094957634e487b7160e01b600052603260045260246000fd5b60200260200101519050600085838151811061097557634e487b7160e01b600052603260045260246000fd5b6020026020010151905061098b8a898484611b1f565b5050806109979061429a565b905061091e565b50604051631759616b60e11b81526001600160a01b03861690632eb2c2d6906109d39030908a90899089908990600401613d2d565b600060405180830381600087803b1580156109ed57600080fd5b505af1158015610a01573d6000803e3d6000fd5b50505050846001600160a01b0316866001600160a01b0316887f83730c6482dabefeeec86d872d92bcd6a09df1ca6b3a6cbb17d07591339f15db8787604051610a4b929190613e63565b60405180910390a450505050505050565b610a663382611c83565b610a825760405162461bcd60e51b8152600401610672906140d9565b6107a3838383611d45565b610a9a816107b060085490565b50565b6000610aa8836111fa565b8210610b0a5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610672565b506001600160a01b03821660009081526006602090815260408083208484529091529020545b92915050565b6001600160a01b038416610b5c5760405162461bcd60e51b815260040161067290614012565b3380610b6787611041565b6001600160a01b03161480610b835750610b836108f987611041565b610b9f5760405162461bcd60e51b815260040161067290613eb0565b610bad818787878787611ede565b610bb8868585611ee3565b604051635c46a7ef60e11b81526001600160a01b0385169063b88d4fde90610bea903090899088908890600401613d8b565b600060405180830381600087803b158015610c0457600080fd5b505af1158015610c18573d6000803e3d6000fd5b50505050836001600160a01b0316856001600160a01b0316877f9246785543aff8b5b156e5909aebd5d321e61df5e10c6670a43c1c4e78e3cedf86604051610c6291815260200190565b60405180910390a4505050505050565b83610c7d3382611c83565b610c995760405162461bcd60e51b81526004016106729061412a565b60005b8451811015610d1057610cfe86868381518110610cc957634e487b7160e01b600052603260045260246000fd5b6020026020010151868481518110610cf157634e487b7160e01b600052603260045260246000fd5b6020026020010151611fef565b80610d088161429a565b915050610c9c565b5060005b8251811015610d6057610d4e86848381518110610d4157634e487b7160e01b600052603260045260246000fd5b6020026020010151612349565b80610d588161429a565b915050610d14565b505050505050565b600081815260106020526040812060609190610d8390612432565b6001600160401b03811115610da857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610dd1578160200160208202803683370190505b50905060005b6000848152601060205260409020610dee90612432565b811015610e57576000848152601060205260409020610e0d908261243c565b828281518110610e2d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039092166020928302919091019091015280610e4f8161429a565b915050610dd7565b5092915050565b82610e693382611c83565b610e855760405162461bcd60e51b81526004016106729061412a565b610e90848484611fef565b50505050565b6107a38383836040518060200160405280600081525061157a565b6000818152600e6020526040812060609190610ecc90612432565b6001600160401b03811115610ef157634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610f1a578160200160208202803683370190505b50905060005b6000848152600e60205260409020610f3790612432565b811015610e57576000848152600e60205260409020610f56908261243c565b828281518110610f7657634e487b7160e01b600052603260045260246000fd5b6001600160a01b039092166020928302919091019091015280610f988161429a565b915050610f20565b6000610fab60085490565b821061100e5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610672565b6008828154811061102f57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b0316806105705760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610672565b6001600160a01b0385166110de5760405162461bcd60e51b815260040161067290614012565b33806110e988611041565b6001600160a01b0316148061110557506111056108f988611041565b6111215760405162461bcd60e51b815260040161067290613eb0565b61113a8188888861113189612448565b610d6089612448565b61114687868686611b1f565b604051637921219560e11b81526001600160a01b0386169063f242432a9061117a9030908a90899089908990600401613dbe565b600060405180830381600087803b15801561119457600080fd5b505af11580156111a8573d6000803e3d6000fd5b50505050846001600160a01b0316866001600160a01b0316887ea198470a602f1d156b20e41b65b907ab137359caceff40e0205ff1858b81fc8787604051610a4b929190918252602082015260400190565b60006001600160a01b0382166112655760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610672565b506001600160a01b031660009081526003602052604090205490565b3361128a6113e0565b6001600160a01b0316146112b05760405162461bcd60e51b8152600401610672906140a4565b6107b560006124a1565b60008281526011602090815260408083206001600160a01b03851684529091528120606091906112e990612432565b6001600160401b0381111561130e57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611337578160200160208202803683370190505b50905060005b60008581526011602090815260408083206001600160a01b0388168452909152902061136890612432565b8110156113d85760008581526011602090815260408083206001600160a01b0388168452909152902061139b908261243c565b8282815181106113bb57634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806113d08161429a565b91505061133d565b509392505050565b6012546001600160a01b031690565b6060600180546105879061425f565b6001600160a01b0382163314156114535760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610672565b3360008181526005602090815260408083206001600160a01b0387168085529252909120805460ff1916841515179055906001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516114c0911515815260200190565b60405180910390a35050565b6000838152600a602090815260408083206001600160a01b038616845290915281206114f890836124f3565b611503576000611506565b60015b60ff16949350505050565b8161151c3382611c83565b6115385760405162461bcd60e51b81526004016106729061412a565b60005b8251811015610e905761156884848381518110610d4157634e487b7160e01b600052603260045260246000fd5b806115728161429a565b91505061153b565b6115843383611c83565b6115a05760405162461bcd60e51b8152600401610672906140d9565b610e90848484846124ff565b60006001600160a01b03861630146115d65760405162461bcd60e51b815260040161067290614056565b6115e38686868686612532565b9695505050505050565b6000828152600f602090815260408083206001600160a01b038516845290915281206060919061161c90612432565b6001600160401b0381111561164157634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561166a578160200160208202803683370190505b50905060005b6000858152600f602090815260408083206001600160a01b0388168452909152902061169b90612432565b8110156113d8576000858152600f602090815260408083206001600160a01b038816845290915290206116ce908261243c565b8282815181106116ee57634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806117038161429a565b915050611670565b6060611716826119d3565b61177a5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610672565b600061179160408051602081019091526000815290565b905060008151116117b157604051806020016040528060008152506117dc565b806117bb846126ea565b6040516020016117cc929190613cea565b6040516020818303038152906040525b9392505050565b816117ee3382611c83565b61180a5760405162461bcd60e51b81526004016106729061412a565b6107a38383612349565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b60006001600160a01b038616301461186c5760405162461bcd60e51b815260040161067290614056565b6115e38686868686612804565b336118826113e0565b6001600160a01b0316146118a85760405162461bcd60e51b8152600401610672906140a4565b6001600160a01b03811661190d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610672565b610a9a816124a1565b826119213382611c83565b61193d5760405162461bcd60e51b81526004016106729061412a565b60005b83518110156119a7576119958585838151811061196d57634e487b7160e01b600052603260045260246000fd5b6020026020010151858481518110610cf157634e487b7160e01b600052603260045260246000fd5b8061199f8161429a565b915050611940565b5050505050565b60006001600160e01b0319821663780e9d6360e01b1480610570575061057082612891565b6000908152600260205260409020546001600160a01b0316151590565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611a2582611041565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b611a788282604051806020016040528060008152506128e1565b5050565b60008151602014611a9f5760405162461bcd60e51b815260040161067290613f99565b600080611aad60203661421c565b905080359150611abe823387612914565b336001600160a01b031682876001600160a01b03167fb00761aee4ba24f247fd2ed53e16133421febde35143e2290cd1d5703dc9102588604051611b0491815260200190565b60405180910390a450630a85bd0160e11b9695505050505050565b80151580611b5757506000848152600c602090815260408083206001600160a01b038716845282528083208584529091529020548111155b611b735760405162461bcd60e51b815260040161067290613f4a565b6000848152600c602090815260408083206001600160a01b0387168452825280832085845290915281208054839290611bad90849061421c565b90915550506000848152600c602090815260408083206001600160a01b03871684528252808320858452909152902054610e90576001600160a01b0383166000908152600d602090815260408083208584529091529020611c0e90856129d4565b5060008481526011602090815260408083206001600160a01b03871684529091529020611c3b90836129d4565b5060008481526011602090815260408083206001600160a01b03871684529091529020611c6790612432565b610e905760008481526010602052604090206119a790846129e0565b6000611c8e826119d3565b611cef5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610672565b6000611cfa83611041565b9050806001600160a01b0316846001600160a01b03161480611d355750836001600160a01b0316611d2a8461060a565b6001600160a01b0316145b8061084357506108438185611814565b826001600160a01b0316611d5882611041565b6001600160a01b031614611dc05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610672565b6001600160a01b038216611e225760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610672565b611e2d8383836129f5565b611e386000826119f0565b6001600160a01b0383166000908152600360205260408120805460019290611e6190849061421c565b90915550506001600160a01b0382166000908152600360205260408120805460019290611e8f9084906141f0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03868116918217909255915184939187169160008051602061433083398151915291a4505050565b610d60565b6000838152600a602090815260408083206001600160a01b03861684529091529020611f0f90826124f3565b611f2b5760405162461bcd60e51b815260040161067290613f4a565b6000838152600a602090815260408083206001600160a01b03861684529091529020611f5790826129d4565b506001600160a01b0382166000908152600b60205260409020611f7a90846129d4565b506000838152600f602090815260408083206001600160a01b03861684529091529020611fa790826129d4565b506000838152600f602090815260408083206001600160a01b03861684529091529020611fd390612432565b6107a3576000838152600e60205260409020610e9090836129e0565b601454604051630eaad48960e01b81526001600160a01b0390911690630eaad4899061201f908590600401613d19565b60206040518083038186803b15801561203757600080fd5b505afa15801561204b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206f919061386f565b6120d55760405162461bcd60e51b815260206004820152603160248201527f416476656e74757265723a204974656d20636f6e7472616374206d75737420626044820152706520696e2074686520726567697374727960781b6064820152608401610672565b6040516377539d8d60e11b8152600481018290526000906001600160a01b0384169063eea73b1a9060240160006040518083038186803b15801561211857600080fd5b505afa15801561212c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261215491908101906138c3565b601454604051631191948d60e21b81529192506001600160a01b031690634646523490612185908490600401613e9d565b60206040518083038186803b15801561219d57600080fd5b505afa1580156121b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d5919061386f565b6122215760405162461bcd60e51b815260206004820152601d60248201527f416476656e74757265723a20496e76616c6964206974656d20747970650000006044820152606401610672565b600084815260136020526040808220905161223d908490613cce565b9081526040805160209281900383018120818301835280546001600160a01b0390811680845260019092015485840181905284518086018652918a16825281860189905260008b8152601390965294849020935192955090939290916122a4908790613cce565b90815260405160209181900382019020825181546001600160a01b0319166001600160a01b039091161781559101516001909101556122eb876122e43390565b8888612a00565b6001600160a01b0382161561230e5761230e8761230789611041565b8484612b5c565b84866001600160a01b0316887f1515558d5839d30cdf2367d28e6355b36fba99478182838a504a9e124c8acb4887604051610a4b9190613e9d565b6000828152601360205260408082209051612365908490613cce565b9081526040805160209281900383018120818301835280546001600160a01b0316808352600190910154848301819052600088815260139095529383902092519194509291906123b6908690613cce565b90815260405190819003602001902080546001600160a01b031916815560006001909101556123e88561230781611041565b80826001600160a01b0316867f44f00888e221ee14f2c2a9acaac00b23de632cd3579f849d77f7be2b76e78ad8876040516124239190613e9d565b60405180910390a45050505050565b6000610570825490565b60006117dc8383612bc0565b6040805160018082528183019092526060916000919060208083019080368337019050509050828160008151811061249057634e487b7160e01b600052603260045260246000fd5b602090810291909101015292915050565b601280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006117dc8383612bf8565b61250a848484611d45565b61251684848484612c10565b610e905760405162461bcd60e51b815260040161067290613ef8565b600081516020146125555760405162461bcd60e51b815260040161067290613f99565b82518451146125b65760405162461bcd60e51b815260206004820152602760248201527f455243313135353a2069647320616e642076616c756573206c656e677468206d6044820152660d2e6dac2e8c6d60cb1b6064820152608401610672565b6000806125c460203661421c565b90508035915060005b86518110156126d55761263083338984815181106125fb57634e487b7160e01b600052603260045260246000fd5b602002602001015189858151811061262357634e487b7160e01b600052603260045260246000fd5b6020026020010151612d1a565b336001600160a01b031683896001600160a01b03166000805160206143508339815191528a858151811061267457634e487b7160e01b600052603260045260246000fd5b60200260200101518a868151811061269c57634e487b7160e01b600052603260045260246000fd5b60200260200101516040516126bb929190918252602082015260400190565b60405180910390a4806126cd8161429a565b9150506125cd565b5063bc197c8160e01b98975050505050505050565b60608161270f57506040805180820190915260018152600360fc1b6020820152610573565b8160005b811561273957806127238161429a565b91506127329050600a83614208565b9150612713565b6000816001600160401b0381111561276157634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561278b576020820181803683370190505b5090505b8415610843576127a060018361421c565b91506127ad600a866142b5565b6127b89060306141f0565b60f81b8183815181106127db57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506127fd600a86614208565b945061278f565b600081516020146128275760405162461bcd60e51b815260040161067290613f99565b60008061283560203661421c565b90508035915061284782338888612d1a565b6040805187815260208101879052339184916001600160a01b038b1691600080516020614350833981519152910160405180910390a45063f23a6e6160e01b979650505050505050565b60006001600160e01b031982166380ac58cd60e01b14806128c257506001600160e01b03198216635b5e139f60e01b145b8061057057506301ffc9a760e01b6001600160e01b0319831614610570565b6128eb8383612df2565b6128f86000848484612c10565b6107a35760405162461bcd60e51b815260040161067290613ef8565b6000838152600e6020526040902061292c9083612f1e565b61294a576000838152600e602052604090206129489083612f33565b505b6000838152600a602090815260408083206001600160a01b0386168452909152902061297690826124f3565b6129a8576000838152600f602090815260408083206001600160a01b038616845290915290206129a69082612f48565b505b6000838152600a602090815260408083206001600160a01b03861684529091529020610e909082612f48565b60006117dc8383612f54565b60006117dc836001600160a01b038416612f54565b6107a3838383613071565b612a1a6001600160a01b0383166380ac58cd60e01b61312e565b15612a9057816001600160a01b031663b88d4fde843084612a3a8961314a565b6040518563ffffffff1660e01b8152600401612a599493929190613d8b565b600060405180830381600087803b158015612a7357600080fd5b505af1158015612a87573d6000803e3d6000fd5b50505050610e90565b612aaa6001600160a01b038316636cdb3d1360e11b61312e565b15612aec57816001600160a01b031663f242432a8430846001612acc8a61314a565b6040518663ffffffff1660e01b8152600401612a59959493929190613dbe565b6040805162461bcd60e51b81526020600482015260248101919091527f416476656e74757265723a204974656d20646f6573206e6f7420737570706f7260448201527f74204552432d373231206e6f72204552432d31313535207374616e64617264736064820152608401610672565b612b678483836114cc565b60011415612b9057612b8b8484848460405180602001604052806000815250610b36565b610e90565b6001612b9d858484610536565b10610e9057610e90848484846001604051806020016040528060008152506110b8565b6000826000018281548110612be557634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b60006001600160a01b0384163b15612d1257604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612c54903390899088908890600401613d8b565b602060405180830381600087803b158015612c6e57600080fd5b505af1925050508015612c9e575060408051601f3d908101601f19168201909252612c9b918101906138a7565b60015b612cf8573d808015612ccc576040519150601f19603f3d011682016040523d82523d6000602084013e612cd1565b606091505b508051612cf05760405162461bcd60e51b815260040161067290613ef8565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610843565b506001610843565b6000848152601060205260409020612d329084612f1e565b612d50576000848152601060205260409020612d4e9084612f33565b505b6000848152600c602090815260408083206001600160a01b03871684528252808320858452909152902054612dad5760008481526011602090815260408083206001600160a01b03871684529091529020612dab9083612f48565b505b6000848152600c602090815260408083206001600160a01b0387168452825280832085845290915281208054839290612de79084906141f0565b909155505050505050565b6001600160a01b038216612e485760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610672565b612e51816119d3565b15612e9d5760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610672565b612ea9600083836129f5565b6001600160a01b0382166000908152600360205260408120805460019290612ed29084906141f0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020614330833981519152908290a45050565b60006117dc836001600160a01b038416612bf8565b60006117dc836001600160a01b038416613174565b60006117dc8383613174565b60008181526001830160205260408120548015613067576000612f7860018361421c565b8554909150600090612f8c9060019061421c565b905081811461300d576000866000018281548110612fba57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080876000018481548110612feb57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b855486908061302c57634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610b30565b6000915050610b30565b6001600160a01b0383166130cc576130c781600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6130ef565b816001600160a01b0316836001600160a01b0316146130ef576130ef83826131be565b6001600160a01b03821661310b576131068161325b565b6107a3565b826001600160a01b0316826001600160a01b0316146107a3576107a38282613334565b600061313983613378565b80156117dc57506117dc83836133ab565b60408051602080825281830190925260609160208201818036833750505060208101929092525090565b60006131808383612bf8565b6131b657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b30565b506000610b30565b600060016131cb846111fa565b6131d5919061421c565b600083815260076020526040902054909150808214613228576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061326d9060019061421c565b600083815260096020526040812054600880549394509092849081106132a357634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080600883815481106132d257634e487b7160e01b600052603260045260246000fd5b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061331857634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b600061333f836111fa565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b600061338b826301ffc9a760e01b6133ab565b801561057057506133a4826001600160e01b03196133ab565b1592915050565b6000806301ffc9a760e01b836040516024016133c79190613e88565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050509050600080856001600160a01b03166175308460405161341a9190613cce565b6000604051808303818686fa925050503d8060008114613456576040519150601f19603f3d011682016040523d82523d6000602084013e61345b565b606091505b50915091506020815110156134765760009350505050610b30565b8180156115e35750808060200190518101906115e3919061386f565b80356001600160a01b038116811461057357600080fd5b600082601f8301126134b9578081fd5b813560206134ce6134c9836141a6565b614176565b80838252828201915082860187848660051b89010111156134ed578586fd5b855b858110156135125761350082613492565b845292840192908401906001016134ef565b5090979650505050505050565b600082601f83011261352f578081fd5b8135602061353f6134c9836141a6565b82815281810190858301855b8581101561351257613562898684358b01016135d1565b8452928401929084019060010161354b565b600082601f830112613584578081fd5b813560206135946134c9836141a6565b80838252828201915082860187848660051b89010111156135b3578586fd5b855b85811015613512578135845292840192908401906001016135b5565b600082601f8301126135e1578081fd5b81356135ef6134c9826141c9565b818152846020838601011115613603578283fd5b816020850160208301379081016020019190915292915050565b60006020828403121561362e578081fd5b6117dc82613492565b60008060408385031215613649578081fd5b61365283613492565b915061366060208401613492565b90509250929050565b600080600080600060a08688031215613680578081fd5b61368986613492565b945061369760208701613492565b935060408601356001600160401b03808211156136b2578283fd5b6136be89838a01613574565b945060608801359150808211156136d3578283fd5b6136df89838a01613574565b935060808801359150808211156136f4578283fd5b50613701888289016135d1565b9150509295509295909350565b600080600060608486031215613722578283fd5b61372b84613492565b925061373960208501613492565b9150604084013590509250925092565b6000806000806080858703121561375e578182fd5b61376785613492565b935061377560208601613492565b92506040850135915060608501356001600160401b03811115613796578182fd5b6137a2878288016135d1565b91505092959194509250565b600080600080600060a086880312156137c5578283fd5b6137ce86613492565b94506137dc60208701613492565b9350604086013592506060860135915060808601356001600160401b03811115613804578182fd5b613701888289016135d1565b60008060408385031215613822578182fd5b61382b83613492565b9150602083013561383b8161430b565b809150509250929050565b60008060408385031215613858578182fd5b61386183613492565b946020939093013593505050565b600060208284031215613880578081fd5b81516117dc8161430b565b60006020828403121561389c578081fd5b81356117dc81614319565b6000602082840312156138b8578081fd5b81516117dc81614319565b6000602082840312156138d4578081fd5b81516001600160401b038111156138e9578182fd5b8201601f810184136138f9578182fd5b80516139076134c9826141c9565b81815285602083850101111561391b578384fd5b61392c826020830160208601614233565b95945050505050565b600060208284031215613946578081fd5b5035919050565b6000806040838503121561395f578182fd5b8235915061366060208401613492565b60008060008060008060c08789031215613987578384fd5b8635955061399760208801613492565b94506139a560408801613492565b935060608701356001600160401b03808211156139c0578283fd5b6139cc8a838b01613574565b945060808901359150808211156139e1578283fd5b6139ed8a838b01613574565b935060a0890135915080821115613a02578283fd5b50613a0f89828a016135d1565b9150509295509295509295565b600080600080600060a08688031215613a33578283fd5b85359450613a4360208701613492565b9350613a5160408701613492565b92506060860135915060808601356001600160401b03811115613804578182fd5b60008060008060008060c08789031215613a8a578384fd5b86359550613a9a60208801613492565b9450613aa860408801613492565b9350606087013592506080870135915060a08701356001600160401b03811115613ad0578182fd5b613a0f89828a016135d1565b600080600060608486031215613af0578081fd5b8335925061373960208501613492565b600080600060608486031215613b14578081fd5b8335925060208401356001600160401b0380821115613b31578283fd5b613b3d878388016134a9565b93506040860135915080821115613b52578283fd5b50613b5f86828701613574565b9150509250925092565b60008060008060808587031215613b7e578182fd5b8435935060208501356001600160401b0380821115613b9b578384fd5b613ba7888389016134a9565b94506040870135915080821115613bbc578384fd5b613bc888838901613574565b93506060870135915080821115613bdd578283fd5b506137a28782880161351f565b60008060408385031215613bfc578182fd5b8235915060208301356001600160401b03811115613c18578182fd5b613c248582860161351f565b9150509250929050565b60008060408385031215613c40578182fd5b8235915060208301356001600160401b03811115613c5c578182fd5b613c24858286016135d1565b6000815180845260208085019450808401835b83811015613c9757815187529582019590820190600101613c7b565b509495945050505050565b60008151808452613cba816020860160208601614233565b601f01601f19169290920160200192915050565b60008251613ce0818460208701614233565b9190910192915050565b60008351613cfc818460208801614233565b835190830190613d10818360208801614233565b01949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a060408201819052600090613d5990830186613c68565b8281036060840152613d6b8186613c68565b90508281036080840152613d7f8185613ca2565b98975050505050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906115e390830184613ca2565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090613df890830184613ca2565b979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015613e445783516001600160a01b031683529284019291840191600101613e1f565b50909695505050505050565b6000602082526117dc6020830184613c68565b600060408252613e766040830185613c68565b828103602084015261392c8185613c68565b6001600160e01b031991909116815260200190565b6000602082526117dc6020830184613ca2565b60208082526028908201527f4552433939383a2063616c6c6572206973206e6f74206f776e6572206e6f7220604082015267185c1c1c9bdd995960c21b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602f908201527f4552433939383a20696e73756666696369656e74206368696c642062616c616e60408201526e31b2903337b9103a3930b739b332b960891b606082015260800190565b60208082526053908201527f4552433939383a2064617461206d75737420636f6e7461696e2074686520756e60408201527f697175652075696e7432353620746f6b656e496420746f207472616e7366657260608201527220746865206368696c6420746f6b656e20746f60681b608082015260a00190565b60208082526024908201527f4552433939383a207472616e7366657220746f20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252602e908201527f4f6e6c792074686520416476656e747572657220636f6e74726163742063616e60408201526d10383ab6361034ba32b6b99034b760911b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252602c908201527f416476656e74757265723a2043616c6c6572206973206e6f74206f776e65722060408201526b1b9bdc88185c1c1c9bdd995960a21b606082015260800190565b604051601f8201601f191681016001600160401b038111828210171561419e5761419e6142f5565b604052919050565b60006001600160401b038211156141bf576141bf6142f5565b5060051b60200190565b60006001600160401b038211156141e2576141e26142f5565b50601f01601f191660200190565b60008219821115614203576142036142c9565b500190565b600082614217576142176142df565b500490565b60008282101561422e5761422e6142c9565b500390565b60005b8381101561424e578181015183820152602001614236565b83811115610e905750506000910152565b600181811c9082168061427357607f821691505b6020821081141561429457634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156142ae576142ae6142c9565b5060010190565b6000826142c4576142c46142df565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114610a9a57600080fd5b6001600160e01b031981168114610a9a57600080fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efd7888948ee7a8c63f452e7acd7a939ceb46066e16f52de72c8fa328e28f2aad1a26469706673582212209e68760259dde37ca52c6021ab1086433a74cacf1cc0e9689507322a5d97e9a464736f6c63430008030033

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

0000000000000000000000008a234e50fa8eb9a013e3b9671302e25a332c5c10

-----Decoded View---------------
Arg [0] : _registry (address): 0x8A234e50FA8EB9a013e3b9671302E25A332C5c10

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000008a234e50fa8eb9a013e3b9671302e25a332c5c10


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.