NFT Token Standards (ERC-721/1155) 3 — Questions and Answers
Question 1: Which event must ERC-721 emit when a token changes hands?
- Approval
- Transfer (Correct answer)
- OwnershipChanged
- Moved
Correct answer: Transfer
ERC-721 emits Transfer(from, to, tokenId) on every mint, burn, and transfer.
Question 2: In ERC-1155, what does balanceOf(account, id) return?
- The number of token types owned
- The amount of a specific token id the account holds (Correct answer)
- The total supply of the id
- The account's ETH balance
Correct answer: The amount of a specific token id the account holds
ERC-1155 balanceOf takes both an account and an id, returning that account's holding of that id.
Question 3: What is the purpose of setApprovalForAll in both ERC-721 and ERC-1155?
- Approve one token
- Grant an operator control over all of the owner's tokens (Correct answer)
- Transfer all tokens
- Renounce ownership
Correct answer: Grant an operator control over all of the owner's tokens
setApprovalForAll authorizes an operator to manage every token the owner holds in that contract.
Question 4: Why is ERC-1155 generally more gas-efficient for large drops than ERC-721?
- It uses no storage
- Batch operations and shared metadata reduce per-token overhead (Correct answer)
- It avoids the EVM
- It compresses addresses
Correct answer: Batch operations and shared metadata reduce per-token overhead
Batch transfers and a shared id-based URI cut redundant transactions and storage writes.
Question 5: Which callback must a contract implement to safely receive an ERC-1155 single transfer?
- onERC721Received
- onERC1155Received (Correct answer)
- onTokenReceived
- tokenFallback
Correct answer: onERC1155Received
onERC1155Received must return its magic value so the transfer to a contract succeeds.
Question 6: In OpenZeppelin's ERC-721, what does _mint(to, tokenId) require about the tokenId?
- It must already exist
- It must not already be owned (Correct answer)
- It must be zero
- It must be even
Correct answer: It must not already be owned
_mint reverts if the tokenId already exists, preventing duplicate ownership.
Question 7: What does ERC-2981 add on top of ERC-721/1155?
- Batch transfers
- A standardized royalty info interface (Correct answer)
- Staking rewards
- On-chain metadata storage
Correct answer: A standardized royalty info interface
ERC-2981 provides royaltyInfo so marketplaces can query a standard royalty amount.
Which event must ERC-721 emit when a token changes hands?