Token Awesome Pets NFT
Overview ERC-1155
Total Supply:
0 AWESOMEPETS01
Holders:
2 addresses
Transfers:
-
Profile Summary
Contract:
[ Download CSV Export ]
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0xc4849A993E49173B384D02Dd3f823288EAd5324c
Contract Name:
NFT1155
Compiler Version
v0.8.17+commit.8df45f5f
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2023-01-09 */ // SPDX-License-Identifier: MIT // Sources flattened with hardhat v2.10.1 https://hardhat.org // File @openzeppelin/contracts/utils/introspection/[email protected] // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File @openzeppelin/contracts/token/ERC1155/[email protected] // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol) pragma solidity ^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 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/[email protected] // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); } // File @openzeppelin/contracts/token/ERC1155/extensions/[email protected] // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^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/utils/[email protected] // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File @openzeppelin/contracts/utils/[email protected] // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File @openzeppelin/contracts/utils/introspection/[email protected] // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File @openzeppelin/contracts/token/ERC1155/[email protected] // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/ERC1155.sol) pragma solidity ^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 Address for address; // Mapping from token ID to account balances mapping(uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) public view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: address zero is not a valid owner"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token owner nor approved" ); _safeTransferFrom(from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token owner nor approved" ); _safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, to, ids, amounts, data); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; emit TransferSingle(operator, from, to, id, amount); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; } emit TransferBatch(operator, from, to, ids, amounts); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * 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 _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint256 i = 0; i < ids.length; i++) { _balances[ids[i]][to] += amounts[i]; } emit TransferBatch(operator, address(0), to, ids, amounts); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `amount` tokens of token type `id`. */ function _burn( address from, uint256 id, uint256 amount ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } emit TransferSingle(operator, from, address(0), id, amount); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch( address from, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } } emit TransferBatch(operator, from, address(0), ids, amounts); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `ids` and `amounts` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} /** * @dev Hook that is called after any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } } // File @openzeppelin/contracts/access/[email protected] // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^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() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File @openzeppelin/contracts/access/[email protected] // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; } // File @openzeppelin/contracts/utils/[email protected] // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } } // File @openzeppelin/contracts/access/[email protected] // OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol) pragma solidity ^0.8.0; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } } // File contracts/MetaTx.sol pragma solidity 0.8.17; abstract contract ContextMixin { function msgSender() internal view returns (address payable sender) { if (msg.sender == address(this)) { bytes memory array = msg.data; uint256 index = msg.data.length; assembly { // Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those. sender := and( mload(add(array, index)), 0xffffffffffffffffffffffffffffffffffffffff ) } } else { sender = payable(msg.sender); } return sender; } } abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } } contract EIP712Base is Initializable { struct EIP712Domain { string name; string version; address verifyingContract; bytes32 salt; } string constant public ERC712_VERSION = "1"; bytes32 internal constant EIP712_DOMAIN_TYPEHASH = keccak256( bytes( "EIP712Domain(string name,string version,address verifyingContract,bytes32 salt)" ) ); bytes32 internal domainSeperator; // supposed to be called once while initializing. // one of the contractsa that inherits this contract follows proxy pattern // so it is not possible to do this in a constructor function _initializeEIP712( string memory name ) internal initializer { _setDomainSeperator(name); } function _setDomainSeperator(string memory name) internal { domainSeperator = keccak256( abi.encode( EIP712_DOMAIN_TYPEHASH, keccak256(bytes(name)), keccak256(bytes(ERC712_VERSION)), address(this), bytes32(getChainId()) ) ); } function getDomainSeperator() public view returns (bytes32) { return domainSeperator; } function getChainId() public view returns (uint256) { uint256 id; assembly { id := chainid() } return id; } /** * Accept message hash and returns hash message in EIP712 compatible form * So that it can be used to recover signer from signature signed using EIP712 formatted data * https://eips.ethereum.org/EIPS/eip-712 * "\\x19" makes the encoding deterministic * "\\x01" is the version byte to make it compatible to EIP-191 */ function toTypedMessageHash(bytes32 messageHash) internal view returns (bytes32) { return keccak256( abi.encodePacked("\x19\x01", getDomainSeperator(), messageHash) ); } } contract NativeMetaTransaction is EIP712Base { bytes32 private constant META_TRANSACTION_TYPEHASH = keccak256( bytes( "MetaTransaction(uint256 nonce,address from,bytes functionSignature)" ) ); event MetaTransactionExecuted( address userAddress, address payable relayerAddress, bytes functionSignature ); mapping(address => uint256) nonces; /* * Meta transaction structure. * No point of including value field here as if user is doing value transfer then he has the funds to pay for gas * He should call the desired function directly in that case. */ struct MetaTransaction { uint256 nonce; address from; bytes functionSignature; } function executeMetaTransaction( address userAddress, bytes memory functionSignature, bytes32 sigR, bytes32 sigS, uint8 sigV ) public payable returns (bytes memory) { MetaTransaction memory metaTx = MetaTransaction({ nonce: nonces[userAddress], from: userAddress, functionSignature: functionSignature }); require( verify(userAddress, metaTx, sigR, sigS, sigV), "Signer and signature do not match" ); // increase nonce for user (to avoid re-use) nonces[userAddress]++; emit MetaTransactionExecuted( userAddress, payable(msg.sender), functionSignature ); // Append userAddress and relayer address at the end to extract it from calling context (bool success, bytes memory returnData) = address(this).call( abi.encodePacked(functionSignature, userAddress) ); require(success, "Function call not successful"); return returnData; } function hashMetaTransaction(MetaTransaction memory metaTx) internal pure returns (bytes32) { return keccak256( abi.encode( META_TRANSACTION_TYPEHASH, metaTx.nonce, metaTx.from, keccak256(metaTx.functionSignature) ) ); } function getNonce(address user) public view returns (uint256 nonce) { nonce = nonces[user]; } function verify( address signer, MetaTransaction memory metaTx, bytes32 sigR, bytes32 sigS, uint8 sigV ) internal view returns (bool) { require(signer != address(0), "NativeMetaTransaction: INVALID_SIGNER"); return signer == ecrecover( toTypedMessageHash(hashMetaTransaction(metaTx)), sigV, sigR, sigS ); } function approveFunctionSignature(address spenderAddress, uint256 amount) public pure returns (bytes memory) { return abi.encodePacked(bytes4(keccak256(bytes("approve(address,uint256)"))), abi.encode(spenderAddress, amount)); } function hashApproveMetaTx(address userAddress, address spenderAddress, uint256 amount, uint256 nonce) public view returns (bytes32, bytes32) { bytes memory functionSignature = approveFunctionSignature(spenderAddress, amount); MetaTransaction memory metaTx = MetaTransaction({ nonce: nonce, from: userAddress, functionSignature: functionSignature }); bytes32 messageHash = hashMetaTransaction(metaTx); return (toTypedMessageHash(messageHash), messageHash); } } // File contracts/NFT1155.sol pragma solidity 0.8.17; contract NFT1155 is ERC1155, ContextMixin, NativeMetaTransaction, Ownable, AccessControl { string public name; string public symbol; uint256 public currentTypeId = 0; uint256 public currentTokenId = 0; mapping(uint256 => uint256) public maxSupplyOfType; mapping(uint256 => uint256) public numberTokenOfType; mapping(uint256 => uint256) public typeOfToken; bool public canPayAndMint = false; mapping(uint256 => uint256) public priceOfType; event TypeCreated(uint256 indexed typeId, string externalId); event NftMinted(uint256 indexed typeId, uint256 indexed tokenId, address indexed account); event NftBurned(uint256 indexed tokenId, address indexed account); event WithdrewFund(address indexed receiver, uint amount); struct PayableType { uint256 typeId; uint256 price; } PayableType[] public payableTypes; constructor(string memory contractName, string memory contractSymbol, string memory contractUri) ERC1155(contractUri) { name = contractName; symbol = contractSymbol; _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _initializeEIP712(contractName); } function supportsInterface(bytes4 interfaceId) override(AccessControl, ERC1155) virtual public pure returns (bool) { return interfaceId == type(IAccessControl).interfaceId || interfaceId == type(IERC165).interfaceId || interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId; } function createType(uint256 maxSupply, string memory externalId) public onlyRole(DEFAULT_ADMIN_ROLE) returns (uint256) { require(maxSupply > 0, "max supply must be greater than 0"); uint256 typeId = ++currentTypeId; maxSupplyOfType[typeId] = maxSupply; typeOfToken[typeId] = typeId; emit TypeCreated(typeId, externalId); return typeId; } function createTypes(uint256[] calldata maxSupplies, string[] calldata externalIds) public onlyRole(DEFAULT_ADMIN_ROLE) { uint n = maxSupplies.length; require(externalIds.length == n, "input arrays must have the same length"); for (uint256 i = 0; i < n; ++i) { createType(maxSupplies[i], externalIds[i]); } } function updateMaxSupplies(uint256[] calldata typeIds, uint256[] calldata maxSupplies) public onlyRole(DEFAULT_ADMIN_ROLE) { require(typeIds.length > 0, "typeIds must have at least 1 item"); require(typeIds.length == maxSupplies.length, "typeIds and maxSupplies must have the same length"); for (uint i = 0; i < typeIds.length; i++) { require(maxSupplies[i] > numberTokenOfType[typeIds[i]], "max supply must be greater than current supply"); maxSupplyOfType[typeIds[i]] = maxSupplies[i]; } } function mintNft(uint256 typeId, address account) public onlyRole(DEFAULT_ADMIN_ROLE) returns (uint256) { return _mintNft(typeId, account); } function mintNfts(uint256 typeId, address account, uint amount) public onlyRole(DEFAULT_ADMIN_ROLE) { for (uint i = 0; i < amount; i++) { _mintNft(typeId, account); } } function createTypeAndMint(uint256 maxSupply, string memory externalId, address account) public onlyRole(DEFAULT_ADMIN_ROLE) { uint256 typeId = createType(maxSupply, externalId); _mintNft(typeId, account); } function burnNft(uint256 tokenId, address account) public onlyRole(DEFAULT_ADMIN_ROLE) { _burn(account, tokenId, 1); emit NftBurned(tokenId, account); } function setTypesPrice(uint256[] memory typeIds, uint256[] memory prices) external onlyRole(DEFAULT_ADMIN_ROLE) { require(typeIds.length > 0, "typeIds must have at least 1 item"); require(typeIds.length == prices.length, "typeIds and prices must have the same length"); for (uint i = 0; i < payableTypes.length; i++) { uint256 typeId = payableTypes[i].typeId; delete priceOfType[typeId]; } delete payableTypes; for (uint i = 0; i < typeIds.length; i++) { require(prices[i] > 0, "all price must be greater than 0"); priceOfType[typeIds[i]] = prices[i]; payableTypes.push(PayableType(typeIds[i], prices[i])); } } function setCanPayAndMint(bool canPayAndMint_) external onlyRole(DEFAULT_ADMIN_ROLE) { canPayAndMint = canPayAndMint_; } function payAndMint(uint256 typeId, uint amount) external payable { require(canPayAndMint, "pay and mint is not allowed"); require(numberTokenOfType[typeId] + amount <= maxSupplyOfType[typeId], "not enough supply to mint"); uint256 price = priceOfType[typeId]; require(price > 0, "type price is undefined"); require(msg.value >= price * amount, "received fund is not enough"); address receiver = _msgSender(); uint256 change = msg.value; while (amount > 0) { _mintNft(typeId, receiver); change -= price; amount--; } if (change > 0) { payable(msg.sender).transfer(change); } } function allPayableTypes() external view returns (PayableType[] memory) { return payableTypes; } function typeOfTokens(uint256[] calldata tokenIds) external view returns (uint256[] memory) { uint n = tokenIds.length; uint256[] memory tokenTypes = new uint256[](n); for (uint i = 0; i < n; i++) { tokenTypes[i] = typeOfToken[tokenIds[i]]; } return tokenTypes; } function maxSupplyOfTypes(uint256[] calldata typeIds) external view returns (uint256[] memory) { uint n = typeIds.length; uint256[] memory maxSupplies = new uint256[](n); for (uint i = 0; i < n; i++) { maxSupplies[i] = maxSupplyOfType[typeIds[i]]; } return maxSupplies; } function numberTokenOfTypes(uint256[] calldata typeIds) external view returns (uint256[] memory) { uint n = typeIds.length; uint256[] memory numberTokens = new uint256[](n); for (uint i = 0; i < n; i++) { numberTokens[i] = numberTokenOfType[typeIds[i]]; } return numberTokens; } function priceOfTypes(uint256[] calldata typeIds) external view returns (uint256[] memory) { uint n = typeIds.length; uint256[] memory prices = new uint256[](n); for (uint i = 0; i < n; i++) { prices[i] = priceOfType[typeIds[i]]; } return prices; } function withdrawTo(address payable receiver) external onlyOwner { uint amount = address(this).balance; (bool success, ) = receiver.call{value: amount}(""); require(success, "failed to withdraw fund"); emit WithdrewFund(receiver, amount); } function balance() external view returns (uint256) { return address(this).balance; } function _mintNft(uint256 typeId, address account) internal returns (uint256) { require(numberTokenOfType[typeId] < maxSupplyOfType[typeId], "no more supply to mint"); numberTokenOfType[typeId]++; uint256 tokenId = ++currentTokenId; typeOfToken[tokenId] = typeId; _mint(account, tokenId, 1, new bytes(0)); emit NftMinted(typeId, tokenId, account); return tokenId; } function _msgSender() internal override view returns (address) { return ContextMixin.msgSender(); } }
[{"inputs":[{"internalType":"string","name":"contractName","type":"string"},{"internalType":"string","name":"contractSymbol","type":"string"},{"internalType":"string","name":"contractUri","type":"string"}],"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":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"address payable","name":"relayerAddress","type":"address"},{"indexed":false,"internalType":"bytes","name":"functionSignature","type":"bytes"}],"name":"MetaTransactionExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"NftBurned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"typeId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"NftMinted","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":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","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":true,"internalType":"uint256","name":"typeId","type":"uint256"},{"indexed":false,"internalType":"string","name":"externalId","type":"string"}],"name":"TypeCreated","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrewFund","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ERC712_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allPayableTypes","outputs":[{"components":[{"internalType":"uint256","name":"typeId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct NFT1155.PayableType[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spenderAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approveFunctionSignature","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"burnNft","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"canPayAndMint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"string","name":"externalId","type":"string"}],"name":"createType","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"string","name":"externalId","type":"string"},{"internalType":"address","name":"account","type":"address"}],"name":"createTypeAndMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"maxSupplies","type":"uint256[]"},{"internalType":"string[]","name":"externalIds","type":"string[]"}],"name":"createTypes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentTypeId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"bytes","name":"functionSignature","type":"bytes"},{"internalType":"bytes32","name":"sigR","type":"bytes32"},{"internalType":"bytes32","name":"sigS","type":"bytes32"},{"internalType":"uint8","name":"sigV","type":"uint8"}],"name":"executeMetaTransaction","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDomainSeperator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getNonce","outputs":[{"internalType":"uint256","name":"nonce","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"address","name":"spenderAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"hashApproveMetaTx","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"bytes32","name":"","type":"bytes32"}],"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":"maxSupplyOfType","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"typeIds","type":"uint256[]"}],"name":"maxSupplyOfTypes","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"typeId","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"mintNft","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"typeId","type":"uint256"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintNfts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"numberTokenOfType","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"typeIds","type":"uint256[]"}],"name":"numberTokenOfTypes","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"typeId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"payAndMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"payableTypes","outputs":[{"internalType":"uint256","name":"typeId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"priceOfType","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"typeIds","type":"uint256[]"}],"name":"priceOfTypes","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","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":"bool","name":"canPayAndMint_","type":"bool"}],"name":"setCanPayAndMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"typeIds","type":"uint256[]"},{"internalType":"uint256[]","name":"prices","type":"uint256[]"}],"name":"setTypesPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"typeOfToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"typeOfTokens","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"typeIds","type":"uint256[]"},{"internalType":"uint256[]","name":"maxSupplies","type":"uint256[]"}],"name":"updateMaxSupplies","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":"address payable","name":"receiver","type":"address"}],"name":"withdrawTo","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040526000600a819055600b55600f805460ff191690553480156200002557600080fd5b50604051620044aa380380620044aa83398101604081905262000048916200046e565b806200005481620000b1565b506200006962000063620000c3565b620000df565b60086200007784826200058e565b5060096200008683826200058e565b506200009d600062000097620000c3565b62000131565b620000a8836200013d565b5050506200065a565b6002620000bf82826200058e565b5050565b6000620000da6200020360201b62001f231760201c565b905090565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b620000bf828262000261565b600354610100900460ff168062000157575060035460ff16155b620001bf5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b600354610100900460ff16158015620001e2576003805461ffff19166101011790555b620001ed8262000307565b8015620000bf576003805461ff00191690555050565b60003033036200025b57600080368080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050503601516001600160a01b031691506200025e9050565b50335b90565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff16620000bf5760008281526007602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620002c3620000c3565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6040518060800160405280604f81526020016200445b604f9139805160209182012082519282019290922060408051808201825260018152603160f81b90840152805180840194909452838101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608401523060808401524660a0808501919091528151808503909101815260c090930190528151910120600455565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620003d157600080fd5b81516001600160401b0380821115620003ee57620003ee620003a9565b604051601f8301601f19908116603f01168101908282118183101715620004195762000419620003a9565b816040528381526020925086838588010111156200043657600080fd5b600091505b838210156200045a57858201830151818301840152908201906200043b565b600093810190920192909252949350505050565b6000806000606084860312156200048457600080fd5b83516001600160401b03808211156200049c57600080fd5b620004aa87838801620003bf565b94506020860151915080821115620004c157600080fd5b620004cf87838801620003bf565b93506040860151915080821115620004e657600080fd5b50620004f586828701620003bf565b9150509250925092565b600181811c908216806200051457607f821691505b6020821081036200053557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200058957600081815260208120601f850160051c81016020861015620005645750805b601f850160051c820191505b81811015620005855782815560010162000570565b5050505b505050565b81516001600160401b03811115620005aa57620005aa620003a9565b620005c281620005bb8454620004ff565b846200053b565b602080601f831160018114620005fa5760008415620005e15750858301515b600019600386901b1c1916600185901b17855562000585565b600085815260208120601f198616915b828110156200062b578886015182559484019460019091019084016200060a565b50858210156200064a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b613df1806200066a6000396000f3fe6080604052600436106102e25760003560e01c8063743fa60411610190578063bba0c00a116100dc578063e985e9c511610095578063f242432a1161006f578063f242432a14610929578063f2fde38b14610949578063f50f83a114610969578063fb49a3861461099657600080fd5b8063e985e9c51461089e578063ebaf50e1146108e7578063f0b6cbbe1461090757600080fd5b8063bba0c00a146107e8578063c6fdac68146107fe578063d547741f1461081e578063d8b97f631461083e578063e06cb3d41461085e578063e8a96e001461087e57600080fd5b80639350e1c211610149578063a22a420d11610123578063a22a420d14610775578063a22cb46514610795578063a5d4ee7e146107b5578063b69ef8a8146107d557600080fd5b80639350e1c21461072b57806395d89b411461074b578063a217fddf1461076057600080fd5b8063743fa6041461064157806388a8bd491461066e57806388f4739c146106a35780638da5cb5b146106c357806391d14854146106eb5780639232fa4c1461070b57600080fd5b806320379ee51161024f5780633408e4701161020857806357e476c3116101e257806357e476c3146105bf57806367b5560a146105ec578063715018a61461060c57806372b0d90c1461062157600080fd5b80633408e4701461055f57806336568abe146105725780634e1273f41461059257600080fd5b806320379ee514610484578063248a9ca31461049957806327376c1d146104c95780632d0335ab146104e95780632eb2c2d61461051f5780632f2ff15d1461053f57600080fd5b80630c53c51c116102a15780630c53c51c146103d15780630cb86c7d146103e45780630e89341c146104045780630f7e59701461042457806310e1920c14610451578063158b25211461047157600080fd5b80629a9b7b146102e7578062fdd58e14610310578063016c71bd1461033057806301ffc9a71461035d57806306fdde031461038d57806309bcb8d6146103af575b600080fd5b3480156102f357600080fd5b506102fd600b5481565b6040519081526020015b60405180910390f35b34801561031c57600080fd5b506102fd61032b366004612fd5565b6109b0565b34801561033c57600080fd5b506102fd61034b366004613001565b600e6020526000908152604090205481565b34801561036957600080fd5b5061037d610378366004613030565b610a49565b6040519015158152602001610307565b34801561039957600080fd5b506103a2610ab5565b604051610307919061309d565b3480156103bb57600080fd5b506103cf6103ca3660046130b0565b610b43565b005b6103a26103df366004613195565b610b95565b3480156103f057600080fd5b506103a26103ff366004612fd5565b610d67565b34801561041057600080fd5b506103a261041f366004613001565b610e0b565b34801561043057600080fd5b506103a2604051806040016040528060018152602001603160f81b81525081565b34801561045d57600080fd5b506102fd61046c366004613212565b610e9f565b6103cf61047f366004613258565b610f7e565b34801561049057600080fd5b506004546102fd565b3480156104a557600080fd5b506102fd6104b4366004613001565b60009081526007602052604090206001015490565b3480156104d557600080fd5b506103cf6104e436600461330e565b611172565b3480156104f557600080fd5b506102fd610504366004613367565b6001600160a01b031660009081526005602052604090205490565b34801561052b57600080fd5b506103cf61053a366004613384565b6113ab565b34801561054b57600080fd5b506103cf61055a3660046130b0565b611402565b34801561056b57600080fd5b50466102fd565b34801561057e57600080fd5b506103cf61058d3660046130b0565b61142c565b34801561059e57600080fd5b506105b26105ad366004613431565b6114ba565b6040516103079190613521565b3480156105cb57600080fd5b506102fd6105da366004613001565b600d6020526000908152604090205481565b3480156105f857600080fd5b506105b261060736600461357f565b6115e3565b34801561061857600080fd5b506103cf61169b565b34801561062d57600080fd5b506103cf61063c366004613367565b6116af565b34801561064d57600080fd5b506102fd61065c366004613001565b600c6020526000908152604090205481565b34801561067a57600080fd5b5061068e610689366004613001565b6117a2565b60408051928352602083019190915201610307565b3480156106af57600080fd5b5061068e6106be3660046135c0565b6117d0565b3480156106cf57600080fd5b506006546040516001600160a01b039091168152602001610307565b3480156106f757600080fd5b5061037d6107063660046130b0565b611828565b34801561071757600080fd5b506103cf610726366004613606565b611853565b34801561073757600080fd5b506105b261074636600461357f565b61195c565b34801561075757600080fd5b506103a2611a0b565b34801561076c57600080fd5b506102fd600081565b34801561078157600080fd5b506102fd6107903660046130b0565b611a18565b3480156107a157600080fd5b506103cf6107b0366004613686565b611a36565b3480156107c157600080fd5b506103cf6107d03660046136bb565b611a48565b3480156107e157600080fd5b50476102fd565b3480156107f457600080fd5b506102fd600a5481565b34801561080a57600080fd5b506103cf610819366004613715565b611a6b565b34801561082a57600080fd5b506103cf6108393660046130b0565b611a9e565b34801561084a57600080fd5b506105b261085936600461357f565b611ac3565b34801561086a57600080fd5b506103cf61087936600461374d565b611b72565b34801561088a57600080fd5b506103cf610899366004613606565b611b91565b3480156108aa57600080fd5b5061037d6108b9366004613768565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b3480156108f357600080fd5b506105b261090236600461357f565b611d31565b34801561091357600080fd5b5061091c611de0565b6040516103079190613796565b34801561093557600080fd5b506103cf6109443660046137e5565b611e53565b34801561095557600080fd5b506103cf610964366004613367565b611eaa565b34801561097557600080fd5b506102fd610984366004613001565b60106020526000908152604090205481565b3480156109a257600080fd5b50600f5461037d9060ff1681565b60006001600160a01b038316610a205760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b60648201526084015b60405180910390fd5b506000818152602081815260408083206001600160a01b03861684529091529020545b92915050565b60006001600160e01b03198216637965db0b60e01b1480610a7a57506001600160e01b031982166301ffc9a760e01b145b80610a9557506001600160e01b03198216636cdb3d1360e11b145b80610a4357506001600160e01b031982166303a24d0760e21b1492915050565b60088054610ac29061384d565b80601f0160208091040260200160405190810160405280929190818152602001828054610aee9061384d565b8015610b3b5780601f10610b1057610100808354040283529160200191610b3b565b820191906000526020600020905b815481529060010190602001808311610b1e57829003601f168201915b505050505081565b6000610b4e81611f7f565b610b5a82846001611f90565b6040516001600160a01b0383169084907f49d495860fec73fbe6e7c300aaaae55330c5e35cea66e38a2de0988d4b06a49690600090a3505050565b60408051606081810183526001600160a01b03881660008181526005602090815290859020548452830152918101869052610bd38782878787612135565b610c295760405162461bcd60e51b815260206004820152602160248201527f5369676e657220616e64207369676e617475726520646f206e6f74206d6174636044820152600d60fb1b6064820152608401610a17565b6001600160a01b0387166000908152600560205260408120805491610c4d8361389d565b91905055507f5845892132946850460bff5a0083f71031bc5bf9aadcd40f1de79423eac9b10b873388604051610c85939291906138b6565b60405180910390a1600080306001600160a01b0316888a604051602001610cad9291906138eb565b60408051601f1981840301815290829052610cc791613922565b6000604051808303816000865af19150503d8060008114610d04576040519150601f19603f3d011682016040523d82523d6000602084013e610d09565b606091505b509150915081610d5b5760405162461bcd60e51b815260206004820152601c60248201527f46756e6374696f6e2063616c6c206e6f74207375636365737366756c000000006044820152606401610a17565b98975050505050505050565b604080518082018252601881527f617070726f766528616464726573732c75696e7432353629000000000000000060209182015281516001600160a01b038516918101919091528082018390528151808203830181526060808301909352610df4917f095ea7b334ae44009aa867bfb386f5c3b4b443ac6f0ee573fa91c4608fbadfba919060800161393e565b604051602081830303815290604052905092915050565b606060028054610e1a9061384d565b80601f0160208091040260200160405190810160405280929190818152602001828054610e469061384d565b8015610e935780601f10610e6857610100808354040283529160200191610e93565b820191906000526020600020905b815481529060010190602001808311610e7657829003601f168201915b50505050509050919050565b600080610eab81611f7f565b60008411610f055760405162461bcd60e51b815260206004820152602160248201527f6d617820737570706c79206d7573742062652067726561746572207468616e206044820152600360fc1b6064820152608401610a17565b6000600a60008154610f169061389d565b91829055506000818152600c60209081526040808320899055600e909152908190208290555190915081907fd7cdb19babc5c7401941569e91075b3cde0ba53f2ad6218317db941c6c7f568990610f6e90879061309d565b60405180910390a2949350505050565b600f5460ff16610fd05760405162461bcd60e51b815260206004820152601b60248201527f70617920616e64206d696e74206973206e6f7420616c6c6f77656400000000006044820152606401610a17565b6000828152600c6020908152604080832054600d90925290912054610ff690839061396f565b11156110445760405162461bcd60e51b815260206004820152601960248201527f6e6f7420656e6f75676820737570706c7920746f206d696e74000000000000006044820152606401610a17565b600082815260106020526040902054806110a05760405162461bcd60e51b815260206004820152601760248201527f7479706520707269636520697320756e646566696e65640000000000000000006044820152606401610a17565b6110aa8282613982565b3410156110f95760405162461bcd60e51b815260206004820152601b60248201527f72656365697665642066756e64206973206e6f7420656e6f75676800000000006044820152606401610a17565b6000611103612225565b9050345b8315611136576111178583612234565b506111228382613999565b90508361112e816139ac565b945050611107565b801561116b57604051339082156108fc029083906000818181858888f19350505050158015611169573d6000803e3d6000fd5b505b5050505050565b600061117d81611f7f565b600083511161119e5760405162461bcd60e51b8152600401610a17906139c3565b81518351146112045760405162461bcd60e51b815260206004820152602c60248201527f7479706549647320616e6420707269636573206d75737420686176652074686560448201526b040e6c2daca40d8cadccee8d60a31b6064820152608401610a17565b60005b6011548110156112575760006011828154811061122657611226613a04565b600091825260208083206002909202909101548252601090526040812055508061124f8161389d565b915050611207565b5061126460116000612f85565b60005b83518110156113a557600083828151811061128457611284613a04565b6020026020010151116112d95760405162461bcd60e51b815260206004820181905260248201527f616c6c207072696365206d7573742062652067726561746572207468616e20306044820152606401610a17565b8281815181106112eb576112eb613a04565b60200260200101516010600086848151811061130957611309613a04565b60200260200101518152602001908152602001600020819055506011604051806040016040528086848151811061134257611342613a04565b6020026020010151815260200185848151811061136157611361613a04565b60209081029190910181015190915282546001818101855560009485529382902083516002909202019081559101519101558061139d8161389d565b915050611267565b50505050565b6113b3612225565b6001600160a01b0316856001600160a01b031614806113d957506113d9856108b9612225565b6113f55760405162461bcd60e51b8152600401610a1790613a1a565b61116b8585858585612339565b60008281526007602052604090206001015461141d81611f7f565b6114278383612535565b505050565b611434612225565b6001600160a01b0316816001600160a01b0316146114ac5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610a17565b6114b682826125bc565b5050565b6060815183511461151f5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610a17565b600083516001600160401b0381111561153a5761153a6130e0565b604051908082528060200260200182016040528015611563578160200160208202803683370190505b50905060005b84518110156115db576115ae85828151811061158757611587613a04565b60200260200101518583815181106115a1576115a1613a04565b60200260200101516109b0565b8282815181106115c0576115c0613a04565b60209081029190910101526115d48161389d565b9050611569565b509392505050565b6060816000816001600160401b03811115611600576116006130e0565b604051908082528060200260200182016040528015611629578160200160208202803683370190505b50905060005b82811015611692576010600087878481811061164d5761164d613a04565b9050602002013581526020019081526020016000205482828151811061167557611675613a04565b60209081029190910101528061168a8161389d565b91505061162f565b50949350505050565b6116a3612641565b6116ad60006126ba565b565b6116b7612641565b60405147906000906001600160a01b0384169083908381818185875af1925050503d8060008114611704576040519150601f19603f3d011682016040523d82523d6000602084013e611709565b606091505b505090508061175a5760405162461bcd60e51b815260206004820152601760248201527f6661696c656420746f2077697468647261772066756e640000000000000000006044820152606401610a17565b826001600160a01b03167fbf6e0852c0a915fa478be9b26ba99bde08193995cc787e72a315f65db6a3cc658360405161179591815260200190565b60405180910390a2505050565b601181815481106117b257600080fd5b60009182526020909120600290910201805460019091015490915082565b60008060006117df8686610d67565b604080516060810182528681526001600160a01b038a166020820152908101829052909150600061180f8261270c565b905061181a81612789565b999098509650505050505050565b60009182526007602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600061185e81611f7f565b838281146118bd5760405162461bcd60e51b815260206004820152602660248201527f696e70757420617272617973206d7573742068617665207468652073616d65206044820152650d8cadccee8d60d31b6064820152608401610a17565b60005b81811015611953576119428787838181106118dd576118dd613a04565b905060200201358686848181106118f6576118f6613a04565b90506020028101906119089190613a69565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610e9f92505050565b5061194c8161389d565b90506118c0565b50505050505050565b6060816000816001600160401b03811115611979576119796130e0565b6040519080825280602002602001820160405280156119a2578160200160208202803683370190505b50905060005b8281101561169257600e60008787848181106119c6576119c6613a04565b905060200201358152602001908152602001600020548282815181106119ee576119ee613a04565b602090810291909101015280611a038161389d565b9150506119a8565b60098054610ac29061384d565b600080611a2481611f7f565b611a2e8484612234565b949350505050565b6114b6611a41612225565b83836127b9565b6000611a5381611f7f565b6000611a5f8585610e9f565b90506111698184612234565b6000611a7681611f7f565b60005b8281101561116b57611a8b8585612234565b5080611a968161389d565b915050611a79565b600082815260076020526040902060010154611ab981611f7f565b61142783836125bc565b6060816000816001600160401b03811115611ae057611ae06130e0565b604051908082528060200260200182016040528015611b09578160200160208202803683370190505b50905060005b8281101561169257600c6000878784818110611b2d57611b2d613a04565b90506020020135815260200190815260200160002054828281518110611b5557611b55613a04565b602090810291909101015280611b6a8161389d565b915050611b0f565b6000611b7d81611f7f565b50600f805460ff1916911515919091179055565b6000611b9c81611f7f565b83611bb95760405162461bcd60e51b8152600401610a17906139c3565b838214611c225760405162461bcd60e51b815260206004820152603160248201527f7479706549647320616e64206d6178537570706c696573206d757374206861766044820152700ca40e8d0ca40e6c2daca40d8cadccee8d607b1b6064820152608401610a17565b60005b8481101561116957600d6000878784818110611c4357611c43613a04565b90506020020135815260200190815260200160002054848483818110611c6b57611c6b613a04565b9050602002013511611cd65760405162461bcd60e51b815260206004820152602e60248201527f6d617820737570706c79206d7573742062652067726561746572207468616e2060448201526d63757272656e7420737570706c7960901b6064820152608401610a17565b838382818110611ce857611ce8613a04565b90506020020135600c6000888885818110611d0557611d05613a04565b905060200201358152602001908152602001600020819055508080611d299061389d565b915050611c25565b6060816000816001600160401b03811115611d4e57611d4e6130e0565b604051908082528060200260200182016040528015611d77578160200160208202803683370190505b50905060005b8281101561169257600d6000878784818110611d9b57611d9b613a04565b90506020020135815260200190815260200160002054828281518110611dc357611dc3613a04565b602090810291909101015280611dd88161389d565b915050611d7d565b60606011805480602002602001604051908101604052809291908181526020016000905b82821015611e4a57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611e04565b50505050905090565b611e5b612225565b6001600160a01b0316856001600160a01b03161480611e815750611e81856108b9612225565b611e9d5760405162461bcd60e51b8152600401610a1790613a1a565b61116b8585858585612899565b611eb2612641565b6001600160a01b038116611f175760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a17565b611f20816126ba565b50565b6000303303611f7957600080368080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050503601516001600160a01b03169150611f7c9050565b50335b90565b611f2081611f8b612225565b6129ea565b6001600160a01b038316611ff25760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b6064820152608401610a17565b6000611ffc612225565b9050600061200984612a4e565b9050600061201684612a4e565b905061203683876000858560405180602001604052806000815250611169565b6000858152602081815260408083206001600160a01b038a168452909152902054848110156120b35760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b6064820152608401610a17565b6000868152602081815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461195384886000868660405180602001604052806000815250611169565b60006001600160a01b03861661219b5760405162461bcd60e51b815260206004820152602560248201527f4e61746976654d6574615472616e73616374696f6e3a20494e56414c49445f5360448201526424a3a722a960d91b6064820152608401610a17565b60016121ae6121a98761270c565b612789565b6040805160008152602081018083529290925260ff851690820152606081018690526080810185905260a0016020604051602081039080840390855afa1580156121fc573d6000803e3d6000fd5b505050602060405103516001600160a01b0316866001600160a01b031614905095945050505050565b600061222f611f23565b905090565b6000828152600c6020908152604080832054600d909252822054106122945760405162461bcd60e51b81526020600482015260166024820152751b9bc81b5bdc99481cdd5c1c1b1e481d1bc81b5a5b9d60521b6044820152606401610a17565b6000838152600d602052604081208054916122ae8361389d565b91905055506000600b600081546122c49061389d565b91829055506000818152600e60209081526040808320889055805192835290820190529091506122fa9084908390600190612a99565b826001600160a01b031681857fe39f22ca47b4a095efc2fab20dc9f99f196019313205d257e2e5f3ea98ae233360405160405180910390a49392505050565b815183511461239b5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608401610a17565b6001600160a01b0384166123c15760405162461bcd60e51b8152600401610a1790613aaf565b60006123cb612225565b90506123db818787878787611169565b60005b84518110156124c15760008582815181106123fb576123fb613a04565b60200260200101519050600085838151811061241957612419613a04565b602090810291909101810151600084815280835260408082206001600160a01b038e1683529093529190912054909150818110156124695760405162461bcd60e51b8152600401610a1790613af4565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b168252812080548492906124a690849061396f565b92505081905550505050806124ba9061389d565b90506123de565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051612511929190613b3e565b60405180910390a4612527818787878787611169565b611169818787878787612bcd565b61253f8282611828565b6114b65760008281526007602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612578612225565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6125c68282611828565b156114b65760008281526007602090815260408083206001600160a01b03851684529091529020805460ff191690556125fd612225565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b612649612225565b6001600160a01b03166126646006546001600160a01b031690565b6001600160a01b0316146116ad5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a17565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000604051806080016040528060438152602001613d79604391398051602091820120835184830151604080870151805190860120905161276c950193845260208401929092526001600160a01b03166040830152606082015260800190565b604051602081830303815290604052805190602001209050919050565b600061279460045490565b60405161190160f01b602082015260228101919091526042810183905260620161276c565b816001600160a01b0316836001600160a01b03160361282c5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608401610a17565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0384166128bf5760405162461bcd60e51b8152600401610a1790613aaf565b60006128c9612225565b905060006128d685612a4e565b905060006128e385612a4e565b90506128f3838989858589611169565b6000868152602081815260408083206001600160a01b038c168452909152902054858110156129345760405162461bcd60e51b8152600401610a1790613af4565b6000878152602081815260408083206001600160a01b038d8116855292528083208985039055908a1682528120805488929061297190849061396f565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46129d1848a8a86868a611169565b6129df848a8a8a8a8a612d28565b505050505050505050565b6129f48282611828565b6114b657612a0c816001600160a01b03166014612de3565b612a17836020612de3565b604051602001612a28929190613b63565b60408051601f198184030181529082905262461bcd60e51b8252610a179160040161309d565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110612a8857612a88613a04565b602090810291909101015292915050565b6001600160a01b038416612af95760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b6064820152608401610a17565b6000612b03612225565b90506000612b1085612a4e565b90506000612b1d85612a4e565b9050612b2e83600089858589611169565b6000868152602081815260408083206001600160a01b038b16845290915281208054879290612b5e90849061396f565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612bbe83600089858589611169565b61195383600089898989612d28565b6001600160a01b0384163b156111695760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190612c119089908990889088908890600401613bd8565b6020604051808303816000875af1925050508015612c4c575060408051601f3d908101601f19168201909252612c4991810190613c2a565b60015b612cf857612c58613c47565b806308c379a003612c915750612c6c613c62565b80612c775750612c93565b8060405162461bcd60e51b8152600401610a17919061309d565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e20455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b6064820152608401610a17565b6001600160e01b0319811663bc197c8160e01b146119535760405162461bcd60e51b8152600401610a1790613ceb565b6001600160a01b0384163b156111695760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190612d6c9089908990889088908890600401613d33565b6020604051808303816000875af1925050508015612da7575060408051601f3d908101601f19168201909252612da491810190613c2a565b60015b612db357612c58613c47565b6001600160e01b0319811663f23a6e6160e01b146119535760405162461bcd60e51b8152600401610a1790613ceb565b60606000612df2836002613982565b612dfd90600261396f565b6001600160401b03811115612e1457612e146130e0565b6040519080825280601f01601f191660200182016040528015612e3e576020820181803683370190505b509050600360fc1b81600081518110612e5957612e59613a04565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612e8857612e88613a04565b60200101906001600160f81b031916908160001a9053506000612eac846002613982565b612eb790600161396f565b90505b6001811115612f2f576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612eeb57612eeb613a04565b1a60f81b828281518110612f0157612f01613a04565b60200101906001600160f81b031916908160001a90535060049490941c93612f28816139ac565b9050612eba565b508315612f7e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610a17565b9392505050565b5080546000825560020290600052602060002090810190611f2091905b80821115612fbc5760008082556001820155600201612fa2565b5090565b6001600160a01b0381168114611f2057600080fd5b60008060408385031215612fe857600080fd5b8235612ff381612fc0565b946020939093013593505050565b60006020828403121561301357600080fd5b5035919050565b6001600160e01b031981168114611f2057600080fd5b60006020828403121561304257600080fd5b8135612f7e8161301a565b60005b83811015613068578181015183820152602001613050565b50506000910152565b6000815180845261308981602086016020860161304d565b601f01601f19169290920160200192915050565b602081526000612f7e6020830184613071565b600080604083850312156130c357600080fd5b8235915060208301356130d581612fc0565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b038111828210171561311b5761311b6130e0565b6040525050565b600082601f83011261313357600080fd5b81356001600160401b0381111561314c5761314c6130e0565b604051613163601f8301601f1916602001826130f6565b81815284602083860101111561317857600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156131ad57600080fd5b85356131b881612fc0565b945060208601356001600160401b038111156131d357600080fd5b6131df88828901613122565b9450506040860135925060608601359150608086013560ff8116811461320457600080fd5b809150509295509295909350565b6000806040838503121561322557600080fd5b8235915060208301356001600160401b0381111561324257600080fd5b61324e85828601613122565b9150509250929050565b6000806040838503121561326b57600080fd5b50508035926020909101359150565b60006001600160401b03821115613293576132936130e0565b5060051b60200190565b600082601f8301126132ae57600080fd5b813560206132bb8261327a565b6040516132c882826130f6565b83815260059390931b85018201928281019150868411156132e857600080fd5b8286015b8481101561330357803583529183019183016132ec565b509695505050505050565b6000806040838503121561332157600080fd5b82356001600160401b038082111561333857600080fd5b6133448683870161329d565b9350602085013591508082111561335a57600080fd5b5061324e8582860161329d565b60006020828403121561337957600080fd5b8135612f7e81612fc0565b600080600080600060a0868803121561339c57600080fd5b85356133a781612fc0565b945060208601356133b781612fc0565b935060408601356001600160401b03808211156133d357600080fd5b6133df89838a0161329d565b945060608801359150808211156133f557600080fd5b61340189838a0161329d565b9350608088013591508082111561341757600080fd5b5061342488828901613122565b9150509295509295909350565b6000806040838503121561344457600080fd5b82356001600160401b038082111561345b57600080fd5b818501915085601f83011261346f57600080fd5b8135602061347c8261327a565b60405161348982826130f6565b83815260059390931b85018201928281019150898411156134a957600080fd5b948201945b838610156134d05785356134c181612fc0565b825294820194908201906134ae565b9650508601359250508082111561335a57600080fd5b600081518084526020808501945080840160005b83811015613516578151875295820195908201906001016134fa565b509495945050505050565b602081526000612f7e60208301846134e6565b60008083601f84011261354657600080fd5b5081356001600160401b0381111561355d57600080fd5b6020830191508360208260051b850101111561357857600080fd5b9250929050565b6000806020838503121561359257600080fd5b82356001600160401b038111156135a857600080fd5b6135b485828601613534565b90969095509350505050565b600080600080608085870312156135d657600080fd5b84356135e181612fc0565b935060208501356135f181612fc0565b93969395505050506040820135916060013590565b6000806000806040858703121561361c57600080fd5b84356001600160401b038082111561363357600080fd5b61363f88838901613534565b9096509450602087013591508082111561365857600080fd5b5061366587828801613534565b95989497509550505050565b8035801515811461368157600080fd5b919050565b6000806040838503121561369957600080fd5b82356136a481612fc0565b91506136b260208401613671565b90509250929050565b6000806000606084860312156136d057600080fd5b8335925060208401356001600160401b038111156136ed57600080fd5b6136f986828701613122565b925050604084013561370a81612fc0565b809150509250925092565b60008060006060848603121561372a57600080fd5b83359250602084013561373c81612fc0565b929592945050506040919091013590565b60006020828403121561375f57600080fd5b612f7e82613671565b6000806040838503121561377b57600080fd5b823561378681612fc0565b915060208301356130d581612fc0565b602080825282518282018190526000919060409081850190868401855b828110156137d8578151805185528601518685015292840192908501906001016137b3565b5091979650505050505050565b600080600080600060a086880312156137fd57600080fd5b853561380881612fc0565b9450602086013561381881612fc0565b9350604086013592506060860135915060808601356001600160401b0381111561384157600080fd5b61342488828901613122565b600181811c9082168061386157607f821691505b60208210810361388157634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000600182016138af576138af613887565b5060010190565b6001600160a01b038481168252831660208201526060604082018190526000906138e290830184613071565b95945050505050565b600083516138fd81846020880161304d565b60609390931b6bffffffffffffffffffffffff19169190920190815260140192915050565b6000825161393481846020870161304d565b9190910192915050565b6001600160e01b031983168152815160009061396181600485016020870161304d565b919091016004019392505050565b80820180821115610a4357610a43613887565b8082028115828204841417610a4357610a43613887565b81810381811115610a4357610a43613887565b6000816139bb576139bb613887565b506000190190565b60208082526021908201527f74797065496473206d7573742068617665206174206c656173742031206974656040820152606d60f81b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6020808252602f908201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60408201526e195c881b9bdc88185c1c1c9bdd9959608a1b606082015260800190565b6000808335601e19843603018112613a8057600080fd5b8301803591506001600160401b03821115613a9a57600080fd5b60200191503681900382131561357857600080fd5b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b604081526000613b5160408301856134e6565b82810360208401526138e281856134e6565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613b9b81601785016020880161304d565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613bcc81602884016020880161304d565b01602801949350505050565b6001600160a01b0386811682528516602082015260a060408201819052600090613c04908301866134e6565b8281036060840152613c1681866134e6565b90508281036080840152610d5b8185613071565b600060208284031215613c3c57600080fd5b8151612f7e8161301a565b600060033d1115611f7c5760046000803e5060005160e01c90565b600060443d1015613c705790565b6040516003193d81016004833e81513d6001600160401b038160248401118184111715613c9f57505050505090565b8285019150815181811115613cb75750505050505090565b843d8701016020828501011115613cd15750505050505090565b613ce0602082860101876130f6565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090613d6d90830184613071565b97965050505050505056fe4d6574615472616e73616374696f6e2875696e74323536206e6f6e63652c616464726573732066726f6d2c62797465732066756e6374696f6e5369676e617475726529a2646970667358221220b6c65a86c207adf9e435f170a92827d9790c4c521f7c0aa7f8c39e1a75d680fa64736f6c63430008110033454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c6164647265737320766572696679696e67436f6e74726163742c627974657333322073616c7429000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000010417765736f6d652050657473204e465400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d415745534f4d45504554533038000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000068687474703a2f2f6c6f63616c686f73743a383838382f76312f6765745f746f6b656e5f6d657461646174613f636f6e747261637449643d63373663623865312d313932642d346664652d383062362d63373438393339306235666626746f6b656e49643d7b69647d000000000000000000000000000000000000000000000000