Skip to main content

ERC1155.sol

Read code on GitHub

Details

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.

Methods

balanceOf

Solidity
function balanceOf(address account, uint256 id) external view returns (uint256)
Details

See {IERC1155-balanceOf}. Requirements: - account cannot be the zero address.

Parameters

NameTypeDescription
accountaddressundefined
iduint256undefined

Returns

NameTypeDescription
_0uint256undefined

balanceOfBatch

Solidity
function balanceOfBatch(address[] accounts, uint256[] ids) external view returns (uint256[])
Details

See {IERC1155-balanceOfBatch}. Requirements: - accounts and ids must have the same length.

Parameters

NameTypeDescription
accountsaddress[]undefined
idsuint256[]undefined

Returns

NameTypeDescription
_0uint256[]undefined

isApprovedForAll

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

See {IERC1155-isApprovedForAll}.

Parameters

NameTypeDescription
accountaddressundefined
operatoraddressundefined

Returns

NameTypeDescription
_0boolundefined

safeBatchTransferFrom

Solidity
function safeBatchTransferFrom(address from, address to, uint256[] ids, uint256[] amounts, bytes data) external nonpayable
Details

See {IERC1155-safeBatchTransferFrom}.

Parameters

NameTypeDescription
fromaddressundefined
toaddressundefined
idsuint256[]undefined
amountsuint256[]undefined
databytesundefined

safeTransferFrom

Solidity
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes data) external nonpayable
Details

See {IERC1155-safeTransferFrom}.

Parameters

NameTypeDescription
fromaddressundefined
toaddressundefined
iduint256undefined
amountuint256undefined
databytesundefined

setApprovalForAll

Solidity
function setApprovalForAll(address operator, bool approved) external nonpayable
Details

See {IERC1155-setApprovalForAll}.

Parameters

NameTypeDescription
operatoraddressundefined
approvedboolundefined

supportsInterface

Solidity
function supportsInterface(bytes4 interfaceId) external view returns (bool)
Details

See {IERC165-supportsInterface}.

Parameters

NameTypeDescription
interfaceIdbytes4undefined

Returns

NameTypeDescription
_0boolundefined

uri

Solidity
function uri(uint256) external view returns (string)
Details

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.

Parameters

NameTypeDescription
_0uint256undefined

Returns

NameTypeDescription
_0stringundefined

Events

ApprovalForAll

Solidity
event ApprovalForAll(address indexed account, address indexed operator, bool approved)

Parameters

NameTypeDescription
account indexedaddressundefined
operator indexedaddressundefined
approvedboolundefined

TransferBatch

Solidity
event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values)

Parameters

NameTypeDescription
operator indexedaddressundefined
from indexedaddressundefined
to indexedaddressundefined
idsuint256[]undefined
valuesuint256[]undefined

TransferSingle

Solidity
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value)

Parameters

NameTypeDescription
operator indexedaddressundefined
from indexedaddressundefined
to indexedaddressundefined
iduint256undefined
valueuint256undefined

URI

Solidity
event URI(string value, uint256 indexed id)

Parameters

NameTypeDescription
valuestringundefined
id indexeduint256undefined