Token

 

Overview ERC-1155

Total Supply:
0 N/A

Holders:
122 addresses

Transfers:
-

Loading
[ Download CSV Export  ] 
Loading
Loading

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

Contract Source Code Verified (Exact Match)

Contract Name:
FantumsItem

Compiler Version
v0.6.2+commit.bacdbe57

Optimization Enabled:
Yes with 200 runs

Other Settings:
byzantium EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 1 : FantumsItem.sol
pragma experimental ABIEncoderV2;
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <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 GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }
    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}
// File: @openzeppelin/contracts/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <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: @openzeppelin/contracts/token/ERC721/IERC721.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
/**
 * @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: @openzeppelin/contracts/token/ERC721/IERC721Metadata.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
/**
 * @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: @openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
/**
 * @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: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <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: @openzeppelin/contracts/introspection/ERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
abstract contract ERC165 is IERC165 {
    /*
     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
     */
    bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
    /**
     * @dev Mapping of interface ids to whether or not it's supported.
     */
    mapping(bytes4 => bool) private _supportedInterfaces;
    constructor () internal {
        // Derived contracts need only register support for their own interfaces,
        // we register support for ERC165 itself here
        _registerInterface(_INTERFACE_ID_ERC165);
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     *
     * Time complexity O(1), guaranteed to always use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return _supportedInterfaces[interfaceId];
    }
    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal virtual {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
}
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }
    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }
    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }
    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }
    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }
    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }
    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }
    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }
    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }
    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }
    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }
    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}
