IERC1155
Title: IERC1155
Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/IERC1155.sol)
Interface for the ERC-1155 Multi-Token Standard, including metadata URI extension.
Functions
balanceOf
Returns the amount of tokens of token type id owned by account.
function balanceOf(address account, uint256 id) external view returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| account | address | |
| id | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
balanceOfBatch
Batched version of balanceOf.
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);Parameters
| Name | Type | Description |
|---|---|---|
| accounts | address[] | |
| ids | uint256[] |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256[] |
setApprovalForAll
Grants or revokes permission to operator to transfer the caller's tokens.
function setApprovalForAll(address operator, bool approved) external;Parameters
| Name | Type | Description |
|---|---|---|
| operator | address | |
| approved | bool |
isApprovedForAll
Returns true if operator is approved to transfer account's tokens.
function isApprovedForAll(address account, address operator) external view returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| account | address | |
| operator | address |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
safeTransferFrom
Transfers value amount of an id from from to to.
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;Parameters
| Name | Type | Description |
|---|---|---|
| from | address | |
| to | address | |
| id | uint256 | |
| value | uint256 | |
| data | bytes |
safeBatchTransferFrom
Batched version of safeTransferFrom.
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external;Parameters
| Name | Type | Description |
|---|---|---|
| from | address | |
| to | address | |
| ids | uint256[] | |
| values | uint256[] | |
| data | bytes |
uri
Returns the URI for token type id.
function uri(uint256 id) external view returns (string memory);Parameters
| Name | Type | Description |
|---|---|---|
| id | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | string |
Events
TransferSingle
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);Parameters
| Name | Type | Description |
|---|---|---|
| operator | address | |
| from | address | |
| to | address | |
| id | uint256 | |
| value | uint256 |
TransferBatch
Equivalent to multiple TransferSingle events, where operator, from, and to are the same for all.
event TransferBatch(
address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values
);Parameters
| Name | Type | Description |
|---|---|---|
| operator | address | |
| from | address | |
| to | address | |
| ids | uint256[] | |
| values | uint256[] |
ApprovalForAll
Emitted when account grants or revokes permission to operator to transfer their tokens.
event ApprovalForAll(address indexed account, address indexed operator, bool approved);Parameters
| Name | Type | Description |
|---|---|---|
| account | address | |
| operator | address | |
| approved | bool |
URI
Emitted when the URI for token type id changes to value, if it is a non-programmatic URI.
event URI(string value, uint256 indexed id);Parameters
| Name | Type | Description |
|---|---|---|
| value | string | |
| id | uint256 |
Errors
ERC1155InsufficientBalance
Sender does not have sufficient balance for the operation.
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);Parameters
| Name | Type | Description |
|---|---|---|
| sender | address | |
| balance | uint256 | |
| needed | uint256 | |
| tokenId | uint256 |
ERC1155InvalidSender
sender is the zero address.
error ERC1155InvalidSender(address sender);Parameters
| Name | Type | Description |
|---|---|---|
| sender | address |
ERC1155InvalidReceiver
receiver is the zero address or does not implement IERC1155Receiver correctly.
error ERC1155InvalidReceiver(address receiver);Parameters
| Name | Type | Description |
|---|---|---|
| receiver | address |
ERC1155MissingApprovalForAll
operator is not approved and the caller is not the owner.
error ERC1155MissingApprovalForAll(address operator, address owner);Parameters
| Name | Type | Description |
|---|---|---|
| operator | address | |
| owner | address |
ERC1155InvalidApprover
approver is the zero address.
error ERC1155InvalidApprover(address approver);Parameters
| Name | Type | Description |
|---|---|---|
| approver | address |
ERC1155InvalidOperator
operator is the zero address.
error ERC1155InvalidOperator(address operator);Parameters
| Name | Type | Description |
|---|---|---|
| operator | address |
ERC1155InvalidArrayLength
Array lengths of ids and values do not match.
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);Parameters
| Name | Type | Description |
|---|---|---|
| idsLength | uint256 | |
| valuesLength | uint256 |