Transaction Hash:
Block:
15951354 at Nov-12-2022 03:48:59 AM +UTC
Transaction Fee:
0.00072136877532927 ETH
$1.76
Gas Used:
43,894 Gas / 16.434336705 Gwei
Account State Difference:
Address | Before | After | State Difference | ||
---|---|---|---|---|---|
0x1dE0aef4...eB747a489 | |||||
0x690B9A9E...Db4FaC990
Miner
| (builder0x69) | 5.027190393874126136 Eth | 5.027300128874126136 Eth | 0.000109735 | |
0xd49f017B...9E39A5082 |
0.011882864918582814 Eth
Nonce: 67
|
0.011161496143253544 Eth
Nonce: 68
| 0.00072136877532927 |
Execution Trace
Staker.CALL( )
-
CinderToken.balanceOf( account=0x1dE0aef4d0135a561ffeaa84f74dd00eB747a489 ) => ( 10900513039946805413515013 )
File 1 of 2: Staker
File 2 of 2: CinderToken
{"Address.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\n/**\r\n * @dev Collection of functions related to the address type\r\n */\r\nlibrary Address {\r\n /**\r\n * @dev Returns true if `account` is a contract.\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * It is unsafe to assume that an address for which this function returns\r\n * false is an externally-owned account (EOA) and not a contract.\r\n *\r\n * Among others, `isContract` will return false for the following\r\n * types of addresses:\r\n *\r\n * - an externally-owned account\r\n * - a contract in construction\r\n * - an address where a contract will be created\r\n * - an address where a contract lived, but was destroyed\r\n * ====\r\n */\r\n function isContract(address account) internal view returns (bool) {\r\n // This method relies on extcodesize, which returns 0 for contracts in\r\n // construction, since the code is only stored at the end of the\r\n // constructor execution.\r\n\r\n uint256 size;\r\n assembly {\r\n size := extcodesize(account)\r\n }\r\n return size \u003e 0;\r\n }\r\n\r\n /**\r\n * @dev Replacement for Solidity\u0027s `transfer`: sends `amount` wei to\r\n * `recipient`, forwarding all available gas and reverting on errors.\r\n *\r\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\r\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\r\n * imposed by `transfer`, making them unable to receive funds via\r\n * `transfer`. {sendValue} removes this limitation.\r\n *\r\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\r\n *\r\n * IMPORTANT: because control is transferred to `recipient`, care must be\r\n * taken to not create reentrancy vulnerabilities. Consider using\r\n * {ReentrancyGuard} or the\r\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\r\n */\r\n function sendValue(address payable recipient, uint256 amount) internal {\r\n require(address(this).balance \u003e= amount, \"Address: insufficient balance\");\r\n\r\n (bool success, ) = recipient.call{value: amount}(\"\");\r\n require(success, \"Address: unable to send value, recipient may have reverted\");\r\n }\r\n\r\n /**\r\n * @dev Performs a Solidity function call using a low level `call`. A\r\n * plain `call` is an unsafe replacement for a function call: use this\r\n * function instead.\r\n *\r\n * If `target` reverts with a revert reason, it is bubbled up by this\r\n * function (like regular Solidity function calls).\r\n *\r\n * Returns the raw returned data. To convert to the expected return value,\r\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\r\n *\r\n * Requirements:\r\n *\r\n * - `target` must be a contract.\r\n * - calling `target` with `data` must not revert.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\r\n return functionCall(target, data, \"Address: low-level call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\r\n * `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but also transferring `value` wei to `target`.\r\n *\r\n * Requirements:\r\n *\r\n * - the calling contract must have an ETH balance of at least `value`.\r\n * - the called Solidity function must be `payable`.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value\r\n ) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\r\n * with `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n require(address(this).balance \u003e= value, \"Address: insufficient balance for call\");\r\n require(isContract(target), \"Address: call to non-contract\");\r\n\r\n (bool success, bytes memory returndata) = target.call{value: value}(data);\r\n return verifyCallResult(success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\r\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n require(isContract(target), \"Address: static call to non-contract\");\r\n\r\n (bool success, bytes memory returndata) = target.staticcall(data);\r\n return verifyCallResult(success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a delegate call.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\r\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a delegate call.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function functionDelegateCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n require(isContract(target), \"Address: delegate call to non-contract\");\r\n\r\n (bool success, bytes memory returndata) = target.delegatecall(data);\r\n return verifyCallResult(success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn\u0027t, either by bubbling the\r\n * revert reason using the provided one.\r\n *\r\n * _Available since v4.3._\r\n */\r\n function verifyCallResult(\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal pure returns (bytes memory) {\r\n if (success) {\r\n return returndata;\r\n } else {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length \u003e 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n }\r\n}"},"Context.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\n/**\r\n * @dev Provides information about the current execution context, including the\r\n * sender of the transaction and its data. While these are generally available\r\n * via msg.sender and msg.data, they should not be accessed in such a direct\r\n * manner, since when dealing with meta-transactions the account sending and\r\n * paying for execution may not be the actual sender (as far as an application\r\n * is concerned).\r\n *\r\n * This contract is only required for intermediate, library-like contracts.\r\n */\r\nabstract contract Context {\r\n function _msgSender() internal view virtual returns (address) {\r\n return msg.sender;\r\n }\r\n\r\n function _msgData() internal view virtual returns (bytes calldata) {\r\n return msg.data;\r\n }\r\n}"},"ERC1155Holder.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\nimport \"./ERC1155Receiver.sol\";\r\n\r\n/**\r\n * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.\r\n *\r\n * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be\r\n * stuck.\r\n *\r\n * @dev _Available since v3.1._\r\n */\r\ncontract ERC1155Holder is ERC1155Receiver {\r\n function onERC1155Received(\r\n address,\r\n address,\r\n uint256,\r\n uint256,\r\n bytes memory\r\n ) public virtual override returns (bytes4) {\r\n return this.onERC1155Received.selector;\r\n }\r\n\r\n function onERC1155BatchReceived(\r\n address,\r\n address,\r\n uint256[] memory,\r\n uint256[] memory,\r\n bytes memory\r\n ) public virtual override returns (bytes4) {\r\n return this.onERC1155BatchReceived.selector;\r\n }\r\n}"},"ERC1155Receiver.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\nimport \"./IERC1155Receiver.sol\";\r\nimport \"./ERC165.sol\";\r\n\r\n/**\r\n * @dev _Available since v3.1._\r\n */\r\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\r\n /**\r\n * @dev See {IERC165-supportsInterface}.\r\n */\r\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\r\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\r\n }\r\n}"},"ERC165.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\nimport \"./IERC165.sol\";\r\n\r\n/**\r\n * @dev Implementation of the {IERC165} interface.\r\n *\r\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\r\n * for the additional interface id that will be supported. For example:\r\n *\r\n * ```solidity\r\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\r\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\r\n * }\r\n * ```\r\n *\r\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\r\n */\r\nabstract contract ERC165 is IERC165 {\r\n /**\r\n * @dev See {IERC165-supportsInterface}.\r\n */\r\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\r\n return interfaceId == type(IERC165).interfaceId;\r\n }\r\n}"},"ERC721Holder.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\nimport \"./IERC721Receiver.sol\";\r\n\r\n/**\r\n * @dev Implementation of the {IERC721Receiver} interface.\r\n *\r\n * Accepts all token transfers.\r\n * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.\r\n */\r\ncontract ERC721Holder is IERC721Receiver {\r\n /**\r\n * @dev See {IERC721Receiver-onERC721Received}.\r\n *\r\n * Always returns `IERC721Receiver.onERC721Received.selector`.\r\n */\r\n function onERC721Received(\r\n address,\r\n address,\r\n uint256,\r\n bytes memory\r\n ) public virtual override returns (bytes4) {\r\n return this.onERC721Received.selector;\r\n }\r\n}"},"IERC1155.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\nimport \"./IERC165.sol\";\r\n\r\n/**\r\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\r\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\r\n *\r\n * _Available since v3.1._\r\n */\r\ninterface IERC1155 is IERC165 {\r\n /**\r\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\r\n */\r\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\r\n\r\n /**\r\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\r\n * transfers.\r\n */\r\n event TransferBatch(\r\n address indexed operator,\r\n address indexed from,\r\n address indexed to,\r\n uint256[] ids,\r\n uint256[] values\r\n );\r\n\r\n /**\r\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\r\n * `approved`.\r\n */\r\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\r\n\r\n /**\r\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\r\n *\r\n * If an {URI} event was emitted for `id`, the standard\r\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\r\n * returned by {IERC1155MetadataURI-uri}.\r\n */\r\n event URI(string value, uint256 indexed id);\r\n\r\n /**\r\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\r\n *\r\n * Requirements:\r\n *\r\n * - `account` cannot be the zero address.\r\n */\r\n function balanceOf(address account, uint256 id) external view returns (uint256);\r\n\r\n /**\r\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\r\n *\r\n * Requirements:\r\n *\r\n * - `accounts` and `ids` must have the same length.\r\n */\r\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\r\n external\r\n view\r\n returns (uint256[] memory);\r\n\r\n /**\r\n * @dev Grants or revokes permission to `operator` to transfer the caller\u0027s tokens, according to `approved`,\r\n *\r\n * Emits an {ApprovalForAll} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `operator` cannot be the caller.\r\n */\r\n function setApprovalForAll(address operator, bool approved) external;\r\n\r\n /**\r\n * @dev Returns true if `operator` is approved to transfer ``account``\u0027s tokens.\r\n *\r\n * See {setApprovalForAll}.\r\n */\r\n function isApprovedForAll(address account, address operator) external view returns (bool);\r\n\r\n /**\r\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\r\n *\r\n * Emits a {TransferSingle} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `to` cannot be the zero address.\r\n * - If the caller is not `from`, it must be have been approved to spend ``from``\u0027s tokens via {setApprovalForAll}.\r\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\r\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\r\n * acceptance magic value.\r\n */\r\n function safeTransferFrom(\r\n address from,\r\n address to,\r\n uint256 id,\r\n uint256 amount,\r\n bytes calldata data\r\n ) external;\r\n\r\n /**\r\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\r\n *\r\n * Emits a {TransferBatch} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `ids` and `amounts` must have the same length.\r\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\r\n * acceptance magic value.\r\n */\r\n function safeBatchTransferFrom(\r\n address from,\r\n address to,\r\n uint256[] calldata ids,\r\n uint256[] calldata amounts,\r\n bytes calldata data\r\n ) external;\r\n}"},"IERC1155Receiver.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\nimport \"./IERC165.sol\";\r\n\r\n/**\r\n * @dev _Available since v3.1._\r\n */\r\ninterface IERC1155Receiver is IERC165 {\r\n /**\r\n * @dev Handles the receipt of a single ERC1155 token type. This function is\r\n * called at the end of a `safeTransferFrom` after the balance has been updated.\r\n *\r\n * NOTE: To accept the transfer, this must return\r\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\r\n * (i.e. 0xf23a6e61, or its own function selector).\r\n *\r\n * @param operator The address which initiated the transfer (i.e. msg.sender)\r\n * @param from The address which previously owned the token\r\n * @param id The ID of the token being transferred\r\n * @param value The amount of tokens being transferred\r\n * @param data Additional data with no specified format\r\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\r\n */\r\n function onERC1155Received(\r\n address operator,\r\n address from,\r\n uint256 id,\r\n uint256 value,\r\n bytes calldata data\r\n ) external returns (bytes4);\r\n\r\n /**\r\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\r\n * is called at the end of a `safeBatchTransferFrom` after the balances have\r\n * been updated.\r\n *\r\n * NOTE: To accept the transfer(s), this must return\r\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\r\n * (i.e. 0xbc197c81, or its own function selector).\r\n *\r\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\r\n * @param from The address which previously owned the token\r\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\r\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\r\n * @param data Additional data with no specified format\r\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\r\n */\r\n function onERC1155BatchReceived(\r\n address operator,\r\n address from,\r\n uint256[] calldata ids,\r\n uint256[] calldata values,\r\n bytes calldata data\r\n ) external returns (bytes4);\r\n}"},"IERC165.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\n/**\r\n * @dev Interface of the ERC165 standard, as defined in the\r\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\r\n *\r\n * Implementers can declare support of contract interfaces, which can then be\r\n * queried by others ({ERC165Checker}).\r\n *\r\n * For an implementation, see {ERC165}.\r\n */\r\ninterface IERC165 {\r\n /**\r\n * @dev Returns true if this contract implements the interface defined by\r\n * `interfaceId`. See the corresponding\r\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\r\n * to learn more about how these ids are created.\r\n *\r\n * This function call must use less than 30 000 gas.\r\n */\r\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\r\n}"},"IERC20.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP.\r\n */\r\ninterface IERC20 {\r\n /**\r\n * @dev Returns the amount of tokens in existence.\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the amount of tokens owned by `account`.\r\n */\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from the caller\u0027s account to `recipient`.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transfer(address recipient, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Returns the remaining number of tokens that `spender` will be\r\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\r\n * zero by default.\r\n *\r\n * This value changes when {approve} or {transferFrom} are called.\r\n */\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the caller\u0027s tokens.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\r\n * that someone may use both the old and the new allowance by unfortunate\r\n * transaction ordering. One possible solution to mitigate this race\r\n * condition is to first reduce the spender\u0027s allowance to 0 and set the\r\n * desired value afterwards:\r\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n *\r\n * Emits an {Approval} event.\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\r\n * allowance mechanism. `amount` is then deducted from the caller\u0027s\r\n * allowance.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transferFrom(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) external returns (bool);\r\n\r\n /**\r\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n * another (`to`).\r\n *\r\n * Note that `value` may be zero.\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n /**\r\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n * a call to {approve}. `value` is the new allowance.\r\n */\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n}"},"IERC721.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\nimport \"./IERC165.sol\";\r\n\r\n/**\r\n * @dev Required interface of an ERC721 compliant contract.\r\n */\r\ninterface IERC721 is IERC165 {\r\n /**\r\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\r\n\r\n /**\r\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\r\n */\r\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\r\n\r\n /**\r\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\r\n */\r\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\r\n\r\n /**\r\n * @dev Returns the number of tokens in ``owner``\u0027s account.\r\n */\r\n function balanceOf(address owner) external view returns (uint256 balance);\r\n\r\n /**\r\n * @dev Returns the owner of the `tokenId` token.\r\n *\r\n * Requirements:\r\n *\r\n * - `tokenId` must exist.\r\n */\r\n function ownerOf(uint256 tokenId) external view returns (address owner);\r\n\r\n /**\r\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\r\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\r\n *\r\n * Requirements:\r\n *\r\n * - `from` cannot be the zero address.\r\n * - `to` cannot be the zero address.\r\n * - `tokenId` token must exist and be owned by `from`.\r\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\r\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function safeTransferFrom(\r\n address from,\r\n address to,\r\n uint256 tokenId\r\n ) external;\r\n\r\n /**\r\n * @dev Transfers `tokenId` token from `from` to `to`.\r\n *\r\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\r\n *\r\n * Requirements:\r\n *\r\n * - `from` cannot be the zero address.\r\n * - `to` cannot be the zero address.\r\n * - `tokenId` token must be owned by `from`.\r\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 tokenId\r\n ) external;\r\n\r\n /**\r\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\r\n * The approval is cleared when the token is transferred.\r\n *\r\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\r\n *\r\n * Requirements:\r\n *\r\n * - The caller must own the token or be an approved operator.\r\n * - `tokenId` must exist.\r\n *\r\n * Emits an {Approval} event.\r\n */\r\n function approve(address to, uint256 tokenId) external;\r\n\r\n /**\r\n * @dev Returns the account approved for `tokenId` token.\r\n *\r\n * Requirements:\r\n *\r\n * - `tokenId` must exist.\r\n */\r\n function getApproved(uint256 tokenId) external view returns (address operator);\r\n\r\n /**\r\n * @dev Approve or remove `operator` as an operator for the caller.\r\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\r\n *\r\n * Requirements:\r\n *\r\n * - The `operator` cannot be the caller.\r\n *\r\n * Emits an {ApprovalForAll} event.\r\n */\r\n function setApprovalForAll(address operator, bool _approved) external;\r\n\r\n /**\r\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\r\n *\r\n * See {setApprovalForAll}\r\n */\r\n function isApprovedForAll(address owner, address operator) external view returns (bool);\r\n\r\n /**\r\n * @dev Safely transfers `tokenId` token from `from` to `to`.\r\n *\r\n * Requirements:\r\n *\r\n * - `from` cannot be the zero address.\r\n * - `to` cannot be the zero address.\r\n * - `tokenId` token must exist and be owned by `from`.\r\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\r\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function safeTransferFrom(\r\n address from,\r\n address to,\r\n uint256 tokenId,\r\n bytes calldata data\r\n ) external;\r\n}"},"IERC721Receiver.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\n/**\r\n * @title ERC721 token receiver interface\r\n * @dev Interface for any contract that wants to support safeTransfers\r\n * from ERC721 asset contracts.\r\n */\r\ninterface IERC721Receiver {\r\n /**\r\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\r\n * by `operator` from `from`, this function is called.\r\n *\r\n * It must return its Solidity selector to confirm the token transfer.\r\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\r\n *\r\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\r\n */\r\n function onERC721Received(\r\n address operator,\r\n address from,\r\n uint256 tokenId,\r\n bytes calldata data\r\n ) external returns (bytes4);\r\n}"},"Ownable.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\nimport \"./Context.sol\";\r\n\r\n/**\r\n * @dev Contract module which provides a basic access control mechanism, where\r\n * there is an account (an owner) that can be granted exclusive access to\r\n * specific functions.\r\n *\r\n * By default, the owner account will be the one that deploys the contract. This\r\n * can later be changed with {transferOwnership}.\r\n *\r\n * This module is used through inheritance. It will make available the modifier\r\n * `onlyOwner`, which can be applied to your functions to restrict their use to\r\n * the owner.\r\n */\r\nabstract contract Ownable is Context {\r\n address private _owner;\r\n\r\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r\n\r\n /**\r\n * @dev Initializes the contract setting the deployer as the initial owner.\r\n */\r\n constructor() {\r\n _transferOwnership(_msgSender());\r\n }\r\n\r\n /**\r\n * @dev Returns the address of the current owner.\r\n */\r\n function owner() public view virtual returns (address) {\r\n return _owner;\r\n }\r\n\r\n /**\r\n * @dev Throws if called by any account other than the owner.\r\n */\r\n modifier onlyOwner() {\r\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Leaves the contract without owner. It will not be possible to call\r\n * `onlyOwner` functions anymore. Can only be called by the current owner.\r\n *\r\n * NOTE: Renouncing ownership will leave the contract without an owner,\r\n * thereby removing any functionality that is only available to the owner.\r\n */\r\n function renounceOwnership() public virtual onlyOwner {\r\n _transferOwnership(address(0));\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n * Can only be called by the current owner.\r\n */\r\n function transferOwnership(address newOwner) public virtual onlyOwner {\r\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\r\n _transferOwnership(newOwner);\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n * Internal function without access restriction.\r\n */\r\n function _transferOwnership(address newOwner) internal virtual {\r\n address oldOwner = _owner;\r\n _owner = newOwner;\r\n emit OwnershipTransferred(oldOwner, newOwner);\r\n }\r\n}"},"ReentrancyGuard.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\n/**\r\n * @dev Contract module that helps prevent reentrant calls to a function.\r\n *\r\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\r\n * available, which can be applied to functions to make sure there are no nested\r\n * (reentrant) calls to them.\r\n *\r\n * Note that because there is a single `nonReentrant` guard, functions marked as\r\n * `nonReentrant` may not call one another. This can be worked around by making\r\n * those functions `private`, and then adding `external` `nonReentrant` entry\r\n * points to them.\r\n *\r\n * TIP: If you would like to learn more about reentrancy and alternative ways\r\n * to protect against it, check out our blog post\r\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\r\n */\r\nabstract contract ReentrancyGuard {\r\n // Booleans are more expensive than uint256 or any type that takes up a full\r\n // word because each write operation emits an extra SLOAD to first read the\r\n // slot\u0027s contents, replace the bits taken up by the boolean, and then write\r\n // back. This is the compiler\u0027s defense against contract upgrades and\r\n // pointer aliasing, and it cannot be disabled.\r\n\r\n // The values being non-zero value makes deployment a bit more expensive,\r\n // but in exchange the refund on every call to nonReentrant will be lower in\r\n // amount. Since refunds are capped to a percentage of the total\r\n // transaction\u0027s gas, it is best to keep them low in cases like this one, to\r\n // increase the likelihood of the full refund coming into effect.\r\n uint256 private constant _NOT_ENTERED = 1;\r\n uint256 private constant _ENTERED = 2;\r\n\r\n uint256 private _status;\r\n\r\n constructor() {\r\n _status = _NOT_ENTERED;\r\n }\r\n\r\n /**\r\n * @dev Prevents a contract from calling itself, directly or indirectly.\r\n * Calling a `nonReentrant` function from another `nonReentrant`\r\n * function is not supported. It is possible to prevent this from happening\r\n * by making the `nonReentrant` function external, and making it call a\r\n * `private` function that does the actual work.\r\n */\r\n modifier nonReentrant() {\r\n // On the first call to nonReentrant, _notEntered will be true\r\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\r\n\r\n // Any calls to nonReentrant after this point will fail\r\n _status = _ENTERED;\r\n\r\n _;\r\n\r\n // By storing the original value once again, a refund is triggered (see\r\n // https://eips.ethereum.org/EIPS/eip-2200)\r\n _status = _NOT_ENTERED;\r\n }\r\n}"},"SafeERC20.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\nimport \"./IERC20.sol\";\r\nimport \"./Address.sol\";\r\n\r\n/**\r\n * @title SafeERC20\r\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\r\n * contract returns false). Tokens that return no value (and instead revert or\r\n * throw on failure) are also supported, non-reverting calls are assumed to be\r\n * successful.\r\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\r\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\r\n */\r\nlibrary SafeERC20 {\r\n using Address for address;\r\n\r\n function safeTransfer(\r\n IERC20 token,\r\n address to,\r\n uint256 value\r\n ) internal {\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\r\n }\r\n\r\n function safeTransferFrom(\r\n IERC20 token,\r\n address from,\r\n address to,\r\n uint256 value\r\n ) internal {\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\r\n }\r\n\r\n /**\r\n * @dev Deprecated. This function has issues similar to the ones found in\r\n * {IERC20-approve}, and its usage is discouraged.\r\n *\r\n * Whenever possible, use {safeIncreaseAllowance} and\r\n * {safeDecreaseAllowance} instead.\r\n */\r\n function safeApprove(\r\n IERC20 token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n // safeApprove should only be called when setting an initial allowance,\r\n // or when resetting it to zero. To increase and decrease it, use\r\n // \u0027safeIncreaseAllowance\u0027 and \u0027safeDecreaseAllowance\u0027\r\n require(\r\n (value == 0) || (token.allowance(address(this), spender) == 0),\r\n \"SafeERC20: approve from non-zero to non-zero allowance\"\r\n );\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\r\n }\r\n\r\n function safeIncreaseAllowance(\r\n IERC20 token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n uint256 newAllowance = token.allowance(address(this), spender) + value;\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\r\n }\r\n\r\n function safeDecreaseAllowance(\r\n IERC20 token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n unchecked {\r\n uint256 oldAllowance = token.allowance(address(this), spender);\r\n require(oldAllowance \u003e= value, \"SafeERC20: decreased allowance below zero\");\r\n uint256 newAllowance = oldAllowance - value;\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\r\n }\r\n }\r\n\r\n /**\r\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\r\n * on the return value: the return value is optional (but if data is returned, it must not be false).\r\n * @param token The token targeted by the call.\r\n * @param data The call data (encoded using abi.encode or one of its variants).\r\n */\r\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\r\n // We need to perform a low level call here, to bypass Solidity\u0027s return data size checking mechanism, since\r\n // we\u0027re implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\r\n // the target address contains contract code and also asserts for success in the low-level call.\r\n\r\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\r\n if (returndata.length \u003e 0) {\r\n // Return data is optional\r\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\r\n }\r\n }\r\n}"},"Staker.sol":{"content":"// SPDX-License-Identifier: MIT\r\npragma solidity 0.8.14;\r\n\r\n/******************************************************************************\\\r\n* Staking contract for https://twitter.com/OccultTower\r\n/******************************************************************************/\r\n\r\nimport \"./IERC721.sol\";\r\nimport \"./IERC20.sol\";\r\nimport \"./SafeERC20.sol\";\r\nimport \"./ERC721Holder.sol\";\r\nimport \"./ReentrancyGuard.sol\";\r\nimport \"./Ownable.sol\";\r\n\r\ncontract Staker is ERC721Holder, ReentrancyGuard, Ownable {\r\n using SafeERC20 for IERC20;\r\n\r\n /* ========== STATE VARIABLES ========== */\r\n\r\n event PaymentReceived(address from, uint256 amount);\r\n\r\n bool public paused = true;\r\n uint16 public totalStake;\r\n uint16 public totalBurnt;\r\n uint16 public stakeCount;\r\n uint16 public burntCount;\r\n uint64 stakingDuration = 365 * 3 days;\r\n uint256 startPeriod;\r\n uint256 endPeriod;\r\n uint256 constant internal _precision = 1E18;\r\n mapping(address =\u003e uint256) userStartTime;\r\n mapping(address =\u003e uint256) rewards;\r\n mapping(address =\u003e uint16) burntBalance;\r\n mapping(address =\u003e uint16) stakedBalance;\r\n mapping(uint16 =\u003e address) stakedAssets;\r\n mapping(uint16 =\u003e address) burnt;\r\n mapping(address =\u003e uint16[]) userBurnt;\r\n mapping(address =\u003e uint16[]) userStaked;\r\n\r\n IERC721 public stakingToken721 = IERC721(0x594D888dEB4c0c66f495f48F55c61fAaDF0f63D8);\r\n IERC20 public stakingToken20 = IERC20(0xC807f4B1bf8e79a9279ACFCea5fA7A78E2C7d179);\r\n\r\n constructor() payable {\r\n }\r\n\r\n receive() external payable virtual {\r\n emit PaymentReceived(_msgSender(), msg.value);\r\n }\r\n \r\n // pause staking\r\n function pause(bool _paused) external onlyOwner {\r\n if (_paused == false) {\r\n require(stakingToken20.balanceOf(address(this)) \u003e 0,\"Staking: missing reward token\");\r\n\r\n if (startPeriod == 0) {\r\n startPeriod = block.timestamp;\r\n endPeriod = block.timestamp + stakingDuration;\r\n }\r\n }\r\n paused = _paused;\r\n }\r\n\r\n //block number when user started staking\r\n function userStart(address user) public view returns (uint256) {\r\n return (userStartTime[user]);\r\n }\r\n\r\n //number of NFT staked by a user\r\n function userStakeBalance(address user) public view returns (uint256) {\r\n return (stakedBalance[user]);\r\n }\r\n\r\n //number of NFT burnt by a user\r\n function userBurntBalance(address user) public view returns (uint256) {\r\n return (burntBalance[user]);\r\n }\r\n\r\n //pending rewards that can be claimed by a user\r\n function userPending(address user) public view returns (uint256) {\r\n return (_calculateRewards(user));\r\n }\r\n\r\n //show balance of token in contract\r\n function coinBalance() public view returns (uint256) {\r\n return stakingToken20.balanceOf(address(this));\r\n }\r\n\r\n //shows a list of burnt NFT of a user \r\n function burntList(address user) public view returns (uint16[] memory ids) {\r\n return (userBurnt[user]);\r\n }\r\n\r\n //shows a list of NFT staked by a user\r\n function stakeList(address user) public view returns (uint16[] memory) {\r\n return (userStaked[user]);\r\n }\r\n\r\n //show a list of NFT owned by 1 address\r\n function nftList(address user) public view returns (uint256 count, uint16[200] memory ownedList) {\r\n uint16 i;\r\n uint16 j;\r\n address nftOwner;\r\n uint256 ownerBalance;\r\n uint16[200] memory list;\r\n\r\n unchecked {\r\n ownerBalance = stakingToken721.balanceOf(user);\r\n\r\n for (i = 0; i \u003c= 7777; i += 1) {\r\n nftOwner = stakingToken721.ownerOf(i);\r\n if (nftOwner == user) {\r\n list[j] = i;\r\n j += 1;\r\n if (j == ownerBalance || j == 200) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return (ownerBalance, list);\r\n }\r\n\r\n //allows user to burn a list of NFTs\r\n function burnNFT(uint16[] memory tokenIds) external nonReentrant {\r\n uint16 amount;\r\n bool newBurner;\r\n\r\n require(Address.isContract(msg.sender) == false, \"Staking: no contracts\");\r\n require(paused == false, \"Staking: is paused\");\r\n require(tokenIds.length != 0, \"Staking: No tokenIds provided\");\r\n\r\n require(stakingToken721.isApprovedForAll(msg.sender, address(this)) == true,\r\n \"Staking: First must setApprovalForAll in the NFT to this contract\");\r\n\r\n unchecked {\r\n if (userBurnt[msg.sender].length == 0) {\r\n newBurner = true;\r\n }\r\n\r\n for (uint16 i = 0; i \u003c tokenIds.length; i += 1) {\r\n require(stakingToken721.ownerOf(tokenIds[i]) == msg.sender, \"Staking: not owner of NFT\");\r\n\r\n // Increment the amount which will be staked\r\n amount += 1;\r\n // Save who is the staker/depositor of the token\r\n burnt[tokenIds[i]] = msg.sender;\r\n userBurnt[msg.sender].push(tokenIds[i]);\r\n\r\n // Transfer user\u0027s NFTs to the dead address\r\n stakingToken721.transferFrom(msg.sender, 0x000000000000000000000000000000000000dEaD, tokenIds[i]);\r\n }\r\n burntBalance[msg.sender] += amount;\r\n totalBurnt += amount;\r\n\r\n if (amount \u003e 0 \u0026\u0026 newBurner == true) {\r\n burntCount += 1;\r\n }\r\n }\r\n }\r\n\r\n //allows admin to record a list of burnt NFT where the NFT was burnt without using this contract\r\n\tfunction addBurnt(address[] memory users, uint16[] memory ids) external onlyOwner {\r\n uint16 i;\r\n uint16 j;\r\n address old;\r\n bool newBurner;\r\n uint16 amount;\r\n\r\n require(users.length == ids.length, \"Staking: The number of addresses is not matching the number of ids\");\r\n\r\n unchecked {\r\n\r\n for (i = 0; i \u003c users.length; i++) {\r\n\r\n amount = 0;\r\n if (userBurnt[users[i]].length == 0) {\r\n newBurner = true;\r\n }\r\n\r\n require(stakingToken721.ownerOf(ids[i]) == 0x000000000000000000000000000000000000dEaD\r\n || stakingToken721.ownerOf(ids[i]) == address(stakingToken721)\r\n ,\"Staking: NFT must be burnt\");\r\n\r\n if (burnt[ids[i]] == users[i]) {\r\n //skip as already recorded\r\n } else if (burnt[ids[i]] == address(0)) {\r\n //record burnt nft\r\n burnt[ids[i]] = users[i];\r\n userBurnt[users[i]].push(ids[i]);\r\n burntBalance[users[i]] += 1;\r\n totalBurnt += 1;\r\n\r\n if (newBurner == true) {\r\n burntCount += 1;\r\n newBurner = false;\r\n }\r\n\r\n } else if (burnt[ids[i]] != users[i]) {\r\n //change address that burnt nft\r\n old = burnt[ids[i]];\r\n\r\n for (j = 0; j \u003c userBurnt[old].length; j++) {\r\n if (userBurnt[old][j] == ids[i]) {\r\n userBurnt[old][j] = userBurnt[old][userBurnt[old].length-1];\r\n userBurnt[old].pop();\r\n burntBalance[old] -= 1;\r\n break;\r\n }\r\n }\r\n\r\n burnt[ids[i]] = users[i];\r\n userBurnt[users[i]].push(ids[i]);\r\n\r\n if (newBurner == true) {\r\n burntCount += 1;\r\n newBurner = false;\r\n }\r\n\r\n if (userBurnt[old].length == 0) {\r\n burntCount -= 1;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /// @notice Stakes user\u0027s NFTs\r\n /// @param tokenIds The tokenIds of the NFTs which will be staked\r\n function stake(uint16[] memory tokenIds) external nonReentrant {\r\n uint16 amount;\r\n bool newStaker;\r\n\r\n require(Address.isContract(msg.sender) == false, \"Staking: no contracts\");\r\n require(paused == false, \"Staking: is paused\");\r\n require(tokenIds.length != 0, \"Staking: No tokenIds provided\");\r\n\r\n require(stakingToken721.isApprovedForAll(msg.sender, address(this)) == true,\r\n \"Staking: First must setApprovalForAll in the NFT to this contract\");\r\n\r\n unchecked {\r\n\r\n if (userStaked[msg.sender].length == 0) {\r\n newStaker = true;\r\n }\r\n\r\n for (uint16 i = 0; i \u003c tokenIds.length; i += 1) {\r\n require(tokenIds[i] \u003e 0, \"Staking: does not support id 0\");\r\n require(stakingToken721.ownerOf(tokenIds[i]) == msg.sender, \"Staking: not owner of NFT\");\r\n\r\n // Increment the amount which will be staked\r\n amount += 1;\r\n // Save who is the staker/depositor of the token\r\n stakedAssets[tokenIds[i]] = msg.sender;\r\n userStaked[msg.sender].push(tokenIds[i]);\r\n\r\n // Transfer user\u0027s NFTs to the staking contract\r\n stakingToken721.transferFrom(msg.sender, address(this), tokenIds[i]);\r\n }\r\n\r\n if (amount \u003e 0 \u0026\u0026 newStaker == true) {\r\n stakeCount += 1;\r\n }\r\n\r\n stakedBalance[msg.sender] += amount;\r\n totalStake += amount;\r\n\r\n if (userStartTime[msg.sender] == 0) {\r\n userStartTime[msg.sender] = block.timestamp;\r\n }\r\n }\r\n }\r\n\r\n /// @notice Withdraws a list of staked user\u0027s NFTs. If no list is provided it will unstake all.\r\n function withdraw(uint16[] memory tokenIds) external nonReentrant {\r\n uint16 i;\r\n uint16 j;\r\n uint16 clean;\r\n bool hasStake;\r\n bool cleaned;\r\n\r\n require(Address.isContract(msg.sender) == false, \"Staking: no contracts\");\r\n\r\n //claim reward\r\n _getReward();\r\n\r\n unchecked {\r\n\r\n if (userStaked[msg.sender].length \u003e 0) {\r\n hasStake = true;\r\n }\r\n\r\n if (tokenIds.length == 0) {\r\n //unstake all\r\n for (i = 0; i \u003c userStaked[msg.sender].length; i += 1) {\r\n j = userStaked[msg.sender][i];\r\n if (j \u003e 0) {\r\n if (stakedAssets[j] == msg.sender) {\r\n stakedAssets[j] = address(0);\r\n totalStake -= 1;\r\n userStaked[msg.sender][i] = 0;\r\n\r\n if (stakingToken721.ownerOf(j) == address(this)) {\r\n // Transfer user\u0027s NFTs back to user\r\n stakingToken721.safeTransferFrom(address(this), msg.sender, j);\r\n }\r\n }\r\n }\r\n }\r\n stakedBalance[msg.sender] = 0;\r\n\r\n } else {\r\n //unstake chosen id\r\n for (i = 0; i \u003c tokenIds.length; i += 1) {\r\n for (j = 0; j \u003c userStaked[msg.sender].length; j += 1) {\r\n if (userStaked[msg.sender][j] == tokenIds[i]) {\r\n if (stakedAssets[tokenIds[i]] == msg.sender) {\r\n stakedAssets[tokenIds[i]] = address(0);\r\n totalStake -= 1;\r\n stakedBalance[msg.sender] -= 1;\r\n userStaked[msg.sender][j] = 0;\r\n\r\n if (stakingToken721.ownerOf(tokenIds[i]) == address(this)) {\r\n // Transfer user\u0027s NFTs back to user\r\n stakingToken721.safeTransferFrom(address(this), msg.sender, tokenIds[i]);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n //remove 0 ids\r\n cleaned = false;\r\n while (cleaned == false) {\r\n for (i = 0; i \u003c userStaked[msg.sender].length; i += 1) {\r\n clean = 0;\r\n if (userStaked[msg.sender].length \u003e 1) {\r\n if (userStaked[msg.sender][i] == 0) {\r\n userStaked[msg.sender][i] = userStaked[msg.sender][userStaked[msg.sender].length-1];\r\n userStaked[msg.sender].pop();\r\n clean += 1;\r\n break;\r\n }\r\n } else {\r\n userStaked[msg.sender].pop();\r\n }\r\n }\r\n if (clean == 0) {\r\n cleaned = true;\r\n }\r\n }\r\n\r\n if (hasStake == true \u0026\u0026 userStaked[msg.sender].length == 0) {\r\n stakeCount -= 1;\r\n }\r\n }\r\n }\r\n\r\n //user can claim reward\r\n function getReward() external nonReentrant {\r\n require(Address.isContract(msg.sender) == false, \"Staking: No contracts\");\r\n _getReward();\r\n }\r\n\r\n //code to claim reward\r\n function _getReward() internal {\r\n uint256 reward;\r\n\r\n // update the current reward balance\r\n _updateRewards();\r\n\r\n unchecked {\r\n\r\n reward = rewards[msg.sender];\r\n\r\n //if token is running out then pay out the balance remaining\r\n if (reward \u003e stakingToken20.balanceOf(address(this))) {\r\n reward = stakingToken20.balanceOf(address(this));\r\n }\r\n\r\n if (reward \u003e 0) {\r\n SafeERC20.safeTransfer(stakingToken20, msg.sender, reward);\r\n }\r\n\r\n rewards[msg.sender] -= reward;\r\n }\r\n }\r\n\r\n /**\r\n * @notice function that update pending rewards\r\n * and shift them to rewardsToClaim\r\n * @dev update rewards claimable\r\n * and check the time spent since deposit for the `msg.sender`\r\n */\r\n function _updateRewards() internal {\r\n\r\n unchecked {\r\n\r\n rewards[msg.sender] = _calculateRewards(msg.sender);\r\n \r\n if (block.timestamp \u003e= endPeriod) {\r\n userStartTime[msg.sender] = endPeriod;\r\n } else {\r\n userStartTime[msg.sender] = block.timestamp;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @notice calculate rewards based on the number of staked and burnt NFTs\r\n * @dev the higher is the precision and the more the time remaining will be precise\r\n * @param stakeHolder, address of the user to be checked\r\n * @return uint256 amount of claimable tokens of the specified address\r\n */\r\n \r\n function _calculateRewards(address stakeHolder) internal view returns (uint256) {\r\n uint256 cal;\r\n uint256 totalStakeBonus;\r\n uint256 totalBurntCount;\r\n uint256 bonusPoolTokens;\r\n uint256 bonusPoolDailyDist;\r\n uint256 burntTokenCount;\r\n uint256 dailyTokenDist;\r\n uint256 stakingBonusCount;\r\n uint256 burntTokenMult;\r\n uint256 dailyBonusPoolDist;\r\n uint256 yearlyTokenDist;\r\n\r\n unchecked {\r\n\r\n if (stakedBalance[stakeHolder] == 0 || burntBalance[stakeHolder] == 0 || startPeriod == 0) {\r\n cal = 0;\r\n } else {\r\n\r\n totalStakeBonus = _precision * (totalStake - stakeCount);\r\n totalBurntCount = _precision * (totalBurnt - burntCount);\r\n bonusPoolTokens = totalStakeBonus + totalBurntCount * 5 / 4;\r\n if (bonusPoolTokens == 0) {\r\n bonusPoolTokens = 1;\r\n }\r\n bonusPoolDailyDist = _precision * _precision * 2223 / bonusPoolTokens;\r\n burntTokenCount = burntBalance[stakeHolder] - 1;\r\n dailyTokenDist = _precision * (stakedBalance[stakeHolder] + burntTokenCount);\r\n stakingBonusCount = stakedBalance[stakeHolder] - 1;\r\n burntTokenMult = burntTokenCount * 5 / 4;\r\n dailyBonusPoolDist = (stakingBonusCount + burntTokenMult) * bonusPoolDailyDist;\r\n yearlyTokenDist = (dailyTokenDist + dailyBonusPoolDist) * 365;\r\n\r\n cal = yearlyTokenDist * _percentageTimeRemaining(stakeHolder) * (stakingDuration / 365 days) / _precision;\r\n }\r\n }\r\n\r\n return (cal + rewards[stakeHolder]);\r\n }\r\n\r\n /**\r\n * @notice function that returns the remaining time in seconds of the staking period\r\n * @dev the higher is the precision and the more the time remaining will be precise\r\n * @param stakeHolder, address of the user to be checked\r\n * @return uint256 percentage of time remaining * precision\r\n */\r\n function _percentageTimeRemaining(address stakeHolder) internal view returns (uint256) {\r\n uint256 startTime;\r\n uint256 timeRemaining;\r\n\r\n unchecked {\r\n\r\n if (endPeriod \u003e block.timestamp) {\r\n if (startPeriod \u003e userStartTime[stakeHolder]) {\r\n startTime = startPeriod;\r\n } else {\r\n startTime = userStartTime[stakeHolder];\r\n }\r\n\r\n timeRemaining = stakingDuration - (block.timestamp - startTime);\r\n return (_precision * (stakingDuration - timeRemaining)) / stakingDuration;\r\n } else {\r\n\r\n if (startPeriod \u003e userStartTime[stakeHolder]) {\r\n startTime = 0;\r\n } else {\r\n startTime = stakingDuration - (endPeriod - userStartTime[stakeHolder]);\r\n }\r\n return ((_precision * (stakingDuration - startTime)) / stakingDuration);\r\n }\r\n }\r\n }\r\n}\r\n"}}
File 2 of 2: CinderToken
{"Cinder.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)\r\n// Token is only available by staking of the NFT https://twitter.com/OccultTower \r\n// Token can only be used for The Land of the Occult\r\n\r\npragma solidity 0.8.14;\r\n\r\nimport \"./ERC20.sol\";\r\n\r\ncontract CinderToken is ERC20 {\r\n constructor() ERC20(\"Cinder Coin\", \"CINDER\") {\r\n _mint(msg.sender, 10950000 * 1E18);\r\n }\r\n}"},"Context.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\n/**\r\n * @dev Provides information about the current execution context, including the\r\n * sender of the transaction and its data. While these are generally available\r\n * via msg.sender and msg.data, they should not be accessed in such a direct\r\n * manner, since when dealing with meta-transactions the account sending and\r\n * paying for execution may not be the actual sender (as far as an application\r\n * is concerned).\r\n *\r\n * This contract is only required for intermediate, library-like contracts.\r\n */\r\nabstract contract Context {\r\n function _msgSender() internal view virtual returns (address) {\r\n return msg.sender;\r\n }\r\n\r\n function _msgData() internal view virtual returns (bytes calldata) {\r\n return msg.data;\r\n }\r\n}"},"ERC20.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\nimport \"./IERC20.sol\";\r\nimport \"./IERC20Metadata.sol\";\r\nimport \"./Context.sol\";\r\n\r\n/**\r\n * @dev Implementation of the {IERC20} interface.\r\n *\r\n * This implementation is agnostic to the way tokens are created. This means\r\n * that a supply mechanism has to be added in a derived contract using {_mint}.\r\n * For a generic mechanism see {ERC20PresetMinterPauser}.\r\n *\r\n * TIP: For a detailed writeup see our guide\r\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\r\n * to implement supply mechanisms].\r\n *\r\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\r\n * instead returning `false` on failure. This behavior is nonetheless\r\n * conventional and does not conflict with the expectations of ERC20\r\n * applications.\r\n *\r\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\r\n * This allows applications to reconstruct the allowance for all accounts just\r\n * by listening to said events. Other implementations of the EIP may not emit\r\n * these events, as it isn\u0027t required by the specification.\r\n *\r\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\r\n * functions have been added to mitigate the well-known issues around setting\r\n * allowances. See {IERC20-approve}.\r\n */\r\ncontract ERC20 is Context, IERC20, IERC20Metadata {\r\n mapping(address =\u003e uint256) private _balances;\r\n\r\n mapping(address =\u003e mapping(address =\u003e uint256)) private _allowances;\r\n\r\n uint256 private _totalSupply;\r\n\r\n string private _name;\r\n string private _symbol;\r\n\r\n /**\r\n * @dev Sets the values for {name} and {symbol}.\r\n *\r\n * The default value of {decimals} is 18. To select a different value for\r\n * {decimals} you should overload it.\r\n *\r\n * All two of these values are immutable: they can only be set once during\r\n * construction.\r\n */\r\n constructor(string memory name_, string memory symbol_) {\r\n _name = name_;\r\n _symbol = symbol_;\r\n }\r\n\r\n /**\r\n * @dev Returns the name of the token.\r\n */\r\n function name() public view virtual override returns (string memory) {\r\n return _name;\r\n }\r\n\r\n /**\r\n * @dev Returns the symbol of the token, usually a shorter version of the\r\n * name.\r\n */\r\n function symbol() public view virtual override returns (string memory) {\r\n return _symbol;\r\n }\r\n\r\n /**\r\n * @dev Returns the number of decimals used to get its user representation.\r\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\r\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\r\n *\r\n * Tokens usually opt for a value of 18, imitating the relationship between\r\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\r\n * overridden;\r\n *\r\n * NOTE: This information is only used for _display_ purposes: it in\r\n * no way affects any of the arithmetic of the contract, including\r\n * {IERC20-balanceOf} and {IERC20-transfer}.\r\n */\r\n function decimals() public view virtual override returns (uint8) {\r\n return 18;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-totalSupply}.\r\n */\r\n function totalSupply() public view virtual override returns (uint256) {\r\n return _totalSupply;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-balanceOf}.\r\n */\r\n function balanceOf(address account) public view virtual override returns (uint256) {\r\n return _balances[account];\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-transfer}.\r\n *\r\n * Requirements:\r\n *\r\n * - `recipient` cannot be the zero address.\r\n * - the caller must have a balance of at least `amount`.\r\n */\r\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\r\n _transfer(_msgSender(), recipient, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-allowance}.\r\n */\r\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\r\n return _allowances[owner][spender];\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-approve}.\r\n *\r\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\r\n * `transferFrom`. This is semantically equivalent to an infinite approval.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n */\r\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\r\n _approve(_msgSender(), spender, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-transferFrom}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance. This is not\r\n * required by the EIP. See the note at the beginning of {ERC20}.\r\n *\r\n * NOTE: Does not update the allowance if the current allowance\r\n * is the maximum `uint256`.\r\n *\r\n * Requirements:\r\n *\r\n * - `sender` and `recipient` cannot be the zero address.\r\n * - `sender` must have a balance of at least `amount`.\r\n * - the caller must have allowance for ``sender``\u0027s tokens of at least\r\n * `amount`.\r\n */\r\n function transferFrom(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) public virtual override returns (bool) {\r\n uint256 currentAllowance = _allowances[sender][_msgSender()];\r\n if (currentAllowance != type(uint256).max) {\r\n require(currentAllowance \u003e= amount, \"ERC20: transfer amount exceeds allowance\");\r\n unchecked {\r\n _approve(sender, _msgSender(), currentAllowance - amount);\r\n }\r\n }\r\n\r\n _transfer(sender, recipient, amount);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Atomically increases the allowance granted to `spender` by the caller.\r\n *\r\n * This is an alternative to {approve} that can be used as a mitigation for\r\n * problems described in {IERC20-approve}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n */\r\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\r\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\r\n *\r\n * This is an alternative to {approve} that can be used as a mitigation for\r\n * problems described in {IERC20-approve}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n * - `spender` must have allowance for the caller of at least\r\n * `subtractedValue`.\r\n */\r\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\r\n uint256 currentAllowance = _allowances[_msgSender()][spender];\r\n require(currentAllowance \u003e= subtractedValue, \"ERC20: decreased allowance below zero\");\r\n unchecked {\r\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\r\n *\r\n * This internal function is equivalent to {transfer}, and can be used to\r\n * e.g. implement automatic token fees, slashing mechanisms, etc.\r\n *\r\n * Emits a {Transfer} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `sender` cannot be the zero address.\r\n * - `recipient` cannot be the zero address.\r\n * - `sender` must have a balance of at least `amount`.\r\n */\r\n function _transfer(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) internal virtual {\r\n require(sender != address(0), \"ERC20: transfer from the zero address\");\r\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\r\n\r\n _beforeTokenTransfer(sender, recipient, amount);\r\n\r\n uint256 senderBalance = _balances[sender];\r\n require(senderBalance \u003e= amount, \"ERC20: transfer amount exceeds balance\");\r\n unchecked {\r\n _balances[sender] = senderBalance - amount;\r\n }\r\n _balances[recipient] += amount;\r\n\r\n emit Transfer(sender, recipient, amount);\r\n\r\n _afterTokenTransfer(sender, recipient, amount);\r\n }\r\n\r\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\r\n * the total supply.\r\n *\r\n * Emits a {Transfer} event with `from` set to the zero address.\r\n *\r\n * Requirements:\r\n *\r\n * - `account` cannot be the zero address.\r\n */\r\n function _mint(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: mint to the zero address\");\r\n\r\n _beforeTokenTransfer(address(0), account, amount);\r\n\r\n _totalSupply += amount;\r\n _balances[account] += amount;\r\n emit Transfer(address(0), account, amount);\r\n\r\n _afterTokenTransfer(address(0), account, amount);\r\n }\r\n\r\n /**\r\n * @dev Destroys `amount` tokens from `account`, reducing the\r\n * total supply.\r\n *\r\n * Emits a {Transfer} event with `to` set to the zero address.\r\n *\r\n * Requirements:\r\n *\r\n * - `account` cannot be the zero address.\r\n * - `account` must have at least `amount` tokens.\r\n */\r\n function _burn(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: burn from the zero address\");\r\n\r\n _beforeTokenTransfer(account, address(0), amount);\r\n\r\n uint256 accountBalance = _balances[account];\r\n require(accountBalance \u003e= amount, \"ERC20: burn amount exceeds balance\");\r\n unchecked {\r\n _balances[account] = accountBalance - amount;\r\n }\r\n _totalSupply -= amount;\r\n\r\n emit Transfer(account, address(0), amount);\r\n\r\n _afterTokenTransfer(account, address(0), amount);\r\n }\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\r\n *\r\n * This internal function is equivalent to `approve`, and can be used to\r\n * e.g. set automatic allowances for certain subsystems, etc.\r\n *\r\n * Emits an {Approval} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `owner` cannot be the zero address.\r\n * - `spender` cannot be the zero address.\r\n */\r\n function _approve(\r\n address owner,\r\n address spender,\r\n uint256 amount\r\n ) internal virtual {\r\n require(owner != address(0), \"ERC20: approve from the zero address\");\r\n require(spender != address(0), \"ERC20: approve to the zero address\");\r\n\r\n _allowances[owner][spender] = amount;\r\n emit Approval(owner, spender, amount);\r\n }\r\n\r\n /**\r\n * @dev Hook that is called before any transfer of tokens. This includes\r\n * minting and burning.\r\n *\r\n * Calling conditions:\r\n *\r\n * - when `from` and `to` are both non-zero, `amount` of ``from``\u0027s tokens\r\n * will be transferred to `to`.\r\n * - when `from` is zero, `amount` tokens will be minted for `to`.\r\n * - when `to` is zero, `amount` of ``from``\u0027s tokens will be burned.\r\n * - `from` and `to` are never both zero.\r\n *\r\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\r\n */\r\n function _beforeTokenTransfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal virtual {}\r\n\r\n /**\r\n * @dev Hook that is called after any transfer of tokens. This includes\r\n * minting and burning.\r\n *\r\n * Calling conditions:\r\n *\r\n * - when `from` and `to` are both non-zero, `amount` of ``from``\u0027s tokens\r\n * has been transferred to `to`.\r\n * - when `from` is zero, `amount` tokens have been minted for `to`.\r\n * - when `to` is zero, `amount` of ``from``\u0027s tokens have been burned.\r\n * - `from` and `to` are never both zero.\r\n *\r\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\r\n */\r\n function _afterTokenTransfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal virtual {}\r\n}"},"IERC20.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP.\r\n */\r\ninterface IERC20 {\r\n /**\r\n * @dev Returns the amount of tokens in existence.\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the amount of tokens owned by `account`.\r\n */\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from the caller\u0027s account to `recipient`.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transfer(address recipient, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Returns the remaining number of tokens that `spender` will be\r\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\r\n * zero by default.\r\n *\r\n * This value changes when {approve} or {transferFrom} are called.\r\n */\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the caller\u0027s tokens.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\r\n * that someone may use both the old and the new allowance by unfortunate\r\n * transaction ordering. One possible solution to mitigate this race\r\n * condition is to first reduce the spender\u0027s allowance to 0 and set the\r\n * desired value afterwards:\r\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n *\r\n * Emits an {Approval} event.\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\r\n * allowance mechanism. `amount` is then deducted from the caller\u0027s\r\n * allowance.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transferFrom(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) external returns (bool);\r\n\r\n /**\r\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n * another (`to`).\r\n *\r\n * Note that `value` may be zero.\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n /**\r\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n * a call to {approve}. `value` is the new allowance.\r\n */\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n}"},"IERC20Metadata.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\r\n\r\npragma solidity 0.8.14;\r\n\r\nimport \"./IERC20.sol\";\r\n\r\n/**\r\n * @dev Interface for the optional metadata functions from the ERC20 standard.\r\n *\r\n * _Available since v4.1._\r\n */\r\ninterface IERC20Metadata is IERC20 {\r\n /**\r\n * @dev Returns the name of the token.\r\n */\r\n function name() external view returns (string memory);\r\n\r\n /**\r\n * @dev Returns the symbol of the token.\r\n */\r\n function symbol() external view returns (string memory);\r\n\r\n /**\r\n * @dev Returns the decimals places of the token.\r\n */\r\n function decimals() external view returns (uint8);\r\n}"}}