// File: @openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <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;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }
    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");
        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }
    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain`call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
    }
    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }
    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }
    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");
        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }
    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }
    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");
        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }
    /**
     * @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");
        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }
    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
// File: @openzeppelin/contracts/utils/EnumerableSet.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <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;
            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
            bytes32 lastvalue = set._values[lastIndex];
            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
            // Delete the slot where the moved value was stored
            set._values.pop();
            // Delete the index for the deleted slot
            delete set._indexes[value];
            return true;
        } else {
            return false;
        }
    }
    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }
    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }
   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }
    // Bytes32Set
    struct Bytes32Set {
        Set _inner;
    }
    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }
    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }
    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }
    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }
   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }
    // AddressSet
    struct AddressSet {
        Set _inner;
    }
    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }
    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }
    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }
    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }
   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }
    // UintSet
    struct UintSet {
        Set _inner;
    }
    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }
    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }
    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }
    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }
   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}
// File: @openzeppelin/contracts/utils/EnumerableMap.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are
 * supported.
 */
library EnumerableMap {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Map type with
    // bytes32 keys and values.
    // The Map implementation uses private functions, and user-facing
    // implementations (such as Uint256ToAddressMap) are just wrappers around
    // the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit
    // in bytes32.
    struct MapEntry {
        bytes32 _key;
        bytes32 _value;
    }
    struct Map {
        // Storage of map keys and values
        MapEntry[] _entries;
        // Position of the entry defined by a key in the `entries` array, plus 1
        // because index 0 means a key is not in the map.
        mapping (bytes32 => uint256) _indexes;
    }
    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {
        // We read and store the key's index to prevent multiple reads from the same storage slot
        uint256 keyIndex = map._indexes[key];
        if (keyIndex == 0) { // Equivalent to !contains(map, key)
            map._entries.push(MapEntry({ _key: key, _value: value }));
            // The entry is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            map._indexes[key] = map._entries.length;
            return true;
        } else {
            map._entries[keyIndex - 1]._value = value;
            return false;
        }
    }
    /**
     * @dev Removes a key-value pair from a map. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function _remove(Map storage map, bytes32 key) private returns (bool) {
        // We read and store the key's index to prevent multiple reads from the same storage slot
        uint256 keyIndex = map._indexes[key];
        if (keyIndex != 0) { // Equivalent to contains(map, key)
            // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one
            // in the array, and then remove the last entry (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.
            uint256 toDeleteIndex = keyIndex - 1;
            uint256 lastIndex = map._entries.length - 1;
            // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
            MapEntry storage lastEntry = map._entries[lastIndex];
            // Move the last entry to the index where the entry to delete is
            map._entries[toDeleteIndex] = lastEntry;
            // Update the index for the moved entry
            map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based
            // Delete the slot where the moved entry was stored
            map._entries.pop();
            // Delete the index for the deleted slot
            delete map._indexes[key];
            return true;
        } else {
            return false;
        }
    }
    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function _contains(Map storage map, bytes32 key) private view returns (bool) {
        return map._indexes[key] != 0;
    }
    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function _length(Map storage map) private view returns (uint256) {
        return map._entries.length;
    }
   /**
    * @dev Returns the key-value pair stored at position `index` in the map. O(1).
    *
    * Note that there are no guarantees on the ordering of entries inside the
    * array, and it may change when more entries are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) {
        require(map._entries.length > index, "EnumerableMap: index out of bounds");
        MapEntry storage entry = map._entries[index];
        return (entry._key, entry._value);
    }
    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     */
    function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) {
        uint256 keyIndex = map._indexes[key];
        if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key)
        return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based
    }
    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function _get(Map storage map, bytes32 key) private view returns (bytes32) {
        uint256 keyIndex = map._indexes[key];
        require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key)
        return map._entries[keyIndex - 1]._value; // All indexes are 1-based
    }
    /**
     * @dev Same as {_get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {_tryGet}.
     */
    function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) {
        uint256 keyIndex = map._indexes[key];
        require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key)
        return map._entries[keyIndex - 1]._value; // All indexes are 1-based
    }
    // UintToAddressMap
    struct UintToAddressMap {
        Map _inner;
    }
    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
        return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
    }
    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
        return _remove(map._inner, bytes32(key));
    }
    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {
        return _contains(map._inner, bytes32(key));
    }
    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(UintToAddressMap storage map) internal view returns (uint256) {
        return _length(map._inner);
    }
   /**
    * @dev Returns the element stored at position `index` in the set. O(1).
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
        (bytes32 key, bytes32 value) = _at(map._inner, index);
        return (uint256(key), address(uint160(uint256(value))));
    }
    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     *
     * _Available since v3.4._
     */
    function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
        (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key));
        return (success, address(uint160(uint256(value))));
    }
    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
        return address(uint160(uint256(_get(map._inner, bytes32(key)))));
    }
    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) {
        return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage))));
    }
}
// File: @openzeppelin/contracts/utils/Strings.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
 * @dev String operations.
 */
library Strings {
    /**
     * @dev Converts a `uint256` to its ASCII `string` representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        uint256 index = digits - 1;
        temp = value;
        while (temp != 0) {
            buffer[index--] = bytes1(uint8(48 + temp % 10));
            temp /= 10;
        }
        return string(buffer);
    }
}
// File: @openzeppelin/contracts/token/ERC721/ERC721.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
 * @title ERC721 Non-Fungible Token Standard basic implementation
 * @dev see https://eips.ethereum.org/EIPS/eip-721
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
    using SafeMath for uint256;
    using Address for address;
    using EnumerableSet for EnumerableSet.UintSet;
    using EnumerableMap for EnumerableMap.UintToAddressMap;
    using Strings for uint256;
    // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
    // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
    bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
    // Mapping from holder address to their (enumerable) set of owned tokens
    mapping (address => EnumerableSet.UintSet) private _holderTokens;
    // Enumerable mapping from token ids to their owners
    EnumerableMap.UintToAddressMap private _tokenOwners;
    // Mapping from token ID to approved address
    mapping (uint256 => address) private _tokenApprovals;
    // Mapping from owner to operator approvals
    mapping (address => mapping (address => bool)) private _operatorApprovals;
    // Token name
    string private _name;
    // Token symbol
    string private _symbol;
    // Optional mapping for token URIs
    mapping (uint256 => string) private _tokenURIs;
    // Base URI
    string private _baseURI;
    /*
     *     bytes4(keccak256('balanceOf(address)')) == 0x70a08231
     *     bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
     *     bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
     *     bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
     *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
     *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
     *     bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
     *
     *     => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
     *        0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
     */
    bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
    /*
     *     bytes4(keccak256('name()')) == 0x06fdde03
     *     bytes4(keccak256('symbol()')) == 0x95d89b41
     *     bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd
     *
     *     => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f
     */
    bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;
    /*
     *     bytes4(keccak256('totalSupply()')) == 0x18160ddd
     *     bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59
     *     bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7
     *
     *     => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63
     */
    bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor (string memory name_, string memory symbol_) public {
        _name = name_;
        _symbol = symbol_;
        // register the supported interfaces to conform to ERC721 via ERC165
        _registerInterface(_INTERFACE_ID_ERC721);
        _registerInterface(_INTERFACE_ID_ERC721_METADATA);
        _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
    }
    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _holderTokens[owner].length();
    }
    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
    }
    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }
    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }
    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
        string memory _tokenURI = _tokenURIs[tokenId];
        string memory base = baseURI();
        // If there is no base URI, return the token URI.
        if (bytes(base).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(base, _tokenURI));
        }
        // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
        return string(abi.encodePacked(base, tokenId.toString()));
    }
    /**
    * @dev Returns the base URI set via {_setBaseURI}. This will be
    * automatically added as a prefix in {tokenURI} to each token's URI, or
    * to the token ID if no specific URI is set for that token ID.
    */
    function baseURI() public view virtual returns (string memory) {
        return _baseURI;
    }
    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        return _holderTokens[owner].at(index);
    }
    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
        return _tokenOwners.length();
    }
    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        (uint256 tokenId, ) = _tokenOwners.at(index);
        return tokenId;
    }
    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");
        require(_msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );
        _approve(to, tokenId);
    }
    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");
        return _tokenApprovals[tokenId];
    }
    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");
        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }
    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }
    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _transfer(from, to, tokenId);
    }
    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }
    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }
    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }
    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _tokenOwners.contains(tokenId);
    }
    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || ERC721.isApprovedForAll(owner, spender));
    }
    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     d*
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }
    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
        _mint(to, tokenId);
        require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }
    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");
        _beforeTokenTransfer(address(0), to, tokenId);
        _holderTokens[to].add(tokenId);
        _tokenOwners.set(tokenId, to);
        emit Transfer(address(0), to, tokenId);
    }
    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId); // internal owner
        _beforeTokenTransfer(owner, address(0), tokenId);
        // Clear approvals
        _approve(address(0), tokenId);
        // Clear metadata (if any)
        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];
        }
        _holderTokens[owner].remove(tokenId);
        _tokenOwners.remove(tokenId);
        emit Transfer(owner, address(0), tokenId);
    }
    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); // internal owner
        require(to != address(0), "ERC721: transfer to the zero address");
        _beforeTokenTransfer(from, to, tokenId);
        // Clear approvals from the previous owner
        _approve(address(0), tokenId);
        _holderTokens[from].remove(tokenId);
        _holderTokens[to].add(tokenId);
        _tokenOwners.set(tokenId, to);
        emit Transfer(from, to, tokenId);
    }
    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }
    /**
     * @dev Internal function to set the base URI for all token IDs. It is
     * automatically added as a prefix to the value returned in {tokenURI},
     * or to the token ID if {tokenURI} is empty.
     */
    function _setBaseURI(string memory baseURI_) internal virtual {
        _baseURI = baseURI_;
    }
    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
        private returns (bool)
    {
        if (!to.isContract()) {
            return true;
        }
        bytes memory returndata = to.functionCall(abi.encodeWithSelector(
            IERC721Receiver(to).onERC721Received.selector,
            _msgSender(),
            from,
            tokenId,
            _data
        ), "ERC721: transfer to non ERC721Receiver implementer");
        bytes4 retval = abi.decode(returndata, (bytes4));
        return (retval == _ERC721_RECEIVED);
    }
    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner
    }
    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);
    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);
    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);
    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);
    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);
    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);
    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: @openzeppelin/contracts/token/ERC20/ERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20 {
    using SafeMath for uint256;
    mapping (address => uint256) private _balances;
    mapping (address => mapping (address => uint256)) private _allowances;
    uint256 private _totalSupply;
    string private _name;
    string private _symbol;
    uint8 private _decimals;
    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_) public {
        _name = name_;
        _symbol = symbol_;
        _decimals = 18;
    }
    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }
    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }
    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
     * called.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return _decimals;
    }
    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }
    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }
    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }
    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }
    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }
    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        return true;
    }
    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
        return true;
    }
    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
        return true;
    }
    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(address sender, address recipient, uint256 amount) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");
        _beforeTokenTransfer(sender, recipient, amount);
        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }
    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");
        _beforeTokenTransfer(address(0), account, amount);
        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }
    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");
        _beforeTokenTransfer(account, address(0), amount);
        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }
    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");
        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }
    /**
     * @dev Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal virtual {
        _decimals = decimals_;
    }
    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens 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 amount) internal virtual { }
}
// File: @openzeppelin/contracts/token/ERC1155/IERC1155.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
/**
 * @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: @openzeppelin/contracts/token/ERC1155/IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
/**
 * @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);
}
// File: @openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
 * _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: @openzeppelin/contracts/token/ERC1155/ERC1155.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
 *
 * @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 SafeMath for uint256;
    using Address for address;
    // Mapping from token ID to account balances
    mapping (uint256 => mapping(address => uint256)) private _balances;
    // Mapping from account to operator approvals
    mapping (address => mapping(address => bool)) private _operatorApprovals;
    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;
    /*
     *     bytes4(keccak256('balanceOf(address,uint256)')) == 0x00fdd58e
     *     bytes4(keccak256('balanceOfBatch(address[],uint256[])')) == 0x4e1273f4
     *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
     *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256,uint256,bytes)')) == 0xf242432a
     *     bytes4(keccak256('safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)')) == 0x2eb2c2d6
     *
     *     => 0x00fdd58e ^ 0x4e1273f4 ^ 0xa22cb465 ^
     *        0xe985e9c5 ^ 0xf242432a ^ 0x2eb2c2d6 == 0xd9b67a26
     */
    bytes4 private constant _INTERFACE_ID_ERC1155 = 0xd9b67a26;
    /*
     *     bytes4(keccak256('uri(uint256)')) == 0x0e89341c
     */
    bytes4 private constant _INTERFACE_ID_ERC1155_METADATA_URI = 0x0e89341c;
    /**
     * @dev See {_setURI}.
     */
    constructor (string memory uri_) public {
        _setURI(uri_);
        // register the supported interfaces to conform to ERC1155 via ERC165
        _registerInterface(_INTERFACE_ID_ERC1155);
        // register the supported interfaces to conform to ERC1155MetadataURI via ERC165
        _registerInterface(_INTERFACE_ID_ERC1155_METADATA_URI);
    }
    /**
     * @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) external 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(to != address(0), "ERC1155: transfer to the zero address");
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );
        address operator = _msgSender();
        _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);
        _balances[id][from] = _balances[id][from].sub(amount, "ERC1155: insufficient balance for transfer");
        _balances[id][to] = _balances[id][to].add(amount);
        emit TransferSingle(operator, from, to, id, amount);
        _doSafeTransferAcceptanceCheck(operator, 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(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: transfer caller is not owner nor approved"
        );
        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];
            _balances[id][from] = _balances[id][from].sub(
                amount,
                "ERC1155: insufficient balance for transfer"
            );
            _balances[id][to] = _balances[id][to].add(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] = _balances[id][account].add(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 (uint i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] = amounts[i].add(_balances[ids[i]][to]);
        }
        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), "");
        _balances[id][account] = _balances[id][account].sub(
            amount,
            "ERC1155: burn amount exceeds balance"
        );
        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 (uint i = 0; i < ids.length; i++) {
            _balances[ids[i]][account] = _balances[ids[i]][account].sub(
                amounts[i],
                "ERC1155: burn amount exceeds balance"
            );
        }
        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(to).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(to).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: @openzeppelin/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
 * @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 () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }
    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }
    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }
    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }
    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}
// File: @openzeppelin/contracts/token/ERC1155/ERC1155Receiver.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
 * @dev _Available since v3.1._
 */
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
    constructor() internal {
        _registerInterface(
            ERC1155Receiver(address(0)).onERC1155Received.selector ^
            ERC1155Receiver(address(0)).onERC1155BatchReceived.selector
        );
    }
}
// File: @openzeppelin/contracts/token/ERC1155/ERC1155Holder.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
 * @dev _Available since v3.1._
 */
contract ERC1155Holder is ERC1155Receiver {
    function onERC1155Received(address, address, uint256, uint256, bytes memory) public virtual override returns (bytes4) {
        return this.onERC1155Received.selector;
    }
    function onERC1155BatchReceived(address, address, uint256[] memory, uint256[] memory, bytes memory) public virtual override returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }
}
// File: contracts/FantumsItem.sol
contract FantumsItem is Ownable, ERC1155Holder, ERC1155 {
    enum Variety { ERC20, ERC721, ERC1155 }
    enum Action { KEEP, BURN, SEND }
    enum MintType { MINT_SELF, SEND_ERC20, SEND_ERC721, SEND_ERC1155 }
    struct Item {
        uint256 id;
        string name;
        bool binds;
    }
    struct Combo {
        uint256 id;
        uint256 idToMint;
        uint256 amountToMint;
        uint256[] inputIds;
        MintType mintType;
        address typeAddress;
        uint256 typeTokenId;
    }
    struct Input {
        uint256 id;
        Action action;
        Variety variety;
        address tokenAddress;
        uint256 quantity;
        uint256 multiTokenId;
        address transferToAddress;
    }
    Item[] public items;
    Combo[] public combos;
    Input[] public inputs;
    mapping (uint256 => uint256) public totalSupply; // Tracks total numbers of each minted
    address public constant burnAddress = address(0xf000000000000000000000000000000000000000);
    constructor() public ERC1155("https://api.fantums.com/item/{id}") {
    }
    //* VIEW FUNCTIONS *//
    function getItem(uint256 _id) public view returns (Item memory) {
        require(getIndexOfItem(_id) > -1, "No item.");
        return items[uint256(getIndexOfItem(_id))];
    }
    function getCombo(uint256 _id) public view returns (Combo memory) {
        require(getIndexOfCombo(_id) > -1, "No combo.");
        return combos[uint256(getIndexOfCombo(_id))];
    }
    function getInput(uint256 _id) public view returns (Input memory) {
        require(getIndexOfInput(_id) > -1, "No input.");
        return inputs[uint256(getIndexOfInput(_id))];
    }
    function totalItems() public view returns (uint256) {
        return items.length;
    }
    function totalCombos() public view returns (uint256) {
        return combos.length;
    }
    function totalInputs() public view returns (uint256) {
        return inputs.length;
    }
    function getComboInputIds(uint256 _id) public view returns (uint256[] memory) {
        return combos[uint256(getIndexOfCombo(_id))].inputIds;
    }
    //* AUR FUNCTIONS *//
    function addItem(
        uint256 _id,
        string memory _name,
        bool _binds
    ) public onlyOwner {
        require(_id > 0);
        require(getIndexOfItem(_id) == -1, 'Item with id already exists.');
        items.push(Item({
            id: _id,
            name: _name,
            binds: _binds
        }));
    }
    function updateItem(
        uint256 _id,
        string memory _name,
        bool _binds
    ) public onlyOwner {
        int indexOfId = getIndexOfItem(_id);
        require(indexOfId != -1, 'Item with id does not exist.');
        items[uint256(indexOfId)] = Item({
            id: _id,
            name: _name,
            binds: _binds
        });
    }
    function removeItem(uint256 _id) public onlyOwner {
        int indexOfId = getIndexOfItem(_id);
        require(indexOfId != -1, 'Input with id does not exist.');
        items[uint(indexOfId)] = items[items.length - 1]; // Move last element to current position
        items.pop();
    }
    function addInput(
        uint256 _id,
        Action _action, 
        Variety _variety, 
        address _tokenAddress, 
        uint256 _quantity, 
        uint256 _multiTokenId,
        address _transferToAddress
    ) public onlyOwner {
        require(_id > 0);
        require(getIndexOfInput(_id) == -1, 'Input with id already exists.');
        inputs.push(Input({
            id: _id,
            action: _action,
            variety: _variety,
            tokenAddress: _tokenAddress,
            quantity: _quantity,
            multiTokenId: _multiTokenId,
            transferToAddress: _transferToAddress
        }));
    }
    function updateInput(
        uint256 _id,
        Action _action, 
        Variety _variety, 
        address _tokenAddress, 
        uint256 _quantity, 
        uint256 _multiTokenId,
        address _transferToAddress
    ) public onlyOwner {
        int indexOfId = getIndexOfInput(_id);
        require(indexOfId != -1, 'Input with id does not exist.');
        inputs[uint256(indexOfId)] = Input({
            id: _id,
            action: _action,
            variety: _variety,
            tokenAddress: _tokenAddress,
            quantity: _quantity,
            multiTokenId: _multiTokenId,
            transferToAddress: _transferToAddress
        });
    }
    function removeInput(uint256 _id) public onlyOwner {
        int indexOfId = getIndexOfInput(_id);
        require(indexOfId != -1, 'Input with id does not exist.');
        inputs[uint(indexOfId)] = inputs[inputs.length - 1]; // Move last element to current position
        inputs.pop();
    }
    function addCombo(
        uint256 _id,
        uint256 _idToMint,
        uint256 _amountToMint,
        uint256[] memory _inputIds,
        MintType _mintType,
        address _typeAddress,
        uint256 _typeTokenId
    ) public onlyOwner {
        require(_id > 0);
        require(getIndexOfCombo(_id) == -1, 'Combo with id already exists.');
        combos.push(Combo({
            id: _id,
            idToMint: _idToMint,
            amountToMint: _amountToMint,
            inputIds: _inputIds,
            mintType: _mintType,
            typeAddress: _typeAddress,
            typeTokenId: _typeTokenId
        }));
    }
    function updateCombo(
        uint256 _id,
        uint256 _idToMint,
        uint256 _amountToMint,
        uint256[] memory _inputIds,
        MintType _mintType,
        address _typeAddress,
        uint256 _typeTokenId
    ) public onlyOwner {
        int indexOfId = getIndexOfCombo(_id);
        require(indexOfId != -1, 'Combo with id does not exist.');
        combos[uint256(indexOfId)] = Combo({
            id: _id,
            idToMint: _idToMint,
            amountToMint: _amountToMint,
            inputIds: _inputIds,
            mintType: _mintType,
            typeAddress: _typeAddress,
            typeTokenId: _typeTokenId
        });
    }
    function removeCombo(uint256 _id) public onlyOwner {
        int indexOfId = getIndexOfCombo(_id);
        require(indexOfId != -1, 'Combo with id does not exist.');
        combos[uint(indexOfId)] = combos[combos.length - 1]; // Move last element to current position
        combos.pop();
    }
    //* ARRAY FUNCTIONS *//
    function getIndexOfItem(uint256 _id) public view returns (int index) {
        int indexOfId = -1;
        for(int i = 0; i<int(items.length); i++) {
            if(items[uint(i)].id==_id) {
                indexOfId=i;
                break;
            }
        }
        return indexOfId;
    }
    function getIndexOfCombo(uint256 _id) public view returns (int index) {
        int indexOfId = -1;
        for(int i = 0; i<int(combos.length); i++) {
            if(combos[uint(i)].id==_id) {
                indexOfId=i;
                break;
            }
        }
        return indexOfId;
    }
    function getIndexOfInput(uint256 _id) public view returns (int index) {
        int indexOfId = -1;
        for(int i = 0; i<int(inputs.length); i++) {
            if(inputs[uint(i)].id==_id) {
                indexOfId=i;
                break;
            }
        }
        return indexOfId;
    }
    //* OVERRIDES *//
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual override {
        for(uint i=0;i<ids.length;i++) {
            Item memory anItem = getItem(ids[i]);
            if(anItem.binds && from != address(0) && to != address(0)) {
                revert('An item is account bound.');
            }
        }
    }
    function burn(address account, uint256 id, uint256 value) public {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );
        _burn(account, id, value);
        totalSupply[id] = totalSupply[id] - value;
    }
    function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public  {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );
        _burnBatch(account, ids, values);
        for(uint i=0;i<ids.length;i++) {
            totalSupply[ids[i]] = totalSupply[ids[i]] - values[i];
        }
    }
    //* ADMIN MINT FUNCTIONS *//
    function mint(uint256 idToMint, uint256 amountToMint, address mintTo) public onlyOwner {
        _mint(mintTo, idToMint, amountToMint, bytes(""));
        totalSupply[idToMint] = totalSupply[idToMint] + amountToMint;
    }
    function mintBatch(uint256[] memory idsToMint, uint256[] memory amountsToMint, address mintTo) public onlyOwner {
        _mintBatch(mintTo, idsToMint, amountsToMint, bytes(""));
        for(uint i=0;i<idsToMint.length;i++) {
            totalSupply[idsToMint[i]] = totalSupply[idsToMint[i]] + amountsToMint[i];
        }
    }
    //* USER MINT FUNCTIONS *//
    function mintFromCombo(
        uint256 comboId,
        uint256 forQuantity,
        uint256[] memory sendingTokenIds
    ) payable public {
        Combo memory combo = getCombo(comboId);
        require(combo.amountToMint > 0, 'Mint combo does not exist!');
        if(combo.mintType==MintType.SEND_ERC721) {
            forQuantity=1;
        }
        // INPUTS
        for(uint i=0;i<combo.inputIds.length;i++) {
            // Go through each ingredient, attempt to transfer (times quantity)
            Input memory input = getInput(combo.inputIds[i]);
            address transferToAddress;
            if(input.action == Action.KEEP) {
                transferToAddress = address(this);
            } else if(input.action == Action.BURN) {
                transferToAddress = burnAddress;
            } else if(input.action == Action.SEND) {
                transferToAddress = input.transferToAddress;
            }
            if(input.action == Action.BURN && input.tokenAddress == address(this)) {
                burn(msg.sender, input.multiTokenId, input.quantity.mul(forQuantity));
            } else {
                if(input.variety == Variety.ERC20) {
                    ERC20(input.tokenAddress).transferFrom(msg.sender, transferToAddress, input.quantity.mul(forQuantity));
                } else if(input.variety == Variety.ERC721) {
                    ERC721(input.tokenAddress).transferFrom(msg.sender, transferToAddress, sendingTokenIds[i]);
                } else if(input.variety == Variety.ERC1155) {
                    ERC1155(input.tokenAddress).safeTransferFrom(msg.sender, transferToAddress, input.multiTokenId, input.quantity.mul(forQuantity), bytes(""));
                }
            }
        }
        // OUTPUTS
        // Now mint idToMint and forQuantity out times amountToMint
        if(combo.mintType==MintType.MINT_SELF) {
            _mint(msg.sender, combo.idToMint, combo.amountToMint.mul(forQuantity), bytes(""));
            totalSupply[combo.idToMint] = totalSupply[combo.idToMint] + combo.amountToMint.mul(forQuantity);
        } else if(combo.mintType==MintType.SEND_ERC20) {
            ERC20(combo.typeAddress).approve(address(this), combo.amountToMint.mul(forQuantity));
            ERC20(combo.typeAddress).transferFrom(address(this), msg.sender, combo.amountToMint.mul(forQuantity));
        } else if(combo.mintType==MintType.SEND_ERC721) {
            ERC721(combo.typeAddress).approve(msg.sender, combo.typeTokenId);
            ERC721(combo.typeAddress).transferFrom(address(this), msg.sender, combo.typeTokenId);
        } else if(combo.mintType==MintType.SEND_ERC1155) {
            ERC1155(combo.typeAddress).setApprovalForAll(address(this), true);
            ERC1155(combo.typeAddress).safeTransferFrom(address(this), msg.sender, combo.typeTokenId, combo.amountToMint.mul(forQuantity), bytes(""));
        }
        emit ComboCrafted(comboId, forQuantity, combo.amountToMint.mul(forQuantity));
    }
    //* WITHDRAW FUNCTIONS *//
    function withdrawVariety(
        Variety _variety, 
        address _contract, 
        uint256 _tokenId, 
        uint256 _amount, 
        address _to
    ) public onlyOwner {
        if(_variety == Variety.ERC20) {
            ERC20(_contract).approve(address(this), _amount);
            ERC20(_contract).transferFrom(address(this), _to, _amount);
        } else if(_variety == Variety.ERC721) {
            ERC721(_contract).transferFrom(address(this), _to, _tokenId);
        } else if(_variety == Variety.ERC1155) {
            ERC1155(_contract).safeTransferFrom(address(this), _to, _tokenId, _amount, bytes(""));
        }
    }
    //* EVENTS *//
    event ComboCrafted(uint256 comboId, uint256 forQuantity, uint256 idQuantity);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"comboId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"forQuantity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"idQuantity","type":"uint256"}],"name":"ComboCrafted","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":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_idToMint","type":"uint256"},{"internalType":"uint256","name":"_amountToMint","type":"uint256"},{"internalType":"uint256[]","name":"_inputIds","type":"uint256[]"},{"internalType":"enum FantumsItem.MintType","name":"_mintType","type":"uint8"},{"internalType":"address","name":"_typeAddress","type":"address"},{"internalType":"uint256","name":"_typeTokenId","type":"uint256"}],"name":"addCombo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"enum FantumsItem.Action","name":"_action","type":"uint8"},{"internalType":"enum FantumsItem.Variety","name":"_variety","type":"uint8"},{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"uint256","name":"_multiTokenId","type":"uint256"},{"internalType":"address","name":"_transferToAddress","type":"address"}],"name":"addInput","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"bool","name":"_binds","type":"bool"}],"name":"addItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"burnAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"burnBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"combos","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"idToMint","type":"uint256"},{"internalType":"uint256","name":"amountToMint","type":"uint256"},{"internalType":"enum FantumsItem.MintType","name":"mintType","type":"uint8"},{"internalType":"address","name":"typeAddress","type":"address"},{"internalType":"uint256","name":"typeTokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getCombo","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"idToMint","type":"uint256"},{"internalType":"uint256","name":"amountToMint","type":"uint256"},{"internalType":"uint256[]","name":"inputIds","type":"uint256[]"},{"internalType":"enum FantumsItem.MintType","name":"mintType","type":"uint8"},{"internalType":"address","name":"typeAddress","type":"address"},{"internalType":"uint256","name":"typeTokenId","type":"uint256"}],"internalType":"struct FantumsItem.Combo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getComboInputIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getIndexOfCombo","outputs":[{"internalType":"int256","name":"index","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getIndexOfInput","outputs":[{"internalType":"int256","name":"index","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getIndexOfItem","outputs":[{"internalType":"int256","name":"index","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getInput","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"enum FantumsItem.Action","name":"action","type":"uint8"},{"internalType":"enum FantumsItem.Variety","name":"variety","type":"uint8"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"multiTokenId","type":"uint256"},{"internalType":"address","name":"transferToAddress","type":"address"}],"internalType":"struct FantumsItem.Input","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getItem","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"bool","name":"binds","type":"bool"}],"internalType":"struct FantumsItem.Item","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"inputs","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"enum FantumsItem.Action","name":"action","type":"uint8"},{"internalType":"enum FantumsItem.Variety","name":"variety","type":"uint8"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"multiTokenId","type":"uint256"},{"internalType":"address","name":"transferToAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"items","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"bool","name":"binds","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"idToMint","type":"uint256"},{"internalType":"uint256","name":"amountToMint","type":"uint256"},{"internalType":"address","name":"mintTo","type":"address"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"idsToMint","type":"uint256[]"},{"internalType":"uint256[]","name":"amountsToMint","type":"uint256[]"},{"internalType":"address","name":"mintTo","type":"address"}],"name":"mintBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"comboId","type":"uint256"},{"internalType":"uint256","name":"forQuantity","type":"uint256"},{"internalType":"uint256[]","name":"sendingTokenIds","type":"uint256[]"}],"name":"mintFromCombo","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"removeCombo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"removeInput","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"removeItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","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":"totalCombos","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalInputs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalItems","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_idToMint","type":"uint256"},{"internalType":"uint256","name":"_amountToMint","type":"uint256"},{"internalType":"uint256[]","name":"_inputIds","type":"uint256[]"},{"internalType":"enum FantumsItem.MintType","name":"_mintType","type":"uint8"},{"internalType":"address","name":"_typeAddress","type":"address"},{"internalType":"uint256","name":"_typeTokenId","type":"uint256"}],"name":"updateCombo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"enum FantumsItem.Action","name":"_action","type":"uint8"},{"internalType":"enum FantumsItem.Variety","name":"_variety","type":"uint8"},{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"uint256","name":"_multiTokenId","type":"uint256"},{"internalType":"address","name":"_transferToAddress","type":"address"}],"name":"updateInput","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"bool","name":"_binds","type":"bool"}],"name":"updateItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum FantumsItem.Variety","name":"_variety","type":"uint8"},{"internalType":"address","name":"_contract","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"withdrawVariety","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506040518060600160405280602181526020016200551c6021913960006200004164010000000062000176810204565b60008054600160a060020a031916600160a060020a0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350620000bf7f01ffc9a7000000000000000000000000000000000000000000000000000000006401000000006200017b810204565b620000f37f4e2312e0000000000000000000000000000000000000000000000000000000006401000000006200017b810204565b620001078164010000000062000223810204565b6200013b7fd9b67a26000000000000000000000000000000000000000000000000000000006401000000006200017b810204565b6200016f7f0e89341c000000000000000000000000000000000000000000000000000000006401000000006200017b810204565b5062000315565b335b90565b7fffffffff000000000000000000000000000000000000000000000000000000008082161415620001e3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620001da90620002de565b60405180910390fd5b7fffffffff00000000000000000000000000000000000000000000000000000000166000908152600160208190526040909120805460ff19169091179055565b8051620002389060049060208401906200023c565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200027f57805160ff1916838001178555620002af565b82800160010185558215620002af579182015b82811115620002af57825182559160200191906001019062000292565b50620002bd929150620002c1565b5090565b6200017891905b80821115620002bd5760008155600101620002c8565b6020808252601c908201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604082015260600190565b6151f780620003256000396000f3fe60806040526004361061025f5760003560e060020a900480638da5cb5b11610148578063cfa94274116100ba578063ea321f5b1161007e578063ea321f5b14610774578063eaeb92fa14610789578063f23a6e61146107a9578063f242432a146107c9578063f2fde38b146107e9578063f5298aca146108095761025f565b8063cfa94274146106c1578063d2848dc4146106e1578063ddef9ea114610701578063e7d3fe6b14610734578063e985e9c5146107545761025f565b8063aefa7c9b1161010c578063aefa7c9b146105e0578063b3ce5ccf14610612578063bc197c8114610625578063bc279b0d14610652578063bd85b03914610672578063bfb231d2146106925761025f565b80638da5cb5b1461053e57806395ad5958146105535780639709a49514610573578063a22cb46514610593578063a459600e146105b35761025f565b80634e1273f4116101e1578063644468fa116101a5578063644468fa146104875780636b20c454146104a757806370d5ae05146104c757806371329171146104e9578063715018a614610509578063894f01a61461051e5761025f565b80634e1273f4146103d857806350a64a8914610405578063517a5bf61461041a57806353512df41461044757806355e9124c146104675761025f565b80632799276d116102285780632799276d146103365780632a68f2ad1461034b5780632b17d9da1461036b5780632eb2c2d61461038b5780633129e773146103ab5761025f565b8062fdd58e1461026457806301ffc9a71461029a5780630e89341c146102c757806325138041146102f457806325c04a8f14610314575b600080fd5b34801561027057600080fd5b5061028461027f366004614118565b610829565b604051610291919061472e565b60405180910390f35b3480156102a657600080fd5b506102ba6102b53660046142c5565b610888565b604051610291919061470e565b3480156102d357600080fd5b506102e76102e236600461435b565b6108ab565b6040516102919190614737565b34801561030057600080fd5b5061028461030f36600461435b565b610943565b34801561032057600080fd5b5061033461032f3660046143e9565b610991565b005b34801561034257600080fd5b50610284610a85565b34801561035757600080fd5b50610334610366366004614373565b610a8c565b34801561037757600080fd5b506103346103863660046143e9565b610c4e565b34801561039757600080fd5b506103346103a6366004613f5f565b610d81565b3480156103b757600080fd5b506103cb6103c636600461435b565b610fa9565b6040516102919190614faf565b3480156103e457600080fd5b506103f86103f3366004614175565b6110ce565b60405161029191906146cd565b34801561041157600080fd5b50610284611187565b34801561042657600080fd5b5061043a61043536600461435b565b61118d565b6040516102919190614ecc565b34801561045357600080fd5b5061033461046236600461435b565b6112b4565b34801561047357600080fd5b506103346104823660046144b3565b611473565b34801561049357600080fd5b506103346104a23660046144b3565b6115f6565b3480156104b357600080fd5b506103346104c236600461406e565b61177c565b3480156104d357600080fd5b506104dc611855565b60405161029191906145c1565b3480156104f557600080fd5b5061033461050436600461435b565b61186d565b34801561051557600080fd5b506103346119ac565b34801561052a57600080fd5b5061033461053936600461435b565b611a45565b34801561054a57600080fd5b506104dc611c49565b34801561055f57600080fd5b5061028461056e36600461435b565b611c58565b34801561057f57600080fd5b5061033461058e3660046142fd565b611c9f565b34801561059f57600080fd5b506103346105ae3660046140e1565b611f6b565b3480156105bf57600080fd5b506105d36105ce36600461435b565b61203c565b6040516102919190614f41565b3480156105ec57600080fd5b506106006105fb36600461435b565b612144565b60405161029196959493929190615091565b61033461062036600461446f565b612196565b34801561063157600080fd5b50610645610640366004613f5f565b61293f565b6040516102919190614719565b34801561065e57600080fd5b5061033461066d366004614237565b612969565b34801561067e57600080fd5b5061028461068d36600461435b565b612a41565b34801561069e57600080fd5b506106b26106ad36600461435b565b612a53565b60405161029193929190615042565b3480156106cd57600080fd5b506103346106dc366004614373565b612b25565b3480156106ed57600080fd5b506103f86106fc36600461435b565b612ce6565b34801561070d57600080fd5b5061072161071c36600461435b565b612d63565b6040516102919796959493929190614fec565b34801561074057600080fd5b5061033461074f366004614442565b612dbf565b34801561076057600080fd5b506102ba61076f366004613f2b565b612e35565b34801561078057600080fd5b50610284612e63565b34801561079557600080fd5b506102846107a436600461435b565b612e69565b3480156107b557600080fd5b506106456107c4366004614009565b612eb0565b3480156107d557600080fd5b506103346107e4366004614009565b612eda565b3480156107f557600080fd5b50610334610804366004613f10565b61307a565b34801561081557600080fd5b50610334610824366004614142565b61314d565b6000600160a060020a03831661085d5760405160e560020a62461bcd0281526004016108549061483b565b60405180910390fd5b506000818152600260209081526040808320600160a060020a03861684529091529020545b92915050565b600160e060020a0319811660009081526001602052604090205460ff165b919050565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109375780601f1061090c57610100808354040283529160200191610937565b820191906000526020600020905b81548152906001019060200180831161091a57829003601f168201915b50505050509050919050565b6000600019815b60055481121561098a57836005828154811061096257fe5b90600052602060002090600302016000015414156109825780915061098a565b60010161094a565b5092915050565b6109996131bf565b600160a060020a03166109aa611c49565b600160a060020a0316146109d35760405160e560020a62461bcd02815260040161085490614c10565b60006109de84610943565b9050806000191415610a055760405160e560020a62461bcd028152600401610854906149f7565b604051806060016040528085815260200184815260200183151581525060058281548110610a2f57fe5b9060005260206000209060030201600082015181600001556020820151816001019080519060200190610a63929190613b8e565b50604091909101516002909101805460ff191691151591909117905550505050565b6005545b90565b610a946131bf565b600160a060020a0316610aa5611c49565b600160a060020a031614610ace5760405160e560020a62461bcd02815260040161085490614c10565b60008711610adb57600080fd5b610ae487611c58565b60001914610b075760405160e560020a62461bcd02815260040161085490614b7c565b60076040518060e00160405280898152602001886002811115610b2657fe5b8152602001876002811115610b3757fe5b8152600160a060020a0380881660208084019190915260408301889052606083018790529085166080909201919091528254600181810185556000948552938290208351600590920201908155908201518184018054939492939192909160ff191690836002811115610ba657fe5b0217905550604082015160018201805461ff001916610100836002811115610bca57fe5b0217905550606082015160018201805475ffffffffffffffffffffffffffffffffffffffff0000191662010000600160a060020a03938416021790556080830151600283015560a0830151600383015560c0909201516004909101805473ffffffffffffffffffffffffffffffffffffffff19169190921617905550505050505050565b610c566131bf565b600160a060020a0316610c67611c49565b600160a060020a031614610c905760405160e560020a62461bcd02815260040161085490614c10565b60008311610c9d57600080fd5b610ca683610943565b60001914610cc95760405160e560020a62461bcd02815260040161085490614cb3565b6040805160608101825284815260208082018581528415159383019390935260058054600181018255600091909152825160039091027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db081019182559351805193949193610d60937f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db1909301929190910190613b8e565b50604091909101516002909101805460ff1916911515919091179055505050565b8151835114610da55760405160e560020a62461bcd02815260040161085490614e12565b600160a060020a038416610dce5760405160e560020a62461bcd02815260040161085490614a2e565b610dd66131bf565b600160a060020a031685600160a060020a03161480610dfc5750610dfc8561076f6131bf565b610e1b5760405160e560020a62461bcd02815260040161085490614a8b565b6000610e256131bf565b9050610e358187878787876131c3565b60005b8451811015610f3b576000858281518110610e4f57fe5b602002602001015190506000858381518110610e6757fe5b60200260200101519050610ed4816040518060600160405280602a8152602001615198602a91396002600086815260200190815260200160002060008d600160a060020a0316600160a060020a03168152602001908152602001600020546132549092919063ffffffff16565b6000838152600260209081526040808320600160a060020a038e811685529252808320939093558a1681522054610f0b9082613283565b6000928352600260209081526040808520600160a060020a038c1686529091529092209190915550600101610e38565b5084600160a060020a031686600160a060020a031682600160a060020a03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051610f8b9291906146e0565b60405180910390a4610fa18187878787876132b2565b505050505050565b610fb1613c0c565b600019610fbd83610943565b13610fdd5760405160e560020a62461bcd028152600401610854906148f5565b6005610fe883610943565b81548110610ff257fe5b906000526020600020906003020160405180606001604052908160008201548152602001600182018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110ae5780601f10611083576101008083540402835291602001916110ae565b820191906000526020600020905b81548152906001019060200180831161109157829003601f168201915b50505091835250506002919091015460ff16151560209091015292915050565b606081518351146110f45760405160e560020a62461bcd02815260040161085490614d7e565b60608351604051908082528060200260200182016040528015611121578160200160208202803883390190505b50905060005b845181101561117f5761116085828151811061113f57fe5b602002602001015185838151811061115357fe5b6020026020010151610829565b82828151811061116c57fe5b6020908102919091010152600101611127565b509392505050565b60065490565b611195613c2f565b6000196111a183612e69565b136111c15760405160e560020a62461bcd02815260040161085490614cea565b60066111cc83612e69565b815481106111d657fe5b90600052602060002090600602016040518060e00160405290816000820154815260200160018201548152602001600282015481526020016003820180548060200260200160405190810160405280929190818152602001828054801561125c57602002820191906000526020600020905b815481526020019060010190808311611248575b5050509183525050600482015460209091019060ff16600381111561127d57fe5b600381111561128857fe5b815260048201546101009004600160a060020a0316602082015260059091015460409091015292915050565b6112bc6131bf565b600160a060020a03166112cd611c49565b600160a060020a0316146112f65760405160e560020a62461bcd02815260040161085490614c10565b600061130182612e69565b90508060001914156113285760405160e560020a62461bcd02815260040161085490614c7c565b60068054600019810190811061133a57fe5b90600052602060002090600602016006828154811061135557fe5b90600052602060002090600602016000820154816000015560018201548160010155600282015481600201556003820181600301908054611397929190613c77565b50600482810154908201805460ff9092169160ff191660018360038111156113bb57fe5b0217905550600482810154908201805474ffffffffffffffffffffffffffffffffffffffff00191661010092839004600160a060020a0316909202919091179055600591820154910155600680548061141057fe5b6000828152602081206006600019909301928302018181556001810182905560028101829055906114446003830182613cb7565b5060048101805474ffffffffffffffffffffffffffffffffffffffffff19169055600060059091015590555050565b61147b6131bf565b600160a060020a031661148c611c49565b600160a060020a0316146114b55760405160e560020a62461bcd02815260040161085490614c10565b60006114c088612e69565b90508060001914156114e75760405160e560020a62461bcd02815260040161085490614c7c565b6040518060e0016040528089815260200188815260200187815260200186815260200185600381111561151657fe5b815260200184600160a060020a03168152602001838152506006828154811061153b57fe5b90600052602060002090600602016000820151816000015560208201518160010155604082015181600201556060820151816003019080519060200190611583929190613cd8565b50608082015160048201805460ff191660018360038111156115a157fe5b021790555060a0820151600482018054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff001990921691909117905560c0909101516005909101555050505050505050565b6115fe6131bf565b600160a060020a031661160f611c49565b600160a060020a0316146116385760405160e560020a62461bcd02815260040161085490614c10565b6000871161164557600080fd5b61164e87612e69565b600019146116715760405160e560020a62461bcd02815260040161085490614ddb565b60066040518060e001604052808981526020018881526020018781526020018681526020018560038111156116a257fe5b8152600160a060020a0385166020808301919091526040918201859052835460018181018655600095865294829020845160069092020190815583820151948101949094559082015160028401556060820151805192939261170a9260038501920190613cd8565b50608082015160048201805460ff1916600183600381111561172857fe5b021790555060a0820151600482018054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff001990921691909117905560c09091015160059091015550505050505050565b6117846131bf565b600160a060020a031683600160a060020a031614806117aa57506117aa8361076f6131bf565b6117c95760405160e560020a62461bcd02815260040161085490614963565b6117d48383836134ab565b60005b825181101561184f578181815181106117ec57fe5b60200260200101516008600085848151811061180457fe5b6020026020010151815260200190815260200160002054036008600085848151811061182c57fe5b6020908102919091018101518252810191909152604001600020556001016117d7565b50505050565b73f00000000000000000000000000000000000000081565b6118756131bf565b600160a060020a0316611886611c49565b600160a060020a0316146118af5760405160e560020a62461bcd02815260040161085490614c10565b60006118ba82610943565b90508060001914156118e15760405160e560020a62461bcd02815260040161085490614b45565b6005805460001981019081106118f357fe5b90600052602060002090600302016005828154811061190e57fe5b9060005260206000209060030201600082015481600001556001820181600101908054600181600116156101000203166002900461194d929190613d12565b506002918201549101805460ff191660ff9092161515919091179055600580548061197457fe5b6000828152602081206003600019909301928302018181559061199a6001830182613d86565b50600201805460ff1916905590555050565b6119b46131bf565b600160a060020a03166119c5611c49565b600160a060020a0316146119ee5760405160e560020a62461bcd02815260040161085490614c10565b60008054604051600160a060020a03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b611a4d6131bf565b600160a060020a0316611a5e611c49565b600160a060020a031614611a875760405160e560020a62461bcd02815260040161085490614c10565b6000611a9282611c58565b9050806000191415611ab95760405160e560020a62461bcd02815260040161085490614b45565b600780546000198101908110611acb57fe5b906000526020600020906005020160078281548110611ae657fe5b600091825260209091208254600590920201908155600180830154818301805460ff90921692909160ff191690836002811115611b1f57fe5b0217905550600182810154908201805460ff61010093849004169261ff001990911690836002811115611b4e57fe5b02179055506001828101549082018054600160a060020a036201000093849004811690930275ffffffffffffffffffffffffffffffffffffffff000019909116179055600280840154908301556003808401549083015560049283015492909101805473ffffffffffffffffffffffffffffffffffffffff1916929091169190911790556007805480611bdd57fe5b60008281526020812060056000199093019283020181815560018101805475ffffffffffffffffffffffffffffffffffffffffffff19169055600281018290556003810191909155600401805473ffffffffffffffffffffffffffffffffffffffff1916905590555050565b600054600160a060020a031690565b6000600019815b60075481121561098a578360078281548110611c7757fe5b9060005260206000209060050201600001541415611c975780915061098a565b600101611c5f565b611ca76131bf565b600160a060020a0316611cb8611c49565b600160a060020a031614611ce15760405160e560020a62461bcd02815260040161085490614c10565b6000856002811115611cef57fe5b1415611e30576040517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a0385169063095ea7b390611d3c903090869060040161463c565b602060405180830381600087803b158015611d5657600080fd5b505af1158015611d6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611d8e91908101906142a9565b506040517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038516906323b872dd90611dd8903090859087906004016145d5565b602060405180830381600087803b158015611df257600080fd5b505af1158015611e06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611e2a91908101906142a9565b50611f64565b6001856002811115611e3e57fe5b1415611ec4576040517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038516906323b872dd90611e8d903090859088906004016145d5565b600060405180830381600087803b158015611ea757600080fd5b505af1158015611ebb573d6000803e3d6000fd5b50505050611f64565b6002856002811115611ed257fe5b1415611f6457604080516020810182526000815290517ff242432a000000000000000000000000000000000000000000000000000000008152600160a060020a0386169163f242432a91611f31913091869189918991906004016145f9565b600060405180830381600087803b158015611f4b57600080fd5b505af1158015611f5f573d6000803e3d6000fd5b505050505b5050505050565b81600160a060020a0316611f7d6131bf565b600160a060020a03161415611fa75760405160e560020a62461bcd02815260040161085490614d21565b8060036000611fb46131bf565b600160a060020a03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155611ff86131bf565b600160a060020a03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051612030919061470e565b60405180910390a35050565b612044613dca565b60001961205083611c58565b136120705760405160e560020a62461bcd02815260040161085490614c45565b600761207b83611c58565b8154811061208557fe5b90600052602060002090600502016040518060e0016040529081600082015481526020016001820160009054906101000a900460ff1660028111156120c657fe5b60028111156120d157fe5b81526020016001820160019054906101000a900460ff1660028111156120f357fe5b60028111156120fe57fe5b81526001820154620100009004600160a060020a039081166020830152600283015460408301526003830154606083015260049092015490911660809091015292915050565b6006818154811061215157fe5b6000918252602090912060069091020180546001820154600283015460048401546005909401549294509092909160ff8216916101009004600160a060020a03169086565b61219e613c2f565b6121a78461118d565b905060008160400151116121d05760405160e560020a62461bcd028152600401610854906149c0565b6002816080015160038111156121e257fe5b14156121ed57600192505b60005b8160600151518110156124fa57612205613dca565b6122258360600151838151811061221857fe5b602002602001015161203c565b90506000808260200151600281111561223a57fe5b1415612247575030612299565b60018260200151600281111561225957fe5b141561227a575073f000000000000000000000000000000000000000612299565b60028260200151600281111561228c57fe5b1415612299575060c08101515b6001826020015160028111156122ab57fe5b1480156122c457506060820151600160a060020a031630145b156122ee576122e9338360a0015161082489866080015161365f90919063ffffffff16565b6124f0565b60008260400151600281111561230057fe5b14156123ab578160600151600160a060020a03166323b872dd33836123328a876080015161365f90919063ffffffff16565b6040518463ffffffff1660e060020a028152600401612353939291906145d5565b602060405180830381600087803b15801561236d57600080fd5b505af1158015612381573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506123a591908101906142a9565b506124f0565b6001826040015160028111156123bd57fe5b1415612444578160600151600160a060020a03166323b872dd33838887815181106123e457fe5b60200260200101516040518463ffffffff1660e060020a02815260040161240d939291906145d5565b600060405180830381600087803b15801561242757600080fd5b505af115801561243b573d6000803e3d6000fd5b505050506124f0565b60028260400151600281111561245657fe5b14156124f0578160600151600160a060020a031663f242432a33838560a0015161248d8b886080015161365f90919063ffffffff16565b6040805160208101825260008152905160e060020a63ffffffff88160281526124bd9594939291906004016145f9565b600060405180830381600087803b1580156124d757600080fd5b505af11580156124eb573d6000803e3d6000fd5b505050505b50506001016121f0565b5060008160800151600381111561250d57fe5b14156125845761254833826020015161253386856040015161365f90919063ffffffff16565b6040518060200160405280600081525061369c565b604081015161255d908463ffffffff61365f16565b602080830180516000908152600890925260408083205491518352909120910190556128e8565b60018160800151600381111561259657fe5b14156126df578060a00151600160a060020a031663095ea7b3306125c786856040015161365f90919063ffffffff16565b6040518363ffffffff1660e060020a0281526004016125e792919061463c565b602060405180830381600087803b15801561260157600080fd5b505af1158015612615573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061263991908101906142a9565b508060a00151600160a060020a03166323b872dd303361266687866040015161365f90919063ffffffff16565b6040518463ffffffff1660e060020a028152600401612687939291906145d5565b602060405180830381600087803b1580156126a157600080fd5b505af11580156126b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506126d991908101906142a9565b506128e8565b6002816080015160038111156126f157fe5b14156127d4578060a00151600160a060020a031663095ea7b3338360c001516040518363ffffffff1660e060020a02815260040161273092919061463c565b600060405180830381600087803b15801561274a57600080fd5b505af115801561275e573d6000803e3d6000fd5b505050508060a00151600160a060020a03166323b872dd30338460c001516040518463ffffffff1660e060020a02815260040161279d939291906145d5565b600060405180830381600087803b1580156127b757600080fd5b505af11580156127cb573d6000803e3d6000fd5b505050506128e8565b6003816080015160038111156127e657fe5b14156128e8578060a00151600160a060020a031663a22cb4653060016040518363ffffffff1660e060020a0281526004016128229291906146b2565b600060405180830381600087803b15801561283c57600080fd5b505af1158015612850573d6000803e3d6000fd5b505050508060a00151600160a060020a031663f242432a30338460c0015161288588876040015161365f90919063ffffffff16565b6040805160208101825260008152905160e060020a63ffffffff88160281526128b59594939291906004016145f9565b600060405180830381600087803b1580156128cf57600080fd5b505af11580156128e3573d6000803e3d6000fd5b505050505b7f6303a7cef2ebc0bbd99b4485e4cc7b514ccbc5a5bde2125b396938999b21e066848461292286856040015161365f90919063ffffffff16565b6040516129319392919061507b565b60405180910390a150505050565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b6129716131bf565b600160a060020a0316612982611c49565b600160a060020a0316146129ab5760405160e560020a62461bcd02815260040161085490614c10565b6129c681848460405180602001604052806000815250613789565b60005b835181101561184f578281815181106129de57fe5b6020026020010151600860008684815181106129f657fe5b60200260200101518152602001908152602001600020540160086000868481518110612a1e57fe5b6020908102919091018101518252810191909152604001600020556001016129c9565b60086020526000908152604090205481565b60058181548110612a6057fe5b9060005260206000209060030201600091509050806000015490806001018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612b125780601f10612ae757610100808354040283529160200191612b12565b820191906000526020600020905b815481529060010190602001808311612af557829003601f168201915b5050506002909301549192505060ff1683565b612b2d6131bf565b600160a060020a0316612b3e611c49565b600160a060020a031614612b675760405160e560020a62461bcd02815260040161085490614c10565b6000612b7288611c58565b9050806000191415612b995760405160e560020a62461bcd02815260040161085490614b45565b6040518060e00160405280898152602001886002811115612bb657fe5b8152602001876002811115612bc757fe5b815260200186600160a060020a0316815260200185815260200184815260200183600160a060020a031681525060078281548110612c0157fe5b90600052602060002090600502016000820151816000015560208201518160010160006101000a81548160ff02191690836002811115612c3d57fe5b0217905550604082015160018201805461ff001916610100836002811115612c6157fe5b0217905550606082015160018201805475ffffffffffffffffffffffffffffffffffffffff0000191662010000600160a060020a03938416021790556080830151600283015560a0830151600383015560c0909201516004909101805473ffffffffffffffffffffffffffffffffffffffff1916919092161790555050505050505050565b60606006612cf383612e69565b81548110612cfd57fe5b906000526020600020906006020160030180548060200260200160405190810160405280929190818152602001828054801561093757602002820191906000526020600020905b815481526020019060010190808311612d445750505050509050919050565b60078181548110612d7057fe5b60009182526020909120600590910201805460018201546002830154600384015460049094015492945060ff80831694610100840490911693600160a060020a03620100009094048416931687565b612dc76131bf565b600160a060020a0316612dd8611c49565b600160a060020a031614612e015760405160e560020a62461bcd02815260040161085490614c10565b612e1c8184846040518060200160405280600081525061369c565b5060009182526008602052604090912080549091019055565b600160a060020a03918216600090815260036020908152604080832093909416825291909152205460ff1690565b60075490565b6000600019815b60065481121561098a578360068281548110612e8857fe5b9060005260206000209060060201600001541415612ea85780915061098a565b600101612e70565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b600160a060020a038416612f035760405160e560020a62461bcd02815260040161085490614a2e565b612f0b6131bf565b600160a060020a031685600160a060020a03161480612f315750612f318561076f6131bf565b612f505760405160e560020a62461bcd02815260040161085490614963565b6000612f5a6131bf565b9050612f7a818787612f6b8861391d565b612f748861391d565b876131c3565b612fc7836040518060600160405280602a8152602001615198602a91396000878152600260209081526040808320600160a060020a038d168452909152902054919063ffffffff61325416565b6000858152600260209081526040808320600160a060020a038b81168552925280832093909355871681522054612ffe9084613283565b6000858152600260209081526040808320600160a060020a03808b168086529190935292819020939093559151909188811691908416907fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6290613064908990899061506d565b60405180910390a4610fa1818787878787613961565b6130826131bf565b600160a060020a0316613093611c49565b600160a060020a0316146130bc5760405160e560020a62461bcd02815260040161085490614c10565b600160a060020a0381166130e55760405160e560020a62461bcd02815260040161085490614898565b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6131556131bf565b600160a060020a031683600160a060020a0316148061317b575061317b8361076f6131bf565b61319a5760405160e560020a62461bcd02815260040161085490614963565b6131a5838383613a77565b600091825260086020526040909120805491909103905550565b3390565b60005b835181101561324b576131d7613c0c565b6131f38583815181106131e657fe5b6020026020010151610fa9565b90508060400151801561320e5750600160a060020a03871615155b80156132225750600160a060020a03861615155b156132425760405160e560020a62461bcd028152600401610854906147a7565b506001016131c6565b50505050505050565b6000818484111561327b5760405160e560020a62461bcd0281526004016108549190614737565b505050900390565b6000828201838110156132ab5760405160e560020a62461bcd0281526004016108549061492c565b9392505050565b6132c484600160a060020a0316613b88565b15610fa1576040517fbc197c81000000000000000000000000000000000000000000000000000000008152600160a060020a0385169063bc197c81906133169089908990889088908890600401614655565b602060405180830381600087803b15801561333057600080fd5b505af1925050508015613360575060408051601f3d908101601f1916820190925261335d918101906142e1565b60015b61345f576040516000815260443d101561337c5750600061341c565b60046000803e60e060020a600051046308c379a081146133a057600091505061341c565b60043d036004833e81513d602482011167ffffffffffffffff821117156133cc5760009250505061341c565b808301805167ffffffffffffffff8111156133ee57600094505050505061341c565b8060208301013d860181111561340c5760009550505050505061341c565b601f01601f191660405250925050505b806134275750613444565b8060405160e560020a62461bcd0281526004016108549190614737565b60405160e560020a62461bcd0281526004016108549061474a565b600160e060020a031981167fbc197c81000000000000000000000000000000000000000000000000000000001461324b5760405160e560020a62461bcd028152600401610854906147de565b600160a060020a0383166134d45760405160e560020a62461bcd02815260040161085490614ae8565b80518251146134f85760405160e560020a62461bcd02815260040161085490614e12565b60006135026131bf565b9050613522818560008686604051806020016040528060008152506131c3565b60005b8351811015613600576135b783828151811061353d57fe5b6020026020010151604051806060016040528060248152602001615174602491396002600088868151811061356e57fe5b60200260200101518152602001908152602001600020600089600160a060020a0316600160a060020a03168152602001908152602001600020546132549092919063ffffffff16565b600260008684815181106135c757fe5b60209081029190910181015182528181019290925260409081016000908120600160a060020a038a168252909252902055600101613525565b506000600160a060020a031684600160a060020a031682600160a060020a03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516136519291906146e0565b60405180910390a450505050565b60008261366e57506000610882565b8282028284828161367b57fe5b04146132ab5760405160e560020a62461bcd02815260040161085490614bb3565b600160a060020a0384166136c55760405160e560020a62461bcd02815260040161085490614e6f565b60006136cf6131bf565b90506136e181600087612f6b8861391d565b6000848152600260209081526040808320600160a060020a0389168452909152902054613714908463ffffffff61328316565b6000858152600260209081526040808320600160a060020a03808b16808652919093528184209490945551908416907fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6290613772908990899061506d565b60405180910390a4611f6481600087878787613961565b600160a060020a0384166137b25760405160e560020a62461bcd02815260040161085490614e6f565b81518351146137d65760405160e560020a62461bcd02815260040161085490614e12565b60006137e06131bf565b90506137f1816000878787876131c3565b60005b84518110156138b55761386c6002600087848151811061381057fe5b60200260200101518152602001908152602001600020600088600160a060020a0316600160a060020a031681526020019081526020016000205485838151811061385657fe5b602002602001015161328390919063ffffffff16565b6002600087848151811061387c57fe5b60209081029190910181015182528181019290925260409081016000908120600160a060020a038b1682529092529020556001016137f4565b5084600160a060020a03166000600160a060020a031682600160a060020a03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516139069291906146e0565b60405180910390a4611f64816000878787876132b2565b60408051600180825281830190925260609182919060208083019080388339019050509050828160008151811061395057fe5b602090810291909101015292915050565b61397384600160a060020a0316613b88565b15610fa1576040517ff23a6e61000000000000000000000000000000000000000000000000000000008152600160a060020a0385169063f23a6e61906139c590899089908890889088906004016145f9565b602060405180830381600087803b1580156139df57600080fd5b505af1925050508015613a0f575060408051601f3d908101601f19168201909252613a0c918101906142e1565b60015b613a2b576040516000815260443d101561337c5750600061341c565b600160e060020a031981167ff23a6e61000000000000000000000000000000000000000000000000000000001461324b5760405160e560020a62461bcd028152600401610854906147de565b600160a060020a038316613aa05760405160e560020a62461bcd02815260040161085490614ae8565b6000613aaa6131bf565b9050613ada81856000613abc8761391d565b613ac58761391d565b604051806020016040528060008152506131c3565b613b2782604051806060016040528060248152602001615174602491396000868152600260209081526040808320600160a060020a038b168452909152902054919063ffffffff61325416565b6000848152600260209081526040808320600160a060020a03808a16808652919093528184209490945551919291908416907fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6290613651908890889061506d565b3b151590565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613bcf57805160ff1916838001178555613bfc565b82800160010185558215613bfc579182015b82811115613bfc578251825591602001919060010190613be1565b50613c08929150613e08565b5090565b604051806060016040528060008152602001606081526020016000151581525090565b6040518060e001604052806000815260200160008152602001600081526020016060815260200160006003811115613c6357fe5b815260006020820181905260409091015290565b828054828255906000526020600020908101928215613bfc5760005260206000209182015b82811115613bfc578254825591600101919060010190613c9c565b5080546000825590600052602060002090810190613cd59190613e08565b50565b828054828255906000526020600020908101928215613bfc5791602002820182811115613bfc578251825591602001919060010190613be1565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613d4b5780548555613bfc565b82800160010185558215613bfc57600052602060002091601f0160209004820182811115613bfc578254825591600101919060010190613c9c565b50805460018160011615610100020316600290046000825580601f10613dac5750613cd5565b601f016020900490600052602060002090810190613cd59190613e08565b6040805160e0810190915260008082526020820190815260200160008152600060208201819052604082018190526060820181905260809091015290565b610a8991905b80821115613c085760008155600101613e0e565b8035600160a060020a038116811461088257600080fd5b600082601f830112613e49578081fd5b8135613e5c613e57826150f8565b6150d1565b818152915060208083019084810181840286018201871015613e7d57600080fd5b60005b84811015613e9c57813584529282019290820190600101613e80565b505050505092915050565b600082601f830112613eb7578081fd5b813567ffffffffffffffff811115613ecd578182fd5b613ee0601f8201601f19166020016150d1565b9150808252836020828501011115613ef757600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215613f21578081fd5b6132ab8383613e22565b60008060408385031215613f3d578081fd5b613f478484613e22565b9150613f568460208501613e22565b90509250929050565b600080600080600060a08688031215613f76578081fd5b8535613f818161512d565b94506020860135613f918161512d565b9350604086013567ffffffffffffffff80821115613fad578283fd5b613fb989838a01613e39565b94506060880135915080821115613fce578283fd5b613fda89838a01613e39565b93506080880135915080821115613fef578283fd5b50613ffc88828901613ea7565b9150509295509295909350565b600080600080600060a08688031215614020578081fd5b61402a8787613e22565b94506140398760208801613e22565b93506040860135925060608601359150608086013567ffffffffffffffff811115614062578182fd5b613ffc88828901613ea7565b600080600060608486031215614082578283fd5b833561408d8161512d565b9250602084013567ffffffffffffffff808211156140a9578384fd5b6140b587838801613e39565b935060408601359150808211156140ca578283fd5b506140d786828701613e39565b9150509250925092565b600080604083850312156140f3578182fd5b6140fd8484613e22565b9150602083013561410d81615142565b809150509250929050565b6000806040838503121561412a578182fd5b6141348484613e22565b946020939093013593505050565b600080600060608486031215614156578283fd5b6141608585613e22565b95602085013595506040909401359392505050565b60008060408385031215614187578182fd5b823567ffffffffffffffff8082111561419e578384fd5b81850186601f8201126141af578485fd5b803592506141bf613e57846150f8565b80848252602080830192508084018a8283890287010111156141df578889fd5b8894505b86851015614209576141f58b82613e22565b8452600194909401939281019281016141e3565b509096508701359350505080821115614220578283fd5b5061422d85828601613e39565b9150509250929050565b60008060006060848603121561424b578081fd5b833567ffffffffffffffff80821115614262578283fd5b61426e87838801613e39565b94506020860135915080821115614283578283fd5b5061429086828701613e39565b9250506142a08560408601613e22565b90509250925092565b6000602082840312156142ba578081fd5b81516132ab81615142565b6000602082840312156142d6578081fd5b81356132ab81615150565b6000602082840312156142f2578081fd5b81516132ab81615150565b600080600080600060a08688031215614314578283fd5b853561431f81615166565b9450602086013561432f8161512d565b93506040860135925060608601359150608086013561434d8161512d565b809150509295509295909350565b60006020828403121561436c578081fd5b5035919050565b600080600080600080600060e0888a03121561438d578485fd5b87359650602088013561439f81615166565b955060408801356143af81615166565b94506143be8960608a01613e22565b93506080880135925060a088013591506143db8960c08a01613e22565b905092959891949750929550565b6000806000606084860312156143fd578081fd5b83359250602084013567ffffffffffffffff81111561441a578182fd5b61442686828701613ea7565b925050604084013561443781615142565b809150509250925092565b600080600060608486031215614456578081fd5b833592506020840135915060408401356144378161512d565b600080600060608486031215614483578081fd5b8335925060208401359150604084013567ffffffffffffffff8111156144a7578182fd5b6140d786828701613e39565b600080600080600080600060e0888a0312156144cd578081fd5b873596506020880135955060408801359450606088013567ffffffffffffffff8111156144f8578182fd5b6145048a828b01613e39565b945050608088013560048110614518578182fd5b92506145278960a08a01613e22565b915060c0880135905092959891949750929550565b6000815180845260208085019450808401835b8381101561456b5781518752958201959082019060010161454f565b509495945050505050565b60008151808452815b8181101561459b5760208185018101518683018201520161457f565b818111156145ac5782602083870101525b50601f01601f19169290920160200192915050565b600160a060020a0391909116815260200190565b600160a060020a039384168152919092166020820152604081019190915260600190565b6000600160a060020a03808816835280871660208401525084604083015283606083015260a0608083015261463160a0830184614576565b979650505050505050565b600160a060020a03929092168252602082015260400190565b6000600160a060020a03808816835280871660208401525060a0604083015261468160a083018661453c565b8281036060840152614693818661453c565b83810360808501526146a58186614576565b9998505050505050505050565b600160a060020a039290921682521515602082015260400190565b6000602082526132ab602083018461453c565b6000604082526146f3604083018561453c565b8281036020840152614705818561453c565b95945050505050565b901515815260200190565b600160e060020a031991909116815260200190565b90815260200190565b6000602082526132ab6020830184614576565b60208082526034908201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560408201527f526563656976657220696d706c656d656e746572000000000000000000000000606082015260800190565b60208082526019908201527f416e206974656d206973206163636f756e7420626f756e642e00000000000000604082015260600190565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a6563746560408201527f6420746f6b656e73000000000000000000000000000000000000000000000000606082015260800190565b6020808252602b908201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60408201527f65726f2061646472657373000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526008908201527f4e6f206974656d2e000000000000000000000000000000000000000000000000604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526029908201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260408201527f20617070726f7665640000000000000000000000000000000000000000000000606082015260800190565b6020808252601a908201527f4d696e7420636f6d626f20646f6573206e6f7420657869737421000000000000604082015260600190565b6020808252601c908201527f4974656d207769746820696420646f6573206e6f742065786973742e00000000604082015260600190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460408201527f6472657373000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526032908201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060408201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000606082015260800190565b60208082526023908201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260408201527f6573730000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601d908201527f496e707574207769746820696420646f6573206e6f742065786973742e000000604082015260600190565b6020808252601d908201527f496e707574207769746820696420616c7265616479206578697374732e000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60408201527f7700000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526009908201527f4e6f20696e7075742e0000000000000000000000000000000000000000000000604082015260600190565b6020808252601d908201527f436f6d626f207769746820696420646f6573206e6f742065786973742e000000604082015260600190565b6020808252601c908201527f4974656d207769746820696420616c7265616479206578697374732e00000000604082015260600190565b60208082526009908201527f4e6f20636f6d626f2e0000000000000000000000000000000000000000000000604082015260600190565b60208082526029908201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360408201527f20666f722073656c660000000000000000000000000000000000000000000000606082015260800190565b60208082526029908201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860408201527f206d69736d617463680000000000000000000000000000000000000000000000606082015260800190565b6020808252601d908201527f436f6d626f207769746820696420616c7265616479206578697374732e000000604082015260600190565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060408201527f6d69736d61746368000000000000000000000000000000000000000000000000606082015260800190565b60208082526021908201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360408201527f7300000000000000000000000000000000000000000000000000000000000000606082015260800190565b600060208252825160208301526020830151604083015260408301516060830152606083015160e06080840152614f0761010084018261453c565b614f146080860151615118565b60a0850152600160a060020a0360a08601511660c085015260c085015160e0850152809250505092915050565b81518152602082015160e0820190614f5881615123565b60208301526040830151614f6b81615123565b806040840152506060830151600160a060020a0380821660608501526080850151608085015260a085015160a08501528060c08601511660c0850152505092915050565b60006020825282516020830152602083015160606040840152614fd56080840182614576565b604085015115156060850152809250505092915050565b87815260e08101614ffc88615123565b87602083015261500b87615123565b866040830152600160a060020a0380871660608401528560808401528460a084015280841660c08401525098975050505050505050565b60008482526060602083015261505b6060830185614576565b90508215156040830152949350505050565b918252602082015260400190565b9283526020830191909152604082015260600190565b868152602081018690526040810185905260c081016150af85615118565b6060830152600160a060020a0393909316608082015260a00152949350505050565b60405181810167ffffffffffffffff811182821017156150f057600080fd5b604052919050565b600067ffffffffffffffff82111561510e578081fd5b5060209081020190565b80600481106108a657fe5b60038110613cd557fe5b600160a060020a0381168114613cd557600080fd5b8015158114613cd557600080fd5b600160e060020a031981168114613cd557600080fd5b60038110613cd557600080fdfe455243313135353a206275726e20616d6f756e7420657863656564732062616c616e6365455243313135353a20696e73756666696369656e742062616c616e636520666f72207472616e73666572a2646970667358221220a19fa903fab13e2bee286f3fbfa9e754d99588778623583b3e388b11314041cd64736f6c6343000602003368747470733a2f2f6170692e66616e74756d732e636f6d2f6974656d2f7b69647d

Loading