NFT On-Chain Royalties (EIP-2981) 3 — Questions and Answers
Question 1: In OpenZeppelin's ERC2981 contract, what does _setDefaultRoyalty set?
- A collection-wide royalty receiver and fee (Correct answer)
- The royalty for a single token only
- The contract owner
- The maximum supply
Correct answer: A collection-wide royalty receiver and fee
_setDefaultRoyalty configures a default receiver and fee fraction applied to all tokens lacking a specific override.
Question 2: How does OpenZeppelin let you override royalties for one specific token?
- _setTokenRoyalty (Correct answer)
- _mintWithRoyalty
- _overrideFee
- setTokenURI
Correct answer: _setTokenRoyalty
_setTokenRoyalty assigns a per-token receiver and fee that takes precedence over the default.
Question 3: In OpenZeppelin's implementation, what is the denominator for the fee fraction by default?
- 10000 (basis points) (Correct answer)
- 100
- 1000000
- 256
Correct answer: 10000 (basis points)
The default _feeDenominator returns 10000, so fees are expressed in basis points (e.g., 500 = 5%).
Question 4: A fee numerator of 250 with the default denominator represents what royalty?
- 2.5% (Correct answer)
- 25%
- 0.25%
- 250%
Correct answer: 2.5%
250 / 10000 equals 0.025, which is a 2.5% royalty.
Question 5: What happens if you set a fee numerator greater than the denominator in OpenZeppelin's ERC2981?
- The transaction reverts with a royalty-too-high error (Correct answer)
- It silently caps at 100%
- It wraps around to 0%
- It is allowed and exceeds the sale price
Correct answer: The transaction reverts with a royalty-too-high error
OpenZeppelin reverts if the fee numerator exceeds the denominator, preventing royalties above 100%.
Question 6: When deleting a token-specific royalty, which OpenZeppelin function is used?
- _resetTokenRoyalty (Correct answer)
- _clearRoyalty
- _burnRoyalty
- _removeFee
Correct answer: _resetTokenRoyalty
_resetTokenRoyalty removes a per-token override so the token falls back to the default royalty.
Question 7: To expose EIP-2981 alongside ERC-721 in OpenZeppelin, what must supportsInterface do?
- Override and call super to combine both interface checks (Correct answer)
- Return true for all inputs
- Only check the ERC2981 ID
- Be removed entirely
Correct answer: Override and call super to combine both interface checks
You override supportsInterface and call super so both ERC721 and ERC2981 interface IDs are reported.
In OpenZeppelin's ERC2981 contract, what does _setDefaultRoyalty set?