EIP-5008: EIP-721 Nonce Extension
Add a `nonce` function to EIP-721.
| 作者 | Anders, Lance, Shrug |
|---|---|
| 讨论-To | https://ethereum-magicians.org/t/eip5008-eip-721-nonce-and-metadata-update-extension/8925 |
| 状态 | Review |
| 类型 | Standards Track |
| 分类 | ERC |
| 创建日期 | 2022-04-10 |
| 依赖 | 165, 721 |
| 英文版 | https://eips.ethereum.org/EIPS/eip-5008 |
目录
Abstract
This standard is an extension of EIP-721. It proposes adding a nonce function to EIP-721 tokens.
Motivation
Some orders of NFT marketplaces have been attacked and the NFTs sold at a lower price than the current market floor price. This can happen when users transfer an NFT to another wallet and, later, back to the original wallet. This reactivates the order, which may list the token at a much lower price than the owner would have intended.
This EIP proposes adding a nonce property to EIP-721 tokens, and the nonce will be changed when a token is transferred. If a nonce is added to an order, the order can be checked to avoid attacks.
Specification
The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY” and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.
interface IERC5008 /* is IERC165 */ {
/// @notice Get the nonce of an NFT
/// Throws if `tokenId` is not a valid NFT
/// @param tokenId The id of the NFT
/// @return The nonce of the NFT
function nonce(uint256 tokenId) external view returns(uint256);
}
The nonce(uint256 tokenId) function MUST be implemented as view.
The supportsInterface method MUST return true when called with 0xce03fdab.
Rationale
At first transferCount was considered as function name, but there may some case to change the nonce besides transfer, such as important properties changed, then we changed transferCount to nonce.
向后兼容性
This standard is compatible with EIP-721.
测试用例
Test cases are included in test.js.
Run:
cd ../assets/eip-5008
npm install
npx hardhat test ./test/test.ts
Reference Implementation
See ERC5008.sol.
Security Considerations
No security issues found.
Copyright
Copyright and related rights waived via CC0.
参考文献
Please cite this document as:
Anders, Lance, Shrug, "EIP-5008: EIP-721 Nonce Extension [DRAFT]," Ethereum Improvement Proposals, no. 5008, April 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-5008.