ETH Price: $3,317.23 (-4.26%)

Token

Adventurers (for Loot) (ADVT)
 

Overview

Max Total Supply

431 ADVT

Holders

337

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Filtered by Token Holder
aaaeeeggg.eth
Balance
1 ADVT
0x469adaf766fb35f1a3c2569fe8c57a50f4b39131
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 24 : 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 {Base64, toString} from "./MetadataUtils.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);
  function allItemTypes() external view returns (string[] memory);
}

/// @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("Adventurers (for Loot)", "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);
  }

  function tokenURI(uint256 _tokenId) override public view returns (string memory) {
    string[] memory allItemTypes = registry.allItemTypes();
    string memory image = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: white; font-family: serif; font-size: 14px; }</style><rect width="100%" height="100%" fill="black" />';
    uint8 yIndex = 20;

    for (uint8 i = 0; i < allItemTypes.length; i++) {
      string memory itemType = allItemTypes[i];
      Item memory item = equipped[_tokenId][itemType];
      if (item.itemAddress != address(0)) {
        string memory name = ILootmart(item.itemAddress).nameFor(item.id);
        image = string(abi.encodePacked(image, '<text x="10" y="', toString(yIndex), '" class="base">', name, '</text>'));
      } else {
        image = string(abi.encodePacked(image, '<text x="10" y="', toString(yIndex), '" class="base">-</text>'));
      }
      yIndex += 20;
    }

    image = string(abi.encodePacked(image, '</svg>'));

    string memory json = Base64.encode(
      bytes(
        string(
          abi.encodePacked(
            '{',
            '"name": "Adventurer #', toString(_tokenId),'", ',
            '"description": "Adventurers can be equipped and upgraded with various Lootmart items. Different combinations of items unlock special abilities and powers for your Adventurer.", ',
            '"image": ', '"data:image/svg+xml;base64,', Base64.encode(bytes(image)), '", '
            '"attributes": ', attributes(_tokenId),
            '}'
          )
        )
      )
    );

    return string(abi.encodePacked('data:application/json;base64,', json));
  }

  // Helper for encoding as json w/ trait_type / value from opensea
  function trait(string memory _traitType, string memory _value) internal pure returns (string memory) {
      return string(abi.encodePacked(
        '{',
        '"trait_type": "', _traitType, '", ',
        '"value": "', _value, '"',
        '}'
      ));
    }

  /// @notice Returns the attributes associated with this item.
  /// @dev Opensea Standards: https://docs.opensea.io/docs/metadata-standards
  function attributes(uint256 _tokenId) public view returns (string memory) {
    string memory res = "[";
    string[] memory allItemTypes = registry.allItemTypes();
    bool first = true;
    for (uint8 i = 0; i < allItemTypes.length; i++) {
      string memory itemType = allItemTypes[i];
      Item memory item = equipped[_tokenId][itemType];
      if (item.itemAddress != address(0)) {
        string memory name = ILootmart(item.itemAddress).nameFor(item.id);
        if (first) {
          res = string(abi.encodePacked(res, trait(itemType, name)));
          first = false;
        } else {
          res = string(abi.encodePacked(res, ', ', trait(itemType, name)));
        }
      }
    }

    return string(abi.encodePacked(res, ']'));
  }

  // 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 24 : 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 24 : 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 24 : 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 24 : 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 24 : 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 24 : MetadataUtils.sol
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

function toString(uint256 value) pure returns (string memory) {
    // Inspired by OraclizeAPI's implementation - MIT license
    // 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);
}

/// [MIT License]
/// @title Base64
/// @notice Provides a function for encoding some bytes in base64
/// @author Brecht Devos <[email protected]>
library Base64 {
    bytes internal constant TABLE =
        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /// @notice Encodes some bytes to the base64 representation
    function encode(bytes memory data) internal pure returns (string memory) {
        uint256 len = data.length;
        if (len == 0) return "";

        // multiply by 4/3 rounded up
        uint256 encodedLen = 4 * ((len + 2) / 3);

        // Add some extra buffer at the end
        bytes memory result = new bytes(encodedLen + 32);

        bytes memory table = TABLE;

        assembly {
            let tablePtr := add(table, 1)
            let resultPtr := add(result, 32)

            for {
                let i := 0
            } lt(i, len) {

            } {
                i := add(i, 3)
                let input := and(mload(add(data, i)), 0xffffff)

                let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))
                out := shl(8, out)
                out := add(
                    out,
                    and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF)
                )
                out := shl(8, out)
                out := add(
                    out,
                    and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF)
                )
                out := shl(8, out)
                out := add(
                    out,
                    and(mload(add(tablePtr, and(input, 0x3F))), 0xFF)
                )
                out := shl(224, out)

                mstore(resultPtr, out)

                resultPtr := add(resultPtr, 4)
            }

            switch mod(len, 3)
            case 1 {
                mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
            }
            case 2 {
                mstore(sub(resultPtr, 1), shl(248, 0x3d))
            }

            mstore(result, encodedLen)
        }

        return string(result);
    }
}

File 8 of 24 : 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 9 of 24 : 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);
  function nameFor(uint256 tokenId) external view returns (string memory);
}

File 10 of 24 : 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 11 of 24 : 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 12 of 24 : 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 13 of 24 : 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 14 of 24 : 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 15 of 24 : 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 16 of 24 : 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 17 of 24 : 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 18 of 24 : 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 19 of 24 : 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 20 of 24 : 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 21 of 24 : 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 22 of 24 : 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 23 of 24 : 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 24 of 24 : 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":"uint256","name":"_tokenId","type":"uint256"}],"name":"attributes","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","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"}]

