ERC-1155
What is an ERC-1155?
A smart contract multi-token standard for:
https://eips.ethereum.org/EIPS/eip-1155
ERC-721 v.s. ERC-1155
ERC-721 tokens are good at identifying one type of object.
For example, balances are based on the entire contract for all tokenId values:
ERC-1155 tokens are good at identifying multiple objects.
For example, balances are isolated based on unique tokenId values:
Vending Machine Analogy
ERC-721:
ERC-1155:
ERC-1155 Batch Transfer
You can bulk transfer ERC-1155 tokens based on tokenId and quantity by calling:
What do ERC-721 and ERC-1155 contracts have in common?
OpenZeppelin contracts:
and
are safety inheritance contracts. A contract must inherit these contracts to accept tokens being transferred to them.
However, ERC-20 tokens do not have a safety inheritance holder contract.
When transferring tokens to contracts, call smart contract functions that have "transferFrom()" behavior. It is recommended to only send tokens directly to a contract on test networks, otherwise you risk accidentally burning your tokens.
ERC-1155 Example Contracts:
Here is how to mint and burn ERC-1155 tokens: