ERC-5560 Redeemable NFT extension (Redeemable NFTs)
Stagnant · NFTs & multi-token · created 2022-08-30
An extension that adds a redeem function to an EIP-721 NFT, providing a standard way to indicate that the NFT can be exchanged for a physical object and whether that exchange has occurred.
Why it is needed
An increasing number of NFT issuers, such as artists, galleries, auction houses, and brands, want to provide physical objects to NFT holders. However, there is no standard way for wallets, marketplaces, or other services to check whether a given NFT can be exchanged for a physical object, or whether it has already been exchanged and can no longer be redeemed. When each issuer implements this feature differently, external services cannot read redeemability, and there is no common signal to detect and update state when a redemption occurs. This standard solves the problem by unifying the lookup function and the event.
What to implement
event Redeem(address indexed from, uint256 indexed tokenId);: An event emitted when a token is redeemed.function isRedeemable(uint256 _tokenId) external view returns (bool);: Queries whether the given token is still redeemable.function redeem(uint256 _tokenId) external;: Processes the exchange of the given token for a physical object.
In depth
Default value of isRedeemable and its transition
At the time the contract is deployed, isRedeemable() returns true by default for every token. Once the redeem() function is successfully called, isRedeemable() for that same token changes to return false from then on. This function must be externally queryable (view) by anyone, and handling of the case where a given token does not exist is supplemented by an exists check in the Reference Implementation.
Access control for the redeem function
NFT issuers MUST decide who can call the redeem() function and restrict access accordingly. Since the default visibility in the spec is public, anyone can call it unless restricted. To prevent this, it is RECOMMENDED to add a require check for ownerOf(tokenId) == msg.sender to restrict calls to the token owner only.
Redeem event
When the redeem() function is called, a Redeem(address indexed from, uint256 indexed tokenId) event MUST be emitted. from is the address that called the redemption, and tokenId is the identifier of the redeemed token. Third-party services supporting this standard MAY subscribe to this event to detect changes in a token's redeemable state.
ERC-165 interface identifier
A contract implementing this standard MUST return true from the supportsInterface function for the interface identifier 0x2f8ca953. This value is the ERC-165 computation result of the functions defined in the IRedeemable interface, set as a constant in the parent contract. This lets other contracts or services detect whether a given NFT contract supports this standard.
Backward compatibility with EIP-721
This standard is an extension designed to be compatible with EIP-721. An existing EIP-721 compliant contract MAY or MAY NOT implement this EIP, so it does not affect existing EIP-721 functionality.
Proposal status
This EIP is currently in Stagnant status, a proposal whose activity has halted without further discussion or changes. The Security Considerations section is also marked only as "Needs discussion," so the original text does not yet contain specific security considerations.