Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com> Co-authored-by: Francisco Giordano <fg@frang.io> Co-authored-by: Joseph Delong <joseph@delong.me> Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com> Co-authored-by: Renan Souza <renan.rodrigues.souza1@gmail.com> Co-authored-by: Ernesto García <ernestognw@gmail.com> Co-authored-by: Voronor <129545215+voronor@users.noreply.github.com> Co-authored-by: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Co-authored-by: Michalis Kargakis <kargakis@protonmail.com> Co-authored-by: Bilog WEB3 <155262265+Bilogweb3@users.noreply.github.com> Co-authored-by: Fallengirl <155266340+Fallengirl@users.noreply.github.com> Co-authored-by: XxAlex74xX <30472093+XxAlex74xX@users.noreply.github.com> Co-authored-by: PixelPilot <161360836+PixelPil0t1@users.noreply.github.com> Co-authored-by: kilavvy <140459108+kilavvy@users.noreply.github.com> Co-authored-by: Devkuni <155117116+detrina@users.noreply.github.com> Co-authored-by: Danbo <140512416+dannbbb1@users.noreply.github.com> Co-authored-by: Ann Wagner <chant_77_swirly@icloud.com> Co-authored-by: comfsrt <155266597+comfsrt@users.noreply.github.com> Co-authored-by: Bob <158583129+bouchmann@users.noreply.github.com> Co-authored-by: JohnBonny <158583902+JohnBonny@users.noreply.github.com> Co-authored-by: moonman <155266991+moooonman@users.noreply.github.com> Co-authored-by: kazak <alright-epsilon8h@icloud.com> Co-authored-by: Wei <ybxerlvqtx@rambler.ru> Co-authored-by: Maxim Evtush <154841002+maximevtush@users.noreply.github.com> Co-authored-by: Vitalyr <158586577+Vitaliyr888@users.noreply.github.com> Co-authored-by: pendrue <158588659+pendrue@users.noreply.github.com> Co-authored-by: Tronica <wudmytrotest404@gmail.com> Co-authored-by: emmmm <155267286+eeemmmmmm@users.noreply.github.com> Co-authored-by: bigbear <155267841+aso20455@users.noreply.github.com> Co-authored-by: Tomás Andróil <tomasandroil@gmail.com> Co-authored-by: GooseMatrix <155266802+GooseMatrix@users.noreply.github.com> Co-authored-by: jasmy <3776356370@qq.com> Co-authored-by: SITADRITA1 <mrlime2018@gmail.com> Co-authored-by: Ocenka <testoviydiman1@gmail.com>
124 lines
4.6 KiB
Solidity
124 lines
4.6 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC1155/IERC1155.sol)
|
|
|
|
pragma solidity ^0.8.20;
|
|
|
|
import {IERC165} from "../../utils/introspection/IERC165.sol";
|
|
|
|
/**
|
|
* @dev Required interface of an ERC-1155 compliant contract, as defined in the
|
|
* https://eips.ethereum.org/EIPS/eip-1155[ERC].
|
|
*/
|
|
interface IERC1155 is IERC165 {
|
|
/**
|
|
* @dev Emitted when `value` amount of tokens of 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 value of tokens of token type `id` owned by `account`.
|
|
*/
|
|
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 zero address.
|
|
*/
|
|
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 a `value` amount of tokens of type `id` from `from` to `to`.
|
|
*
|
|
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
|
|
* to an untrusted contract, when invoking {IERC1155Receiver-onERC1155Received} on the receiver.
|
|
* Ensure to follow the checks-effects-interactions pattern and consider employing
|
|
* reentrancy guards when interacting with untrusted contracts.
|
|
*
|
|
* 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 `value` 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 value, bytes calldata data) external;
|
|
|
|
/**
|
|
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
|
|
*
|
|
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
|
|
* to an untrusted contract, when invoking {IERC1155Receiver-onERC1155BatchReceived} on the receiver.
|
|
* Ensure to follow the checks-effects-interactions pattern and consider employing
|
|
* reentrancy guards when interacting with untrusted contracts.
|
|
*
|
|
* Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.
|
|
*
|
|
* Requirements:
|
|
*
|
|
* - `ids` and `values` 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 values,
|
|
bytes calldata data
|
|
) external;
|
|
}
|