60806040523480156200001157600080fd5b5060405162005292380380620052928339810160408190526200003491620001f0565b604080518082018252601681527f416476656e7475726572732028666f72204c6f6f7429000000000000000000006020808301918252835180850190945260048452631051159560e21b9084015281519192918391839162000099916000916200014a565b508051620000af9060019060208401906200014a565b5050505050620000ce620000c8620000f460201b60201c565b620000f8565b601480546001600160a01b0319166001600160a01b03929092169190911790556200025d565b3390565b601280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054620001589062000220565b90600052602060002090601f0160209004810192826200017c5760008555620001c7565b82601f106200019757805160ff1916838001178555620001c7565b82800160010185558215620001c7579182015b82811115620001c7578251825591602001919060010190620001aa565b50620001d5929150620001d9565b5090565b5b80821115620001d55760008155600101620001da565b60006020828403121562000202578081fd5b81516001600160a01b038116811462000219578182fd5b9392505050565b600181811c908216806200023557607f821691505b602082108114156200025757634e487b7160e01b600052602260045260246000fd5b50919050565b615025806200026d6000396000f3fe608060405234801561001057600080fd5b50600436106101d85760003560e01c806301a00210146101dd57806301ffc9a71461020357806306fdde0314610226578063081812fc1461023b578063095ea7b31461025b5780631249c58b14610270578063150b7a021461027857806318160ddd14610298578063205ec4c2146102a057806323b872dd146102b35780632d9b6f57146102c65780632f745c59146102d95780633181aa49146102ec5780633b25f1af146102ff5780633c8619e4146103125780633fe540a91461033257806342842e0e1461034557806348d0b72c146103585780634cadb51c146103c65780634f6ccce7146103d95780636352211e146103ec57806367b53d75146103ff57806370a0823114610412578063715018a614610425578063782f54231461042d5780638da5cb5b1461044d57806395d89b4114610455578063a22cb4651461045d578063a545da3914610470578063af0bdfea14610483578063b88d4fde14610496578063bc197c81146104a9578063bd1dd40b146104bc578063c87b56dd146104cf578063d05dcc6a146104e2578063d50efd70146104f5578063e985e9c514610508578063f23a6e611461051b578063f2fde38b1461052e578063ff297a0e14610541575b600080fd5b6101f06101eb3660046141ad565b610554565b6040519081526020015b60405180910390f35b610216610211366004613f9c565b610583565b60405190151581526020016101fa565b61022e610596565b6040516101fa919061499d565b61024e610249366004614006565b610628565b6040516101fa9190614810565b61026e610269366004613ecf565b6106b5565b005b61026e6107c6565b61028b610286366004613dd2565b6107d5565b6040516101fa9190614988565b6008546101f0565b61026e6102ae366004614040565b610869565b61026e6102c1366004613d97565b610a7a565b61026e6102d4366004613ca6565b610aab565b6101f06102e7366004613ecf565b610abb565b61026e6102fa3660046140ed565b610b54565b61026e61030d36600461423a565b610c90565b610325610320366004614006565b610d86565b6040516101fa91906148fa565b61026e6103403660046141ad565b610e7c565b61026e610353366004613d97565b610eb4565b6103a76103663660046142ff565b60136020908152600092835260409092208151808301840180519281529084019290930191909120915280546001909101546001600160a01b039091169082565b604080516001600160a01b0390931683526020830191909152016101fa565b6103256103d4366004614006565b610ecf565b6101f06103e7366004614006565b610fbe565b61024e6103fa366004614006565b61105f565b61026e61040d366004614143565b6110d6565b6101f0610420366004613ca6565b611218565b61026e61129f565b61044061043b36600461401e565b6112d8565b6040516101fa9190614947565b61024e6113fe565b61022e61140d565b61026e61046b366004613e99565b61141c565b6101f061047e3660046141ad565b6114ea565b61026e6104913660046142bb565b61152f565b61026e6104a4366004613dd2565b611598565b61028b6104b7366004613cf2565b6115ca565b6104406104ca36600461401e565b61160b565b61022e6104dd366004614006565b611729565b61022e6104f0366004614006565b611a19565b61026e6105033660046142ff565b611c83565b610216610516366004613cc0565b611cb4565b61028b610529366004613e37565b611ce2565b61026e61053c366004613ca6565b611d19565b61026e61054f3660046141d1565b611db6565b6000928352600c602090815260408085206001600160a01b039490941685529281528284209184525290205490565b600061058e82611e4e565b90505b919050565b6060600080546105a590614da3565b80601f01602080910402602001604051908101604052809291908181526020018280546105d190614da3565b801561061e5780601f106105f35761010080835404028352916020019161061e565b820191906000526020600020905b81548152906001019060200180831161060157829003601f168201915b5050505050905090565b600061063382611e73565b6106995760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006106c08261105f565b9050806001600160a01b0316836001600160a01b0316141561072e5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610690565b336001600160a01b038216148061074a575061074a8133610516565b6107b75760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610690565b6107c18383611e90565b505050565b6107d3336008545b611efe565b565b60006001600160a01b03851630146108525760405162461bcd60e51b815260206004820152603a60248201527f416476656e74757265723a204f6e6c792074686520416476656e74757265722060448201527931b7b73a3930b1ba1031b0b710383ab6361034ba32b6b99034b760311b6064820152608401610690565b61085e85858585611f1c565b90505b949350505050565b81518351146108ca5760405162461bcd60e51b815260206004820152602760248201527f4552433939383a2069647320616e6420616d6f756e7473206c656e677468206d6044820152660d2e6dac2e8c6d60cb1b6064820152608401610690565b6001600160a01b0385166108f05760405162461bcd60e51b815260040161069090614b12565b33806108fb8861105f565b6001600160a01b0316148061091d575061091d6109178861105f565b82611cb4565b6109395760405162461bcd60e51b8152600401610690906149b0565b60005b84518110156109bc57600085828151811061096757634e487b7160e01b600052603260045260246000fd5b60200260200101519050600085838151811061099357634e487b7160e01b600052603260045260246000fd5b602002602001015190506109a98a898484611fbf565b5050806109b590614dde565b905061093c565b50604051631759616b60e11b81526001600160a01b03861690632eb2c2d6906109f19030908a90899089908990600401614824565b600060405180830381600087803b158015610a0b57600080fd5b505af1158015610a1f573d6000803e3d6000fd5b50505050846001600160a01b0316866001600160a01b0316887f83730c6482dabefeeec86d872d92bcd6a09df1ca6b3a6cbb17d07591339f15db8787604051610a6992919061495a565b60405180910390a450505050505050565b610a843382612123565b610aa05760405162461bcd60e51b815260040161069090614bd9565b6107c18383836121e5565b610ab8816107ce60085490565b50565b6000610ac683611218565b8210610b285760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610690565b506001600160a01b03821660009081526006602090815260408083208484529091529020545b92915050565b6001600160a01b038416610b7a5760405162461bcd60e51b815260040161069090614b12565b3380610b858761105f565b6001600160a01b03161480610ba15750610ba16109178761105f565b610bbd5760405162461bcd60e51b8152600401610690906149b0565b610bcb81878787878761237e565b610bd6868585612383565b604051635c46a7ef60e11b81526001600160a01b0385169063b88d4fde90610c08903090899088908890600401614882565b600060405180830381600087803b158015610c2257600080fd5b505af1158015610c36573d6000803e3d6000fd5b50505050836001600160a01b0316856001600160a01b0316877f9246785543aff8b5b156e5909aebd5d321e61df5e10c6670a43c1c4e78e3cedf86604051610c8091815260200190565b60405180910390a4505050505050565b83610c9b3382612123565b610cb75760405162461bcd60e51b815260040161069090614c2a565b60005b8451811015610d2e57610d1c86868381518110610ce757634e487b7160e01b600052603260045260246000fd5b6020026020010151868481518110610d0f57634e487b7160e01b600052603260045260246000fd5b602002602001015161248f565b80610d2681614dde565b915050610cba565b5060005b8251811015610d7e57610d6c86848381518110610d5f57634e487b7160e01b600052603260045260246000fd5b60200260200101516127e9565b80610d7681614dde565b915050610d32565b505050505050565b600081815260106020526040812060609190610da1906128d2565b6001600160401b03811115610dc657634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610def578160200160208202803683370190505b50905060005b6000848152601060205260409020610e0c906128d2565b811015610e75576000848152601060205260409020610e2b90826128dc565b828281518110610e4b57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039092166020928302919091019091015280610e6d81614dde565b915050610df5565b5092915050565b82610e873382612123565b610ea35760405162461bcd60e51b815260040161069090614c2a565b610eae84848461248f565b50505050565b6107c183838360405180602001604052806000815250611598565b6000818152600e6020526040812060609190610eea906128d2565b6001600160401b03811115610f0f57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610f38578160200160208202803683370190505b50905060005b6000848152600e60205260409020610f55906128d2565b811015610e75576000848152600e60205260409020610f7490826128dc565b828281518110610f9457634e487b7160e01b600052603260045260246000fd5b6001600160a01b039092166020928302919091019091015280610fb681614dde565b915050610f3e565b6000610fc960085490565b821061102c5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610690565b6008828154811061104d57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b03168061058e5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610690565b6001600160a01b0385166110fc5760405162461bcd60e51b815260040161069090614b12565b33806111078861105f565b6001600160a01b0316148061112357506111236109178861105f565b61113f5760405162461bcd60e51b8152600401610690906149b0565b6111588188888861114f896128ef565b610d7e896128ef565b61116487868686611fbf565b604051637921219560e11b81526001600160a01b0386169063f242432a906111989030908a908990899089906004016148b5565b600060405180830381600087803b1580156111b257600080fd5b505af11580156111c6573d6000803e3d6000fd5b50505050846001600160a01b0316866001600160a01b0316887ea198470a602f1d156b20e41b65b907ab137359caceff40e0205ff1858b81fc8787604051610a69929190918252602082015260400190565b60006001600160a01b0382166112835760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610690565b506001600160a01b031660009081526003602052604090205490565b336112a86113fe565b6001600160a01b0316146112ce5760405162461bcd60e51b815260040161069090614ba4565b6107d36000612948565b60008281526011602090815260408083206001600160a01b0385168452909152812060609190611307906128d2565b6001600160401b0381111561132c57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611355578160200160208202803683370190505b50905060005b60008581526011602090815260408083206001600160a01b03881684529091529020611386906128d2565b8110156113f65760008581526011602090815260408083206001600160a01b038816845290915290206113b990826128dc565b8282815181106113d957634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806113ee81614dde565b91505061135b565b509392505050565b6012546001600160a01b031690565b6060600180546105a590614da3565b6001600160a01b0382163314156114715760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610690565b3360008181526005602090815260408083206001600160a01b0387168085529252909120805460ff1916841515179055906001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516114de911515815260200190565b60405180910390a35050565b6000838152600a602090815260408083206001600160a01b03861684529091528120611516908361299a565b611521576000611524565b60015b60ff16949350505050565b8161153a3382612123565b6115565760405162461bcd60e51b815260040161069090614c2a565b60005b8251811015610eae5761158684848381518110610d5f57634e487b7160e01b600052603260045260246000fd5b8061159081614dde565b915050611559565b6115a23383612123565b6115be5760405162461bcd60e51b815260040161069090614bd9565b610eae848484846129a6565b60006001600160a01b03861630146115f45760405162461bcd60e51b815260040161069090614b56565b61160186868686866129d9565b9695505050505050565b6000828152600f602090815260408083206001600160a01b038516845290915281206060919061163a906128d2565b6001600160401b0381111561165f57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611688578160200160208202803683370190505b50905060005b6000858152600f602090815260408083206001600160a01b038816845290915290206116b9906128d2565b8110156113f6576000858152600f602090815260408083206001600160a01b038816845290915290206116ec90826128dc565b82828151811061170c57634e487b7160e01b600052603260045260246000fd5b60209081029190910101528061172181614dde565b91505061168e565b60606000601460009054906101000a90046001600160a01b03166001600160a01b031663934be0de6040518163ffffffff1660e01b815260040160006040518083038186803b15801561177b57600080fd5b505afa15801561178f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526117b79190810190613ef8565b9050600060405180610100016040528060dc8152602001614f1460dc91399050601460005b83518160ff161015611983576000848260ff168151811061180d57634e487b7160e01b600052603260045260246000fd5b602002602001015190506000601360008981526020019081526020016000208260405161183a91906143bb565b90815260408051918290036020908101832083830190925281546001600160a01b031680845260019092015490830152909150156119315780516020820151604051630efc8a5360e11b815260048101919091526000916001600160a01b031690631df914a69060240160006040518083038186803b1580156118bc57600080fd5b505afa1580156118d0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118f89190810190613fd4565b9050856119078660ff16612b91565b8260405160200161191a93929190614406565b604051602081830303815290604052955050611961565b8461193e8560ff16612b91565b60405160200161194f929190614496565b60405160208183030381529060405294505b61196c601485614d08565b93505050808061197b90614df9565b9150506117dc565b50816040516020016119959190614567565b604051602081830303815290604052915060006119ec6119b487612b91565b6119bd85612cab565b6119c689611a19565b6040516020016119d893929190614620565b604051602081830303815290604052612cab565b9050806040516020016119ff91906147cb565b604051602081830303815290604052945050505050919050565b60408051808201825260018152605b60f81b602082015260145482516349a5f06f60e11b815292516060936000926001600160a01b03169163934be0de916004808201928692909190829003018186803b158015611a7657600080fd5b505afa158015611a8a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ab29190810190613ef8565b9050600160005b82518160ff161015611c58576000838260ff1681518110611aea57634e487b7160e01b600052603260045260246000fd5b6020026020010151905060006013600089815260200190815260200160002082604051611b1791906143bb565b90815260408051918290036020908101832083830190925281546001600160a01b03168084526001909201549083015290915015611c435780516020820151604051630efc8a5360e11b815260048101919091526000916001600160a01b031690631df914a69060240160006040518083038186803b158015611b9957600080fd5b505afa158015611bad573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611bd59190810190613fd4565b90508415611c135786611be88483612e1e565b604051602001611bf99291906143d7565b604051602081830303815290604052965060009450611c41565b86611c1e8483612e1e565b604051602001611c2f92919061452a565b60405160208183030381529060405296505b505b50508080611c5090614df9565b915050611ab9565b5082604051602001611c6a9190614505565b6040516020818303038152906040529350505050919050565b81611c8e3382612123565b611caa5760405162461bcd60e51b815260040161069090614c2a565b6107c183836127e9565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b60006001600160a01b0386163014611d0c5760405162461bcd60e51b815260040161069090614b56565b6116018686868686612e4a565b33611d226113fe565b6001600160a01b031614611d485760405162461bcd60e51b815260040161069090614ba4565b6001600160a01b038116611dad5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610690565b610ab881612948565b82611dc13382612123565b611ddd5760405162461bcd60e51b815260040161069090614c2a565b60005b8351811015611e4757611e3585858381518110611e0d57634e487b7160e01b600052603260045260246000fd5b6020026020010151858481518110610d0f57634e487b7160e01b600052603260045260246000fd5b80611e3f81614dde565b915050611de0565b5050505050565b60006001600160e01b0319821663780e9d6360e01b148061058e575061058e82612ed7565b6000908152600260205260409020546001600160a01b0316151590565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611ec58261105f565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b611f18828260405180602001604052806000815250612f27565b5050565b60008151602014611f3f5760405162461bcd60e51b815260040161069090614a99565b600080611f4d602036614d60565b905080359150611f5e823387612f5a565b336001600160a01b031682876001600160a01b03167fb00761aee4ba24f247fd2ed53e16133421febde35143e2290cd1d5703dc9102588604051611fa491815260200190565b60405180910390a450630a85bd0160e11b9695505050505050565b80151580611ff757506000848152600c602090815260408083206001600160a01b038716845282528083208584529091529020548111155b6120135760405162461bcd60e51b815260040161069090614a4a565b6000848152600c602090815260408083206001600160a01b038716845282528083208584529091528120805483929061204d908490614d60565b90915550506000848152600c602090815260408083206001600160a01b03871684528252808320858452909152902054610eae576001600160a01b0383166000908152600d6020908152604080832085845290915290206120ae908561301a565b5060008481526011602090815260408083206001600160a01b038716845290915290206120db908361301a565b5060008481526011602090815260408083206001600160a01b03871684529091529020612107906128d2565b610eae576000848152601060205260409020611e479084613026565b600061212e82611e73565b61218f5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610690565b600061219a8361105f565b9050806001600160a01b0316846001600160a01b031614806121d55750836001600160a01b03166121ca84610628565b6001600160a01b0316145b8061086157506108618185611cb4565b826001600160a01b03166121f88261105f565b6001600160a01b0316146122605760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610690565b6001600160a01b0382166122c25760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610690565b6122cd83838361303b565b6122d8600082611e90565b6001600160a01b0383166000908152600360205260408120805460019290612301908490614d60565b90915550506001600160a01b038216600090815260036020526040812080546001929061232f908490614cf0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b038681169182179092559151849391871691600080516020614ed483398151915291a4505050565b610d7e565b6000838152600a602090815260408083206001600160a01b038616845290915290206123af908261299a565b6123cb5760405162461bcd60e51b815260040161069090614a4a565b6000838152600a602090815260408083206001600160a01b038616845290915290206123f7908261301a565b506001600160a01b0382166000908152600b6020526040902061241a908461301a565b506000838152600f602090815260408083206001600160a01b03861684529091529020612447908261301a565b506000838152600f602090815260408083206001600160a01b03861684529091529020612473906128d2565b6107c1576000838152600e60205260409020610eae9083613026565b601454604051630eaad48960e01b81526001600160a01b0390911690630eaad489906124bf908590600401614810565b60206040518083038186803b1580156124d757600080fd5b505afa1580156124eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250f9190613f80565b6125755760405162461bcd60e51b815260206004820152603160248201527f416476656e74757265723a204974656d20636f6e7472616374206d75737420626044820152706520696e2074686520726567697374727960781b6064820152608401610690565b6040516377539d8d60e11b8152600481018290526000906001600160a01b0384169063eea73b1a9060240160006040518083038186803b1580156125b857600080fd5b505afa1580156125cc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526125f49190810190613fd4565b601454604051631191948d60e21b81529192506001600160a01b03169063464652349061262590849060040161499d565b60206040518083038186803b15801561263d57600080fd5b505afa158015612651573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126759190613f80565b6126c15760405162461bcd60e51b815260206004820152601d60248201527f416476656e74757265723a20496e76616c6964206974656d20747970650000006044820152606401610690565b60008481526013602052604080822090516126dd9084906143bb565b9081526040805160209281900383018120818301835280546001600160a01b0390811680845260019092015485840181905284518086018652918a16825281860189905260008b8152601390965294849020935192955090939290916127449087906143bb565b90815260405160209181900382019020825181546001600160a01b0319166001600160a01b0390911617815591015160019091015561278b876127843390565b8888613046565b6001600160a01b038216156127ae576127ae876127a78961105f565b84846131a2565b84866001600160a01b0316887f1515558d5839d30cdf2367d28e6355b36fba99478182838a504a9e124c8acb4887604051610a69919061499d565b60008281526013602052604080822090516128059084906143bb565b9081526040805160209281900383018120818301835280546001600160a01b0316808352600190910154848301819052600088815260139095529383902092519194509291906128569086906143bb565b90815260405190819003602001902080546001600160a01b03191681556000600190910155612888856127a78161105f565b80826001600160a01b0316867f44f00888e221ee14f2c2a9acaac00b23de632cd3579f849d77f7be2b76e78ad8876040516128c3919061499d565b60405180910390a45050505050565b600061058e825490565b60006128e88383613206565b9392505050565b6040805160018082528183019092526060916000919060208083019080368337019050509050828160008151811061293757634e487b7160e01b600052603260045260246000fd5b602090810291909101015292915050565b601280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006128e8838361323e565b6129b18484846121e5565b6129bd84848484613256565b610eae5760405162461bcd60e51b8152600401610690906149f8565b600081516020146129fc5760405162461bcd60e51b815260040161069090614a99565b8251845114612a5d5760405162461bcd60e51b815260206004820152602760248201527f455243313135353a2069647320616e642076616c756573206c656e677468206d6044820152660d2e6dac2e8c6d60cb1b6064820152608401610690565b600080612a6b602036614d60565b90508035915060005b8651811015612b7c57612ad78333898481518110612aa257634e487b7160e01b600052603260045260246000fd5b6020026020010151898581518110612aca57634e487b7160e01b600052603260045260246000fd5b6020026020010151613360565b336001600160a01b031683896001600160a01b0316600080516020614ef48339815191528a8581518110612b1b57634e487b7160e01b600052603260045260246000fd5b60200260200101518a8681518110612b4357634e487b7160e01b600052603260045260246000fd5b6020026020010151604051612b62929190918252602082015260400190565b60405180910390a480612b7481614dde565b915050612a74565b5063bc197c8160e01b98975050505050505050565b606081612bb657506040805180820190915260018152600360fc1b6020820152610591565b8160005b8115612be05780612bca81614dde565b9150612bd99050600a83614d2d565b9150612bba565b6000816001600160401b03811115612c0857634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612c32576020820181803683370190505b5090505b841561086157612c47600183614d60565b9150612c54600a86614e19565b612c5f906030614cf0565b60f81b818381518110612c8257634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350612ca4600a86614d2d565b9450612c36565b805160609080612ccb575050604080516020810190915260008152610591565b60006003612cda836002614cf0565b612ce49190614d2d565b612cef906004614d41565b90506000612cfe826020614cf0565b6001600160401b03811115612d2357634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612d4d576020820181803683370190505b5090506000604051806060016040528060408152602001614e94604091399050600181016020830160005b86811015612dd9576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b835260049092019101612d78565b506003860660018114612df35760028114612e0457612e10565b613d3d60f01b600119830152612e10565b603d60f81b6000198301525b505050918152949350505050565b60608282604051602001612e33929190614591565b604051602081830303815290604052905092915050565b60008151602014612e6d5760405162461bcd60e51b815260040161069090614a99565b600080612e7b602036614d60565b905080359150612e8d82338888613360565b6040805187815260208101879052339184916001600160a01b038b1691600080516020614ef4833981519152910160405180910390a45063f23a6e6160e01b979650505050505050565b60006001600160e01b031982166380ac58cd60e01b1480612f0857506001600160e01b03198216635b5e139f60e01b145b8061058e57506301ffc9a760e01b6001600160e01b031983161461058e565b612f318383613438565b612f3e6000848484613256565b6107c15760405162461bcd60e51b8152600401610690906149f8565b6000838152600e60205260409020612f729083613564565b612f90576000838152600e60205260409020612f8e9083613579565b505b6000838152600a602090815260408083206001600160a01b03861684529091529020612fbc908261299a565b612fee576000838152600f602090815260408083206001600160a01b03861684529091529020612fec908261358e565b505b6000838152600a602090815260408083206001600160a01b03861684529091529020610eae908261358e565b60006128e8838361359a565b60006128e8836001600160a01b03841661359a565b6107c18383836136b7565b6130606001600160a01b0383166380ac58cd60e01b613774565b156130d657816001600160a01b031663b88d4fde84308461308089613790565b6040518563ffffffff1660e01b815260040161309f9493929190614882565b600060405180830381600087803b1580156130b957600080fd5b505af11580156130cd573d6000803e3d6000fd5b50505050610eae565b6130f06001600160a01b038316636cdb3d1360e11b613774565b1561313257816001600160a01b031663f242432a84308460016131128a613790565b6040518663ffffffff1660e01b815260040161309f9594939291906148b5565b6040805162461bcd60e51b81526020600482015260248101919091527f416476656e74757265723a204974656d20646f6573206e6f7420737570706f7260448201527f74204552432d373231206e6f72204552432d31313535207374616e64617264736064820152608401610690565b6131ad8483836114ea565b600114156131d6576131d18484848460405180602001604052806000815250610b54565b610eae565b60016131e3858484610554565b10610eae57610eae848484846001604051806020016040528060008152506110d6565b600082600001828154811061322b57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b60006001600160a01b0384163b1561335857604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061329a903390899088908890600401614882565b602060405180830381600087803b1580156132b457600080fd5b505af19250505080156132e4575060408051601f3d908101601f191682019092526132e191810190613fb8565b60015b61333e573d808015613312576040519150601f19603f3d011682016040523d82523d6000602084013e613317565b606091505b5080516133365760405162461bcd60e51b8152600401610690906149f8565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610861565b506001610861565b60008481526010602052604090206133789084613564565b6133965760008481526010602052604090206133949084613579565b505b6000848152600c602090815260408083206001600160a01b038716845282528083208584529091529020546133f35760008481526011602090815260408083206001600160a01b038716845290915290206133f1908361358e565b505b6000848152600c602090815260408083206001600160a01b038716845282528083208584529091528120805483929061342d908490614cf0565b909155505050505050565b6001600160a01b03821661348e5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610690565b61349781611e73565b156134e35760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610690565b6134ef6000838361303b565b6001600160a01b0382166000908152600360205260408120805460019290613518908490614cf0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020614ed4833981519152908290a45050565b60006128e8836001600160a01b03841661323e565b60006128e8836001600160a01b0384166137ba565b60006128e883836137ba565b600081815260018301602052604081205480156136ad5760006135be600183614d60565b85549091506000906135d290600190614d60565b905081811461365357600086600001828154811061360057634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508087600001848154811061363157634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b855486908061367257634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610b4e565b6000915050610b4e565b6001600160a01b0383166137125761370d81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b613735565b816001600160a01b0316836001600160a01b031614613735576137358382613804565b6001600160a01b0382166137515761374c816138a1565b6107c1565b826001600160a01b0316826001600160a01b0316146107c1576107c1828261397a565b600061377f836139be565b80156128e857506128e883836139f1565b60408051602080825281830190925260609160208201818036833750505060208101929092525090565b60006137c6838361323e565b6137fc57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b4e565b506000610b4e565b6000600161381184611218565b61381b9190614d60565b60008381526007602052604090205490915080821461386e576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906138b390600190614d60565b600083815260096020526040812054600880549394509092849081106138e957634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050806008838154811061391857634e487b7160e01b600052603260045260246000fd5b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061395e57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b600061398583611218565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b60006139d1826301ffc9a760e01b6139f1565b801561058e57506139ea826001600160e01b03196139f1565b1592915050565b6000806301ffc9a760e01b83604051602401613a0d9190614988565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050509050600080856001600160a01b031661753084604051613a6091906143bb565b6000604051808303818686fa925050503d8060008114613a9c576040519150601f19603f3d011682016040523d82523d6000602084013e613aa1565b606091505b5091509150602081511015613abc5760009350505050610b4e565b8180156116015750808060200190518101906116019190613f80565b80356001600160a01b038116811461059157600080fd5b600082601f830112613aff578081fd5b81356020613b14613b0f83614ca6565b614c76565b80838252828201915082860187848660051b8901011115613b33578586fd5b855b85811015613b5857613b4682613ad8565b84529284019290840190600101613b35565b5090979650505050505050565b600082601f830112613b75578081fd5b81356020613b85613b0f83614ca6565b82815281810190858301855b85811015613b5857613ba8898684358b0101613c17565b84529284019290840190600101613b91565b600082601f830112613bca578081fd5b81356020613bda613b0f83614ca6565b80838252828201915082860187848660051b8901011115613bf9578586fd5b855b85811015613b5857813584529284019290840190600101613bfb565b600082601f830112613c27578081fd5b8135613c35613b0f82614cc9565b818152846020838601011115613c49578283fd5b816020850160208301379081016020019190915292915050565b600082601f830112613c73578081fd5b8151613c81613b0f82614cc9565b818152846020838601011115613c95578283fd5b610861826020830160208701614d77565b600060208284031215613cb7578081fd5b6128e882613ad8565b60008060408385031215613cd2578081fd5b613cdb83613ad8565b9150613ce960208401613ad8565b90509250929050565b600080600080600060a08688031215613d09578081fd5b613d1286613ad8565b9450613d2060208701613ad8565b935060408601356001600160401b0380821115613d3b578283fd5b613d4789838a01613bba565b94506060880135915080821115613d5c578283fd5b613d6889838a01613bba565b93506080880135915080821115613d7d578283fd5b50613d8a88828901613c17565b9150509295509295909350565b600080600060608486031215613dab578081fd5b613db484613ad8565b9250613dc260208501613ad8565b9150604084013590509250925092565b60008060008060808587031215613de7578182fd5b613df085613ad8565b9350613dfe60208601613ad8565b92506040850135915060608501356001600160401b03811115613e1f578182fd5b613e2b87828801613c17565b91505092959194509250565b600080600080600060a08688031215613e4e578283fd5b613e5786613ad8565b9450613e6560208701613ad8565b9350604086013592506060860135915060808601356001600160401b03811115613e8d578182fd5b613d8a88828901613c17565b60008060408385031215613eab578182fd5b613eb483613ad8565b91506020830135613ec481614e6f565b809150509250929050565b60008060408385031215613ee1578182fd5b613eea83613ad8565b946020939093013593505050565b60006020808385031215613f0a578182fd5b82516001600160401b03811115613f1f578283fd5b8301601f81018513613f2f578283fd5b8051613f3d613b0f82614ca6565b81815283810190838501865b84811015613f7257613f608a888451890101613c63565b84529286019290860190600101613f49565b509098975050505050505050565b600060208284031215613f91578081fd5b81516128e881614e6f565b600060208284031215613fad578081fd5b81356128e881614e7d565b600060208284031215613fc9578081fd5b81516128e881614e7d565b600060208284031215613fe5578081fd5b81516001600160401b03811115613ffa578182fd5b61086184828501613c63565b600060208284031215614017578081fd5b5035919050565b60008060408385031215614030578182fd5b82359150613ce960208401613ad8565b60008060008060008060c08789031215614058578384fd5b8635955061406860208801613ad8565b945061407660408801613ad8565b935060608701356001600160401b0380821115614091578283fd5b61409d8a838b01613bba565b945060808901359150808211156140b2578283fd5b6140be8a838b01613bba565b935060a08901359150808211156140d3578283fd5b506140e089828a01613c17565b9150509295509295509295565b600080600080600060a08688031215614104578283fd5b8535945061411460208701613ad8565b935061412260408701613ad8565b92506060860135915060808601356001600160401b03811115613e8d578182fd5b60008060008060008060c0878903121561415b578384fd5b8635955061416b60208801613ad8565b945061417960408801613ad8565b9350606087013592506080870135915060a08701356001600160401b038111156141a1578182fd5b6140e089828a01613c17565b6000806000606084860312156141c1578081fd5b83359250613dc260208501613ad8565b6000806000606084860312156141e5578081fd5b8335925060208401356001600160401b0380821115614202578283fd5b61420e87838801613aef565b93506040860135915080821115614223578283fd5b5061423086828701613bba565b9150509250925092565b6000806000806080858703121561424f578182fd5b8435935060208501356001600160401b038082111561426c578384fd5b61427888838901613aef565b9450604087013591508082111561428d578384fd5b61429988838901613bba565b935060608701359150808211156142ae578283fd5b50613e2b87828801613b65565b600080604083850312156142cd578182fd5b8235915060208301356001600160401b038111156142e9578182fd5b6142f585828601613b65565b9150509250929050565b60008060408385031215614311578182fd5b8235915060208301356001600160401b0381111561432d578182fd5b6142f585828601613c17565b6000815180845260208085019450808401835b838110156143685781518752958201959082019060010161434c565b509495945050505050565b6000815180845261438b816020860160208601614d77565b601f01601f19169290920160200192915050565b600081516143b1818560208601614d77565b9290920192915050565b600082516143cd818460208701614d77565b9190910192915050565b600083516143e9818460208801614d77565b8351908301906143fd818360208801614d77565b01949350505050565b60008451614418818460208901614d77565b6f1e3a32bc3a103c1e91189811103c9e9160811b9083019081528451614445816010840160208901614d77565b6e111031b630b9b99e913130b9b2911f60891b60109290910191820152835161447581601f840160208801614d77565b661e17ba32bc3a1f60c91b601f929091019182015260260195945050505050565b600083516144a8818460208801614d77565b6f1e3a32bc3a103c1e91189811103c9e9160811b90830190815283516144d5816010840160208801614d77565b76111031b630b9b99e913130b9b2911f169e17ba32bc3a1f60491b60109290910191820152602701949350505050565b60008251614517818460208701614d77565b605d60f81b920191825250600101919050565b6000835161453c818460208801614d77565b61016160f51b908301908152835161455b816002840160208801614d77565b01600201949350505050565b60008251614579818460208701614d77565b651e17b9bb339f60d11b920191825250600601919050565b607b60f81b81526e113a3930b4ba2fba3cb832911d101160891b600182015282516000906145c6816010850160208801614d77565b6201116160ed1b60109184019182015269113b30b63ab2911d101160b11b601382015283516145fc81601d840160208801614d77565b601160f91b601d9290910191820152607d60f81b601e820152601f01949350505050565b607b60f81b815274226e616d65223a2022416476656e7475726572202360581b6001820152835160009061465b816016850160208901614d77565b6201116160ed1b6016918401918201527f226465736372697074696f6e223a2022416476656e7475726572732063616e2060198201527f626520657175697070656420616e64207570677261646564207769746820766160398201527f72696f7573204c6f6f746d617274206974656d732e20446966666572656e742060598201527f636f6d62696e6174696f6e73206f66206974656d7320756e6c6f636b2073706560798201527f6369616c206162696c697469657320616e6420706f7765727320666f7220796f60998201527003ab91020b23b32b73a3ab932b91711161607d1b60b98201526116016147be6147b861479b61479561476e60ca87016801134b6b0b3b2911d160bd1b815260090190565b7a0899185d184e9a5b5859d94bdcdd99cade1b5b0ed8985cd94d8d0b602a1b8152601b0190565b8961439f565b7001116101130ba3a3934b13aba32b9911d1607d1b815260110190565b8661439f565b607d60f81b815260010190565b60007f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008252825161480381601d850160208701614d77565b91909101601d0192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a06040820181905260009061485090830186614339565b82810360608401526148628186614339565b905082810360808401526148768185614373565b98975050505050505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061160190830184614373565b6001600160a01b03868116825285166020820152604081018490526060810183905260a0608082018190526000906148ef90830184614373565b979650505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561493b5783516001600160a01b031683529284019291840191600101614916565b50909695505050505050565b6000602082526128e86020830184614339565b60006040825261496d6040830185614339565b828103602084015261497f8185614339565b95945050505050565b6001600160e01b031991909116815260200190565b6000602082526128e86020830184614373565b60208082526028908201527f4552433939383a2063616c6c6572206973206e6f74206f776e6572206e6f7220604082015267185c1c1c9bdd995960c21b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602f908201527f4552433939383a20696e73756666696369656e74206368696c642062616c616e60408201526e31b2903337b9103a3930b739b332b960891b606082015260800190565b60208082526053908201527f4552433939383a2064617461206d75737420636f6e7461696e2074686520756e60408201527f697175652075696e7432353620746f6b656e496420746f207472616e7366657260608201527220746865206368696c6420746f6b656e20746f60681b608082015260a00190565b60208082526024908201527f4552433939383a207472616e7366657220746f20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252602e908201527f4f6e6c792074686520416476656e747572657220636f6e74726163742063616e60408201526d10383ab6361034ba32b6b99034b760911b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252602c908201527f416476656e74757265723a2043616c6c6572206973206e6f74206f776e65722060408201526b1b9bdc88185c1c1c9bdd995960a21b606082015260800190565b604051601f8201601f191681016001600160401b0381118282101715614c9e57614c9e614e59565b604052919050565b60006001600160401b03821115614cbf57614cbf614e59565b5060051b60200190565b60006001600160401b03821115614ce257614ce2614e59565b50601f01601f191660200190565b60008219821115614d0357614d03614e2d565b500190565b600060ff821660ff84168060ff03821115614d2557614d25614e2d565b019392505050565b600082614d3c57614d3c614e43565b500490565b6000816000190483118215151615614d5b57614d5b614e2d565b500290565b600082821015614d7257614d72614e2d565b500390565b60005b83811015614d92578181015183820152602001614d7a565b83811115610eae5750506000910152565b600181811c90821680614db757607f821691505b60208210811415614dd857634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415614df257614df2614e2d565b5060010190565b600060ff821660ff811415614e1057614e10614e2d565b60010192915050565b600082614e2857614e28614e43565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114610ab857600080fd5b6001600160e01b031981168114610ab857600080fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efd7888948ee7a8c63f452e7acd7a939ceb46066e16f52de72c8fa328e28f2aad13c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f73766722207072657365727665417370656374526174696f3d22784d696e594d696e206d656574222076696577426f783d223020302033353020333530223e3c7374796c653e2e62617365207b2066696c6c3a2077686974653b20666f6e742d66616d696c793a2073657269663b20666f6e742d73697a653a20313470783b207d3c2f7374796c653e3c726563742077696474683d223130302522206865696768743d2231303025222066696c6c3d22626c61636b22202f3ea2646970667358221220e44b7e203d5a9092923fc7e2d9e659413acd1cbab2a7048b6161a53385a76f9064736f6c63430008030033000000000000000000000000bf3138fe4b64a6b0806899167a98d1b9e9b495e4

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101d85760003560e01c806301a00210146101dd57806301ffc9a71461020357806306fdde0314610226578063081812fc1461023b578063095ea7b31461025b5780631249c58b14610270578063150b7a021461027857806318160ddd14610298578063205ec4c2146102a057806323b872dd146102b35780632d9b6f57146102c65780632f745c59146102d95780633181aa49146102ec5780633b25f1af146102ff5780633c8619e4146103125780633fe540a91461033257806342842e0e1461034557806348d0b72c146103585780634cadb51c146103c65780634f6ccce7146103d95780636352211e146103ec57806367b53d75146103ff57806370a0823114610412578063715018a614610425578063782f54231461042d5780638da5cb5b1461044d57806395d89b4114610455578063a22cb4651461045d578063a545da3914610470578063af0bdfea14610483578063b88d4fde14610496578063bc197c81146104a9578063bd1dd40b146104bc578063c87b56dd146104cf578063d05dcc6a146104e2578063d50efd70146104f5578063e985e9c514610508578063f23a6e611461051b578063f2fde38b1461052e578063ff297a0e14610541575b600080fd5b6101f06101eb3660046141ad565b610554565b6040519081526020015b60405180910390f35b610216610211366004613f9c565b610583565b60405190151581526020016101fa565b61022e610596565b6040516101fa919061499d565b61024e610249366004614006565b610628565b6040516101fa9190614810565b61026e610269366004613ecf565b6106b5565b005b61026e6107c6565b61028b610286366004613dd2565b6107d5565b6040516101fa9190614988565b6008546101f0565b61026e6102ae366004614040565b610869565b61026e6102c1366004613d97565b610a7a565b61026e6102d4366004613ca6565b610aab565b6101f06102e7366004613ecf565b610abb565b61026e6102fa3660046140ed565b610b54565b61026e61030d36600461423a565b610c90565b610325610320366004614006565b610d86565b6040516101fa91906148fa565b61026e6103403660046141ad565b610e7c565b61026e610353366004613d97565b610eb4565b6103a76103663660046142ff565b60136020908152600092835260409092208151808301840180519281529084019290930191909120915280546001909101546001600160a01b039091169082565b604080516001600160a01b0390931683526020830191909152016101fa565b6103256103d4366004614006565b610ecf565b6101f06103e7366004614006565b610fbe565b61024e6103fa366004614006565b61105f565b61026e61040d366004614143565b6110d6565b6101f0610420366004613ca6565b611218565b61026e61129f565b61044061043b36600461401e565b6112d8565b6040516101fa9190614947565b61024e6113fe565b61022e61140d565b61026e61046b366004613e99565b61141c565b6101f061047e3660046141ad565b6114ea565b61026e6104913660046142bb565b61152f565b61026e6104a4366004613dd2565b611598565b61028b6104b7366004613cf2565b6115ca565b6104406104ca36600461401e565b61160b565b61022e6104dd366004614006565b611729565b61022e6104f0366004614006565b611a19565b61026e6105033660046142ff565b611c83565b610216610516366004613cc0565b611cb4565b61028b610529366004613e37565b611ce2565b61026e61053c366004613ca6565b611d19565b61026e61054f3660046141d1565b611db6565b6000928352600c602090815260408085206001600160a01b039490941685529281528284209184525290205490565b600061058e82611e4e565b90505b919050565b6060600080546105a590614da3565b80601f01602080910402602001604051908101604052809291908181526020018280546105d190614da3565b801561061e5780601f106105f35761010080835404028352916020019161061e565b820191906000526020600020905b81548152906001019060200180831161060157829003601f168201915b5050505050905090565b600061063382611e73565b6106995760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006106c08261105f565b9050806001600160a01b0316836001600160a01b0316141561072e5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610690565b336001600160a01b038216148061074a575061074a8133610516565b6107b75760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610690565b6107c18383611e90565b505050565b6107d3336008545b611efe565b565b60006001600160a01b03851630146108525760405162461bcd60e51b815260206004820152603a60248201527f416476656e74757265723a204f6e6c792074686520416476656e74757265722060448201527931b7b73a3930b1ba1031b0b710383ab6361034ba32b6b99034b760311b6064820152608401610690565b61085e85858585611f1c565b90505b949350505050565b81518351146108ca5760405162461bcd60e51b815260206004820152602760248201527f4552433939383a2069647320616e6420616d6f756e7473206c656e677468206d6044820152660d2e6dac2e8c6d60cb1b6064820152608401610690565b6001600160a01b0385166108f05760405162461bcd60e51b815260040161069090614b12565b33806108fb8861105f565b6001600160a01b0316148061091d575061091d6109178861105f565b82611cb4565b6109395760405162461bcd60e51b8152600401610690906149b0565b60005b84518110156109bc57600085828151811061096757634e487b7160e01b600052603260045260246000fd5b60200260200101519050600085838151811061099357634e487b7160e01b600052603260045260246000fd5b602002602001015190506109a98a898484611fbf565b5050806109b590614dde565b905061093c565b50604051631759616b60e11b81526001600160a01b03861690632eb2c2d6906109f19030908a90899089908990600401614824565b600060405180830381600087803b158015610a0b57600080fd5b505af1158015610a1f573d6000803e3d6000fd5b50505050846001600160a01b0316866001600160a01b0316887f83730c6482dabefeeec86d872d92bcd6a09df1ca6b3a6cbb17d07591339f15db8787604051610a6992919061495a565b60405180910390a450505050505050565b610a843382612123565b610aa05760405162461bcd60e51b815260040161069090614bd9565b6107c18383836121e5565b610ab8816107ce60085490565b50565b6000610ac683611218565b8210610b285760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610690565b506001600160a01b03821660009081526006602090815260408083208484529091529020545b92915050565b6001600160a01b038416610b7a5760405162461bcd60e51b815260040161069090614b12565b3380610b858761105f565b6001600160a01b03161480610ba15750610ba16109178761105f565b610bbd5760405162461bcd60e51b8152600401610690906149b0565b610bcb81878787878761237e565b610bd6868585612383565b604051635c46a7ef60e11b81526001600160a01b0385169063b88d4fde90610c08903090899088908890600401614882565b600060405180830381600087803b158015610c2257600080fd5b505af1158015610c36573d6000803e3d6000fd5b50505050836001600160a01b0316856001600160a01b0316877f9246785543aff8b5b156e5909aebd5d321e61df5e10c6670a43c1c4e78e3cedf86604051610c8091815260200190565b60405180910390a4505050505050565b83610c9b3382612123565b610cb75760405162461bcd60e51b815260040161069090614c2a565b60005b8451811015610d2e57610d1c86868381518110610ce757634e487b7160e01b600052603260045260246000fd5b6020026020010151868481518110610d0f57634e487b7160e01b600052603260045260246000fd5b602002602001015161248f565b80610d2681614dde565b915050610cba565b5060005b8251811015610d7e57610d6c86848381518110610d5f57634e487b7160e01b600052603260045260246000fd5b60200260200101516127e9565b80610d7681614dde565b915050610d32565b505050505050565b600081815260106020526040812060609190610da1906128d2565b6001600160401b03811115610dc657634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610def578160200160208202803683370190505b50905060005b6000848152601060205260409020610e0c906128d2565b811015610e75576000848152601060205260409020610e2b90826128dc565b828281518110610e4b57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039092166020928302919091019091015280610e6d81614dde565b915050610df5565b5092915050565b82610e873382612123565b610ea35760405162461bcd60e51b815260040161069090614c2a565b610eae84848461248f565b50505050565b6107c183838360405180602001604052806000815250611598565b6000818152600e6020526040812060609190610eea906128d2565b6001600160401b03811115610f0f57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610f38578160200160208202803683370190505b50905060005b6000848152600e60205260409020610f55906128d2565b811015610e75576000848152600e60205260409020610f7490826128dc565b828281518110610f9457634e487b7160e01b600052603260045260246000fd5b6001600160a01b039092166020928302919091019091015280610fb681614dde565b915050610f3e565b6000610fc960085490565b821061102c5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610690565b6008828154811061104d57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b03168061058e5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610690565b6001600160a01b0385166110fc5760405162461bcd60e51b815260040161069090614b12565b33806111078861105f565b6001600160a01b0316148061112357506111236109178861105f565b61113f5760405162461bcd60e51b8152600401610690906149b0565b6111588188888861114f896128ef565b610d7e896128ef565b61116487868686611fbf565b604051637921219560e11b81526001600160a01b0386169063f242432a906111989030908a908990899089906004016148b5565b600060405180830381600087803b1580156111b257600080fd5b505af11580156111c6573d6000803e3d6000fd5b50505050846001600160a01b0316866001600160a01b0316887ea198470a602f1d156b20e41b65b907ab137359caceff40e0205ff1858b81fc8787604051610a69929190918252602082015260400190565b60006001600160a01b0382166112835760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610690565b506001600160a01b031660009081526003602052604090205490565b336112a86113fe565b6001600160a01b0316146112ce5760405162461bcd60e51b815260040161069090614ba4565b6107d36000612948565b60008281526011602090815260408083206001600160a01b0385168452909152812060609190611307906128d2565b6001600160401b0381111561132c57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611355578160200160208202803683370190505b50905060005b60008581526011602090815260408083206001600160a01b03881684529091529020611386906128d2565b8110156113f65760008581526011602090815260408083206001600160a01b038816845290915290206113b990826128dc565b8282815181106113d957634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806113ee81614dde565b91505061135b565b509392505050565b6012546001600160a01b031690565b6060600180546105a590614da3565b6001600160a01b0382163314156114715760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610690565b3360008181526005602090815260408083206001600160a01b0387168085529252909120805460ff1916841515179055906001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516114de911515815260200190565b60405180910390a35050565b6000838152600a602090815260408083206001600160a01b03861684529091528120611516908361299a565b611521576000611524565b60015b60ff16949350505050565b8161153a3382612123565b6115565760405162461bcd60e51b815260040161069090614c2a565b60005b8251811015610eae5761158684848381518110610d5f57634e487b7160e01b600052603260045260246000fd5b8061159081614dde565b915050611559565b6115a23383612123565b6115be5760405162461bcd60e51b815260040161069090614bd9565b610eae848484846129a6565b60006001600160a01b03861630146115f45760405162461bcd60e51b815260040161069090614b56565b61160186868686866129d9565b9695505050505050565b6000828152600f602090815260408083206001600160a01b038516845290915281206060919061163a906128d2565b6001600160401b0381111561165f57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611688578160200160208202803683370190505b50905060005b6000858152600f602090815260408083206001600160a01b038816845290915290206116b9906128d2565b8110156113f6576000858152600f602090815260408083206001600160a01b038816845290915290206116ec90826128dc565b82828151811061170c57634e487b7160e01b600052603260045260246000fd5b60209081029190910101528061172181614dde565b91505061168e565b60606000601460009054906101000a90046001600160a01b03166001600160a01b031663934be0de6040518163ffffffff1660e01b815260040160006040518083038186803b15801561177b57600080fd5b505afa15801561178f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526117b79190810190613ef8565b9050600060405180610100016040528060dc8152602001614f1460dc91399050601460005b83518160ff161015611983576000848260ff168151811061180d57634e487b7160e01b600052603260045260246000fd5b602002602001015190506000601360008981526020019081526020016000208260405161183a91906143bb565b90815260408051918290036020908101832083830190925281546001600160a01b031680845260019092015490830152909150156119315780516020820151604051630efc8a5360e11b815260048101919091526000916001600160a01b031690631df914a69060240160006040518083038186803b1580156118bc57600080fd5b505afa1580156118d0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118f89190810190613fd4565b9050856119078660ff16612b91565b8260405160200161191a93929190614406565b604051602081830303815290604052955050611961565b8461193e8560ff16612b91565b60405160200161194f929190614496565b60405160208183030381529060405294505b61196c601485614d08565b93505050808061197b90614df9565b9150506117dc565b50816040516020016119959190614567565b604051602081830303815290604052915060006119ec6119b487612b91565b6119bd85612cab565b6119c689611a19565b6040516020016119d893929190614620565b604051602081830303815290604052612cab565b9050806040516020016119ff91906147cb565b604051602081830303815290604052945050505050919050565b60408051808201825260018152605b60f81b602082015260145482516349a5f06f60e11b815292516060936000926001600160a01b03169163934be0de916004808201928692909190829003018186803b158015611a7657600080fd5b505afa158015611a8a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ab29190810190613ef8565b9050600160005b82518160ff161015611c58576000838260ff1681518110611aea57634e487b7160e01b600052603260045260246000fd5b6020026020010151905060006013600089815260200190815260200160002082604051611b1791906143bb565b90815260408051918290036020908101832083830190925281546001600160a01b03168084526001909201549083015290915015611c435780516020820151604051630efc8a5360e11b815260048101919091526000916001600160a01b031690631df914a69060240160006040518083038186803b158015611b9957600080fd5b505afa158015611bad573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611bd59190810190613fd4565b90508415611c135786611be88483612e1e565b604051602001611bf99291906143d7565b604051602081830303815290604052965060009450611c41565b86611c1e8483612e1e565b604051602001611c2f92919061452a565b60405160208183030381529060405296505b505b50508080611c5090614df9565b915050611ab9565b5082604051602001611c6a9190614505565b6040516020818303038152906040529350505050919050565b81611c8e3382612123565b611caa5760405162461bcd60e51b815260040161069090614c2a565b6107c183836127e9565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b60006001600160a01b0386163014611d0c5760405162461bcd60e51b815260040161069090614b56565b6116018686868686612e4a565b33611d226113fe565b6001600160a01b031614611d485760405162461bcd60e51b815260040161069090614ba4565b6001600160a01b038116611dad5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610690565b610ab881612948565b82611dc13382612123565b611ddd5760405162461bcd60e51b815260040161069090614c2a565b60005b8351811015611e4757611e3585858381518110611e0d57634e487b7160e01b600052603260045260246000fd5b6020026020010151858481518110610d0f57634e487b7160e01b600052603260045260246000fd5b80611e3f81614dde565b915050611de0565b5050505050565b60006001600160e01b0319821663780e9d6360e01b148061058e575061058e82612ed7565b6000908152600260205260409020546001600160a01b0316151590565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611ec58261105f565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b611f18828260405180602001604052806000815250612f27565b5050565b60008151602014611f3f5760405162461bcd60e51b815260040161069090614a99565b600080611f4d602036614d60565b905080359150611f5e823387612f5a565b336001600160a01b031682876001600160a01b03167fb00761aee4ba24f247fd2ed53e16133421febde35143e2290cd1d5703dc9102588604051611fa491815260200190565b60405180910390a450630a85bd0160e11b9695505050505050565b80151580611ff757506000848152600c602090815260408083206001600160a01b038716845282528083208584529091529020548111155b6120135760405162461bcd60e51b815260040161069090614a4a565b6000848152600c602090815260408083206001600160a01b038716845282528083208584529091528120805483929061204d908490614d60565b90915550506000848152600c602090815260408083206001600160a01b03871684528252808320858452909152902054610eae576001600160a01b0383166000908152600d6020908152604080832085845290915290206120ae908561301a565b5060008481526011602090815260408083206001600160a01b038716845290915290206120db908361301a565b5060008481526011602090815260408083206001600160a01b03871684529091529020612107906128d2565b610eae576000848152601060205260409020611e479084613026565b600061212e82611e73565b61218f5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610690565b600061219a8361105f565b9050806001600160a01b0316846001600160a01b031614806121d55750836001600160a01b03166121ca84610628565b6001600160a01b0316145b8061086157506108618185611cb4565b826001600160a01b03166121f88261105f565b6001600160a01b0316146122605760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610690565b6001600160a01b0382166122c25760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610690565b6122cd83838361303b565b6122d8600082611e90565b6001600160a01b0383166000908152600360205260408120805460019290612301908490614d60565b90915550506001600160a01b038216600090815260036020526040812080546001929061232f908490614cf0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b038681169182179092559151849391871691600080516020614ed483398151915291a4505050565b610d7e565b6000838152600a602090815260408083206001600160a01b038616845290915290206123af908261299a565b6123cb5760405162461bcd60e51b815260040161069090614a4a565b6000838152600a602090815260408083206001600160a01b038616845290915290206123f7908261301a565b506001600160a01b0382166000908152600b6020526040902061241a908461301a565b506000838152600f602090815260408083206001600160a01b03861684529091529020612447908261301a565b506000838152600f602090815260408083206001600160a01b03861684529091529020612473906128d2565b6107c1576000838152600e60205260409020610eae9083613026565b601454604051630eaad48960e01b81526001600160a01b0390911690630eaad489906124bf908590600401614810565b60206040518083038186803b1580156124d757600080fd5b505afa1580156124eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250f9190613f80565b6125755760405162461bcd60e51b815260206004820152603160248201527f416476656e74757265723a204974656d20636f6e7472616374206d75737420626044820152706520696e2074686520726567697374727960781b6064820152608401610690565b6040516377539d8d60e11b8152600481018290526000906001600160a01b0384169063eea73b1a9060240160006040518083038186803b1580156125b857600080fd5b505afa1580156125cc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526125f49190810190613fd4565b601454604051631191948d60e21b81529192506001600160a01b03169063464652349061262590849060040161499d565b60206040518083038186803b15801561263d57600080fd5b505afa158015612651573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126759190613f80565b6126c15760405162461bcd60e51b815260206004820152601d60248201527f416476656e74757265723a20496e76616c6964206974656d20747970650000006044820152606401610690565b60008481526013602052604080822090516126dd9084906143bb565b9081526040805160209281900383018120818301835280546001600160a01b0390811680845260019092015485840181905284518086018652918a16825281860189905260008b8152601390965294849020935192955090939290916127449087906143bb565b90815260405160209181900382019020825181546001600160a01b0319166001600160a01b0390911617815591015160019091015561278b876127843390565b8888613046565b6001600160a01b038216156127ae576127ae876127a78961105f565b84846131a2565b84866001600160a01b0316887f1515558d5839d30cdf2367d28e6355b36fba99478182838a504a9e124c8acb4887604051610a69919061499d565b60008281526013602052604080822090516128059084906143bb565b9081526040805160209281900383018120818301835280546001600160a01b0316808352600190910154848301819052600088815260139095529383902092519194509291906128569086906143bb565b90815260405190819003602001902080546001600160a01b03191681556000600190910155612888856127a78161105f565b80826001600160a01b0316867f44f00888e221ee14f2c2a9acaac00b23de632cd3579f849d77f7be2b76e78ad8876040516128c3919061499d565b60405180910390a45050505050565b600061058e825490565b60006128e88383613206565b9392505050565b6040805160018082528183019092526060916000919060208083019080368337019050509050828160008151811061293757634e487b7160e01b600052603260045260246000fd5b602090810291909101015292915050565b601280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006128e8838361323e565b6129b18484846121e5565b6129bd84848484613256565b610eae5760405162461bcd60e51b8152600401610690906149f8565b600081516020146129fc5760405162461bcd60e51b815260040161069090614a99565b8251845114612a5d5760405162461bcd60e51b815260206004820152602760248201527f455243313135353a2069647320616e642076616c756573206c656e677468206d6044820152660d2e6dac2e8c6d60cb1b6064820152608401610690565b600080612a6b602036614d60565b90508035915060005b8651811015612b7c57612ad78333898481518110612aa257634e487b7160e01b600052603260045260246000fd5b6020026020010151898581518110612aca57634e487b7160e01b600052603260045260246000fd5b6020026020010151613360565b336001600160a01b031683896001600160a01b0316600080516020614ef48339815191528a8581518110612b1b57634e487b7160e01b600052603260045260246000fd5b60200260200101518a8681518110612b4357634e487b7160e01b600052603260045260246000fd5b6020026020010151604051612b62929190918252602082015260400190565b60405180910390a480612b7481614dde565b915050612a74565b5063bc197c8160e01b98975050505050505050565b606081612bb657506040805180820190915260018152600360fc1b6020820152610591565b8160005b8115612be05780612bca81614dde565b9150612bd99050600a83614d2d565b9150612bba565b6000816001600160401b03811115612c0857634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612c32576020820181803683370190505b5090505b841561086157612c47600183614d60565b9150612c54600a86614e19565b612c5f906030614cf0565b60f81b818381518110612c8257634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350612ca4600a86614d2d565b9450612c36565b805160609080612ccb575050604080516020810190915260008152610591565b60006003612cda836002614cf0565b612ce49190614d2d565b612cef906004614d41565b90506000612cfe826020614cf0565b6001600160401b03811115612d2357634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612d4d576020820181803683370190505b5090506000604051806060016040528060408152602001614e94604091399050600181016020830160005b86811015612dd9576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b835260049092019101612d78565b506003860660018114612df35760028114612e0457612e10565b613d3d60f01b600119830152612e10565b603d60f81b6000198301525b505050918152949350505050565b60608282604051602001612e33929190614591565b604051602081830303815290604052905092915050565b60008151602014612e6d5760405162461bcd60e51b815260040161069090614a99565b600080612e7b602036614d60565b905080359150612e8d82338888613360565b6040805187815260208101879052339184916001600160a01b038b1691600080516020614ef4833981519152910160405180910390a45063f23a6e6160e01b979650505050505050565b60006001600160e01b031982166380ac58cd60e01b1480612f0857506001600160e01b03198216635b5e139f60e01b145b8061058e57506301ffc9a760e01b6001600160e01b031983161461058e565b612f318383613438565b612f3e6000848484613256565b6107c15760405162461bcd60e51b8152600401610690906149f8565b6000838152600e60205260409020612f729083613564565b612f90576000838152600e60205260409020612f8e9083613579565b505b6000838152600a602090815260408083206001600160a01b03861684529091529020612fbc908261299a565b612fee576000838152600f602090815260408083206001600160a01b03861684529091529020612fec908261358e565b505b6000838152600a602090815260408083206001600160a01b03861684529091529020610eae908261358e565b60006128e8838361359a565b60006128e8836001600160a01b03841661359a565b6107c18383836136b7565b6130606001600160a01b0383166380ac58cd60e01b613774565b156130d657816001600160a01b031663b88d4fde84308461308089613790565b6040518563ffffffff1660e01b815260040161309f9493929190614882565b600060405180830381600087803b1580156130b957600080fd5b505af11580156130cd573d6000803e3d6000fd5b50505050610eae565b6130f06001600160a01b038316636cdb3d1360e11b613774565b1561313257816001600160a01b031663f242432a84308460016131128a613790565b6040518663ffffffff1660e01b815260040161309f9594939291906148b5565b6040805162461bcd60e51b81526020600482015260248101919091527f416476656e74757265723a204974656d20646f6573206e6f7420737570706f7260448201527f74204552432d373231206e6f72204552432d31313535207374616e64617264736064820152608401610690565b6131ad8483836114ea565b600114156131d6576131d18484848460405180602001604052806000815250610b54565b610eae565b60016131e3858484610554565b10610eae57610eae848484846001604051806020016040528060008152506110d6565b600082600001828154811061322b57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b60006001600160a01b0384163b1561335857604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061329a903390899088908890600401614882565b602060405180830381600087803b1580156132b457600080fd5b505af19250505080156132e4575060408051601f3d908101601f191682019092526132e191810190613fb8565b60015b61333e573d808015613312576040519150601f19603f3d011682016040523d82523d6000602084013e613317565b606091505b5080516133365760405162461bcd60e51b8152600401610690906149f8565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610861565b506001610861565b60008481526010602052604090206133789084613564565b6133965760008481526010602052604090206133949084613579565b505b6000848152600c602090815260408083206001600160a01b038716845282528083208584529091529020546133f35760008481526011602090815260408083206001600160a01b038716845290915290206133f1908361358e565b505b6000848152600c602090815260408083206001600160a01b038716845282528083208584529091528120805483929061342d908490614cf0565b909155505050505050565b6001600160a01b03821661348e5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610690565b61349781611e73565b156134e35760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610690565b6134ef6000838361303b565b6001600160a01b0382166000908152600360205260408120805460019290613518908490614cf0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020614ed4833981519152908290a45050565b60006128e8836001600160a01b03841661323e565b60006128e8836001600160a01b0384166137ba565b60006128e883836137ba565b600081815260018301602052604081205480156136ad5760006135be600183614d60565b85549091506000906135d290600190614d60565b905081811461365357600086600001828154811061360057634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508087600001848154811061363157634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b855486908061367257634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610b4e565b6000915050610b4e565b6001600160a01b0383166137125761370d81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b613735565b816001600160a01b0316836001600160a01b031614613735576137358382613804565b6001600160a01b0382166137515761374c816138a1565b6107c1565b826001600160a01b0316826001600160a01b0316146107c1576107c1828261397a565b600061377f836139be565b80156128e857506128e883836139f1565b60408051602080825281830190925260609160208201818036833750505060208101929092525090565b60006137c6838361323e565b6137fc57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b4e565b506000610b4e565b6000600161381184611218565b61381b9190614d60565b60008381526007602052604090205490915080821461386e576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906138b390600190614d60565b600083815260096020526040812054600880549394509092849081106138e957634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050806008838154811061391857634e487b7160e01b600052603260045260246000fd5b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061395e57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b600061398583611218565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b60006139d1826301ffc9a760e01b6139f1565b801561058e57506139ea826001600160e01b03196139f1565b1592915050565b6000806301ffc9a760e01b83604051602401613a0d9190614988565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050509050600080856001600160a01b031661753084604051613a6091906143bb565b6000604051808303818686fa925050503d8060008114613a9c576040519150601f19603f3d011682016040523d82523d6000602084013e613aa1565b606091505b5091509150602081511015613abc5760009350505050610b4e565b8180156116015750808060200190518101906116019190613f80565b80356001600160a01b038116811461059157600080fd5b600082601f830112613aff578081fd5b81356020613b14613b0f83614ca6565b614c76565b80838252828201915082860187848660051b8901011115613b33578586fd5b855b85811015613b5857613b4682613ad8565b84529284019290840190600101613b35565b5090979650505050505050565b600082601f830112613b75578081fd5b81356020613b85613b0f83614ca6565b82815281810190858301855b85811015613b5857613ba8898684358b0101613c17565b84529284019290840190600101613b91565b600082601f830112613bca578081fd5b81356020613bda613b0f83614ca6565b80838252828201915082860187848660051b8901011115613bf9578586fd5b855b85811015613b5857813584529284019290840190600101613bfb565b600082601f830112613c27578081fd5b8135613c35613b0f82614cc9565b818152846020838601011115613c49578283fd5b816020850160208301379081016020019190915292915050565b600082601f830112613c73578081fd5b8151613c81613b0f82614cc9565b818152846020838601011115613c95578283fd5b610861826020830160208701614d77565b600060208284031215613cb7578081fd5b6128e882613ad8565b60008060408385031215613cd2578081fd5b613cdb83613ad8565b9150613ce960208401613ad8565b90509250929050565b600080600080600060a08688031215613d09578081fd5b613d1286613ad8565b9450613d2060208701613ad8565b935060408601356001600160401b0380821115613d3b578283fd5b613d4789838a01613bba565b94506060880135915080821115613d5c578283fd5b613d6889838a01613bba565b93506080880135915080821115613d7d578283fd5b50613d8a88828901613c17565b9150509295509295909350565b600080600060608486031215613dab578081fd5b613db484613ad8565b9250613dc260208501613ad8565b9150604084013590509250925092565b60008060008060808587031215613de7578182fd5b613df085613ad8565b9350613dfe60208601613ad8565b92506040850135915060608501356001600160401b03811115613e1f578182fd5b613e2b87828801613c17565b91505092959194509250565b600080600080600060a08688031215613e4e578283fd5b613e5786613ad8565b9450613e6560208701613ad8565b9350604086013592506060860135915060808601356001600160401b03811115613e8d578182fd5b613d8a88828901613c17565b60008060408385031215613eab578182fd5b613eb483613ad8565b91506020830135613ec481614e6f565b809150509250929050565b60008060408385031215613ee1578182fd5b613eea83613ad8565b946020939093013593505050565b60006020808385031215613f0a578182fd5b82516001600160401b03811115613f1f578283fd5b8301601f81018513613f2f578283fd5b8051613f3d613b0f82614ca6565b81815283810190838501865b84811015613f7257613f608a888451890101613c63565b84529286019290860190600101613f49565b509098975050505050505050565b600060208284031215613f91578081fd5b81516128e881614e6f565b600060208284031215613fad578081fd5b81356128e881614e7d565b600060208284031215613fc9578081fd5b81516128e881614e7d565b600060208284031215613fe5578081fd5b81516001600160401b03811115613ffa578182fd5b61086184828501613c63565b600060208284031215614017578081fd5b5035919050565b60008060408385031215614030578182fd5b82359150613ce960208401613ad8565b60008060008060008060c08789031215614058578384fd5b8635955061406860208801613ad8565b945061407660408801613ad8565b935060608701356001600160401b0380821115614091578283fd5b61409d8a838b01613bba565b945060808901359150808211156140b2578283fd5b6140be8a838b01613bba565b935060a08901359150808211156140d3578283fd5b506140e089828a01613c17565b9150509295509295509295565b600080600080600060a08688031215614104578283fd5b8535945061411460208701613ad8565b935061412260408701613ad8565b92506060860135915060808601356001600160401b03811115613e8d578182fd5b60008060008060008060c0878903121561415b578384fd5b8635955061416b60208801613ad8565b945061417960408801613ad8565b9350606087013592506080870135915060a08701356001600160401b038111156141a1578182fd5b6140e089828a01613c17565b6000806000606084860312156141c1578081fd5b83359250613dc260208501613ad8565b6000806000606084860312156141e5578081fd5b8335925060208401356001600160401b0380821115614202578283fd5b61420e87838801613aef565b93506040860135915080821115614223578283fd5b5061423086828701613bba565b9150509250925092565b6000806000806080858703121561424f578182fd5b8435935060208501356001600160401b038082111561426c578384fd5b61427888838901613aef565b9450604087013591508082111561428d578384fd5b61429988838901613bba565b935060608701359150808211156142ae578283fd5b50613e2b87828801613b65565b600080604083850312156142cd578182fd5b8235915060208301356001600160401b038111156142e9578182fd5b6142f585828601613b65565b9150509250929050565b60008060408385031215614311578182fd5b8235915060208301356001600160401b0381111561432d578182fd5b6142f585828601613c17565b6000815180845260208085019450808401835b838110156143685781518752958201959082019060010161434c565b509495945050505050565b6000815180845261438b816020860160208601614d77565b601f01601f19169290920160200192915050565b600081516143b1818560208601614d77565b9290920192915050565b600082516143cd818460208701614d77565b9190910192915050565b600083516143e9818460208801614d77565b8351908301906143fd818360208801614d77565b01949350505050565b60008451614418818460208901614d77565b6f1e3a32bc3a103c1e91189811103c9e9160811b9083019081528451614445816010840160208901614d77565b6e111031b630b9b99e913130b9b2911f60891b60109290910191820152835161447581601f840160208801614d77565b661e17ba32bc3a1f60c91b601f929091019182015260260195945050505050565b600083516144a8818460208801614d77565b6f1e3a32bc3a103c1e91189811103c9e9160811b90830190815283516144d5816010840160208801614d77565b76111031b630b9b99e913130b9b2911f169e17ba32bc3a1f60491b60109290910191820152602701949350505050565b60008251614517818460208701614d77565b605d60f81b920191825250600101919050565b6000835161453c818460208801614d77565b61016160f51b908301908152835161455b816002840160208801614d77565b01600201949350505050565b60008251614579818460208701614d77565b651e17b9bb339f60d11b920191825250600601919050565b607b60f81b81526e113a3930b4ba2fba3cb832911d101160891b600182015282516000906145c6816010850160208801614d77565b6201116160ed1b60109184019182015269113b30b63ab2911d101160b11b601382015283516145fc81601d840160208801614d77565b601160f91b601d9290910191820152607d60f81b601e820152601f01949350505050565b607b60f81b815274226e616d65223a2022416476656e7475726572202360581b6001820152835160009061465b816016850160208901614d77565b6201116160ed1b6016918401918201527f226465736372697074696f6e223a2022416476656e7475726572732063616e2060198201527f626520657175697070656420616e64207570677261646564207769746820766160398201527f72696f7573204c6f6f746d617274206974656d732e20446966666572656e742060598201527f636f6d62696e6174696f6e73206f66206974656d7320756e6c6f636b2073706560798201527f6369616c206162696c697469657320616e6420706f7765727320666f7220796f60998201527003ab91020b23b32b73a3ab932b91711161607d1b60b98201526116016147be6147b861479b61479561476e60ca87016801134b6b0b3b2911d160bd1b815260090190565b7a0899185d184e9a5b5859d94bdcdd99cade1b5b0ed8985cd94d8d0b602a1b8152601b0190565b8961439f565b7001116101130ba3a3934b13aba32b9911d1607d1b815260110190565b8661439f565b607d60f81b815260010190565b60007f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008252825161480381601d850160208701614d77565b91909101601d0192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a06040820181905260009061485090830186614339565b82810360608401526148628186614339565b905082810360808401526148768185614373565b98975050505050505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061160190830184614373565b6001600160a01b03868116825285166020820152604081018490526060810183905260a0608082018190526000906148ef90830184614373565b979650505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561493b5783516001600160a01b031683529284019291840191600101614916565b50909695505050505050565b6000602082526128e86020830184614339565b60006040825261496d6040830185614339565b828103602084015261497f8185614339565b95945050505050565b6001600160e01b031991909116815260200190565b6000602082526128e86020830184614373565b60208082526028908201527f4552433939383a2063616c6c6572206973206e6f74206f776e6572206e6f7220604082015267185c1c1c9bdd995960c21b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602f908201527f4552433939383a20696e73756666696369656e74206368696c642062616c616e60408201526e31b2903337b9103a3930b739b332b960891b606082015260800190565b60208082526053908201527f4552433939383a2064617461206d75737420636f6e7461696e2074686520756e60408201527f697175652075696e7432353620746f6b656e496420746f207472616e7366657260608201527220746865206368696c6420746f6b656e20746f60681b608082015260a00190565b60208082526024908201527f4552433939383a207472616e7366657220746f20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252602e908201527f4f6e6c792074686520416476656e747572657220636f6e74726163742063616e60408201526d10383ab6361034ba32b6b99034b760911b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252602c908201527f416476656e74757265723a2043616c6c6572206973206e6f74206f776e65722060408201526b1b9bdc88185c1c1c9bdd995960a21b606082015260800190565b604051601f8201601f191681016001600160401b0381118282101715614c9e57614c9e614e59565b604052919050565b60006001600160401b03821115614cbf57614cbf614e59565b5060051b60200190565b60006001600160401b03821115614ce257614ce2614e59565b50601f01601f191660200190565b60008219821115614d0357614d03614e2d565b500190565b600060ff821660ff84168060ff03821115614d2557614d25614e2d565b019392505050565b600082614d3c57614d3c614e43565b500490565b6000816000190483118215151615614d5b57614d5b614e2d565b500290565b600082821015614d7257614d72614e2d565b500390565b60005b83811015614d92578181015183820152602001614d7a565b83811115610eae5750506000910152565b600181811c90821680614db757607f821691505b60208210811415614dd857634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415614df257614df2614e2d565b5060010190565b600060ff821660ff811415614e1057614e10614e2d565b60010192915050565b600082614e2857614e28614e43565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114610ab857600080fd5b6001600160e01b031981168114610ab857600080fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efd7888948ee7a8c63f452e7acd7a939ceb46066e16f52de72c8fa328e28f2aad13c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f73766722207072657365727665417370656374526174696f3d22784d696e594d696e206d656574222076696577426f783d223020302033353020333530223e3c7374796c653e2e62617365207b2066696c6c3a2077686974653b20666f6e742d66616d696c793a2073657269663b20666f6e742d73697a653a20313470783b207d3c2f7374796c653e3c726563742077696474683d223130302522206865696768743d2231303025222066696c6c3d22626c61636b22202f3ea2646970667358221220e44b7e203d5a9092923fc7e2d9e659413acd1cbab2a7048b6161a53385a76f9064736f6c63430008030033

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

000000000000000000000000bf3138fe4b64a6b0806899167a98d1b9e9b495e4

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

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000bf3138fe4b64a6b0806899167a98d1b9e9b495e4


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.