Skip to content
Lattice

IERC1155

Git Source

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

NameTypeDescription
accountaddress
iduint256

Returns

NameTypeDescription
<none>uint256

balanceOfBatch

Batched version of balanceOf.

function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

Parameters

NameTypeDescription
accountsaddress[]
idsuint256[]

Returns

NameTypeDescription
<none>uint256[]

setApprovalForAll

Grants or revokes permission to operator to transfer the caller's tokens.

function setApprovalForAll(address operator, bool approved) external;

Parameters

NameTypeDescription
operatoraddress
approvedbool

isApprovedForAll

Returns true if operator is approved to transfer account's tokens.

function isApprovedForAll(address account, address operator) external view returns (bool);

Parameters

NameTypeDescription
accountaddress
operatoraddress

Returns

NameTypeDescription
<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

NameTypeDescription
fromaddress
toaddress
iduint256
valueuint256
databytes

safeBatchTransferFrom

Batched version of safeTransferFrom.

function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external;

Parameters

NameTypeDescription
fromaddress
toaddress
idsuint256[]
valuesuint256[]
databytes

uri

Returns the URI for token type id.

function uri(uint256 id) external view returns (string memory);

Parameters

NameTypeDescription
iduint256

Returns

NameTypeDescription
<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

NameTypeDescription
operatoraddress
fromaddress
toaddress
iduint256
valueuint256

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

NameTypeDescription
operatoraddress
fromaddress
toaddress
idsuint256[]
valuesuint256[]

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

NameTypeDescription
accountaddress
operatoraddress
approvedbool

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

NameTypeDescription
valuestring
iduint256

Errors

ERC1155InsufficientBalance

Sender does not have sufficient balance for the operation.

error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

Parameters

NameTypeDescription
senderaddress
balanceuint256
neededuint256
tokenIduint256

ERC1155InvalidSender

sender is the zero address.

error ERC1155InvalidSender(address sender);

Parameters

NameTypeDescription
senderaddress

ERC1155InvalidReceiver

receiver is the zero address or does not implement IERC1155Receiver correctly.

error ERC1155InvalidReceiver(address receiver);

Parameters

NameTypeDescription
receiveraddress

ERC1155MissingApprovalForAll

operator is not approved and the caller is not the owner.

error ERC1155MissingApprovalForAll(address operator, address owner);

Parameters

NameTypeDescription
operatoraddress
owneraddress

ERC1155InvalidApprover

approver is the zero address.

error ERC1155InvalidApprover(address approver);

Parameters

NameTypeDescription
approveraddress

ERC1155InvalidOperator

operator is the zero address.

error ERC1155InvalidOperator(address operator);

Parameters

NameTypeDescription
operatoraddress

ERC1155InvalidArrayLength

Array lengths of ids and values do not match.

error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);

Parameters

NameTypeDescription
idsLengthuint256
valuesLengthuint256