Solidity theorytheory 0/50 · 0%
Standards · medium

34. ERC-721 and ERC-1155

Unique tokens and multi-token balances.

ERC-721 tracks a single owner per `tokenId` and adds safe transfers that call `onERC721Received` on contract recipients. ERC-1155 stores `balanceOf(account, id)`, supporting fungible and non-fungible ids in one contract with batch transfers.

function ownerOf(uint256 id) external view returns (address);
function balanceOf(address a, uint256 id) external view returns (uint256);

Metadata lives off chain at `tokenURI`; pin it to IPFS if you want it to survive.

Check your understanding

  1. 1. How many owners does an ERC-721 token id have?

  2. 2. What does ERC-1155 add?

  3. 3. Why does `safeTransferFrom` call the receiver?