ERC‑1155
1 min read
Pronunciation
[ee-are-see eleven-fifteen-five]
Analogy
ERC‑1155 is like a multi‑compartment toolbox—you can store identical nails (fungible) and unique tools (non‑fungible) in the same box.
Definition
The Ethereum multi‑token standard supporting both fungible and non‑fungible tokens within a single contract with batch operations.
Key Points Intro
ERC‑1155 enhances token standards via:
Key Points
Batch transfers: `safeBatchTransferFrom` moves multiple IDs in one call.
Multi‑token: Single contract handles diverse token classes.
Efficient events: `TransferBatch` reduces log overhead.
Receiver checks: Ensures safe transfers to contracts.
Example
A gaming contract mints 1 000 potions (fungible) and one “Excalibur” sword (non‑fungible) under ERC‑1155.
Technical Deep Dive
ERC‑1155 uses `mapping(uint256=>mapping(address=>uint256)) balances`. `safeTransferFrom` checks `to` for `onERC1155Received`. Batch functions iterate over arrays of `ids` and `amounts`. Metadata `uri(id)` uses ID substitution in URI templates.
Security Warning
Caveat
Complexity of multi‑token logic may increase attack surface.
ERC‑1155 - Related Articles
No related articles for this term.