Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

ERC1155

Allows creation of fungible, semi-fungible and non-fungible


tokens using one single token standard.

Functions -

function balanceOf(address account, uint256 id) external view


returns (uint256);
//Returns the amount of tokens of token type id owned by account

function balanceOfBatch(address[] calldata accounts,


uint256[] calldata ids) external view returns (uint256[]
memory);
//Retrieve multiple balances in a single call.

function setApprovalForAll(address operator, bool approved)


external;
//Grants or revokes permission to operator to transfer all tokens

function isApprovedForAll(address account, address operator)


external view returns (bool);
//Tells whether an operator is approved by a given owner

function safeTransferFrom(address from, address to, uint256


id, uint256 amount, bytes calldata data) external;
//Safely transfers the ownership of a given token ID to another
address If the target address is a contract, it must implement
onERC721Received, which is called upon a safe transfer
function safeBatchTransferFrom(address from, address to,
uint256[] calldata ids, uint256[] calldata amounts, bytes
calldata data) external;
//Batched version of safeTransferFrom

Events -

event TransferSingle(address indexed operator, address


indexed from, address indexed to, uint256 id, uint256 value);
//Emitted when value tokens of token type id are transferred from from to to by
operator

event TransferBatch(address indexed operator, address


indexed from, address indexed to, uint256[] ids, uint256[]
values);
//multiple TransferSingle events, where operator, from and to are the same for all
transfers.

event ApprovalForAll(address indexed account, address


indexed operator, bool approved);
//Emitted when account grants or revokes permission to operator to transfer their
tokens

event URI(string value, uint256 indexed id);

You might also like