ERC-7531 Recognizing ownership of staked NFTs (Staked ERC-721 Ownership Recognition)

Review · NFTs & multi-token · created 2023-10-01

An interface that allows querying who the actual rights holder is and tracking it via events, even after an NFT's ownership has transferred to a staking contract upon deposit.

Why it is needed

Early NFTs were designed without a lockable feature, so staking them requires actually transferring the token to the staking contract. This means the standard lookup function ownerOf returns the pool contract's address as the owner, causing the original owner to lose the benefits given to holders. For example, BAYC holders lose club membership and event access while staking, and CryptoPunks holders can miss out on airdrops or exhibition opportunities given only to verified owners. Owners of early NFTs like EtherRocks lose the social status gained from proving ownership. In addition, when an NFT is lent out, ownership transfers to the lending contract, making it difficult to determine which wallet actually has the right to use that NFT in, for example, a game. This standard solves these problems with an interface that preserves a record of the original owner.

What to implement

In depth

The RightsHolderChange event and its timing of emission

This event MUST be emitted when the token's technical owner (the contract holding the token) differs from the actual rights holder. tokenAddress, tokenId, and holder are indexed parameters, and right is a bytes4 value representing the type of right. The event MUST be emitted either in the same block as the token's Transfer event or in any later block. This flexibility lets existing pools upgrade their systems without breaking backward compatibility, either by emitting the event for all already-staked tokens or by letting users reclaim ownership directly themselves. To verify authenticity, the receiving party MUST confirm that the contract that emitted the event is the token's current owner based on the relevant Transfer event.

Rights identifier scheme

A right is identified by the first 4 bytes (bytes4) of the keccak256 hash of its right name string. There are two basic rights supported initially: 0x399d2b36, which is bytes4(keccak256("ownership")), meaning ownership, and 0x230a5961, which is bytes4(keccak256("usage")), meaning usage. This approach lets projects add new rights without breaking interface compatibility. An NFT project introducing a new right SHOULD publicly disclose the string corresponding to the bytes4 hash and the rationale for introducing it, and to prevent a proliferation of rights that makes the system inefficient and complex, it SHOULD follow existing rights whenever possible.

The rightsHolderOf function

A lookup function that returns the address of an entity holding a right over a token, distinct from the current owner. Given an ERC-721 contract address (tokenAddress), a token ID (tokenId), and a right type (right), it returns the address holding that right. It MUST revert if the token does not exist or is not currently held in custody. Rather than modifying the existing ownerOf function, this adds a new function, preserving the original ownership record while retaining the utility attached to the NFT. This design lets NFT owners participate in staking pools or other DeFi activity without giving up their unique benefits.

Invalidation by Transfer Events

If a new Transfer event occurs for the same token, all prior RightsHolderChange events become invalid. This design ensures the most recent Transfer event reliably reflects the current ownership state. As a result, no separate event needs to be emitted when unstaking. This choice preserves compatibility with the broader ecosystem and improves gas efficiency. Therefore, any party tracking events should treat a Transfer event for the same token appearing after a RightsHolderChange as the latest state.

Optional Extension IERC7531Rights

Different NFTs require different rights. Some NFTs only need ownership verified, some need usage verified, some need both, and others may need to manage an entirely different set of rights. To support this flexibility, an OPTIONAL extension interface is proposed alongside the core standard. supportedERC7531Rights() returns the list of rights an NFT supports, and supportsERC7531Right(bytes4 right) returns whether a specific right is supported. If an NFT does not support this interface, as with existing NFTs, projects using that NFT SHOULD consider only the standard rights (ownership, usage).

Backward compatibility and proposal status

This standard is fully backwards compatible with existing ERC-721 contracts. It does not alter the ERC-721 standard itself but operates as an extension on the staking pool side, and an existing upgradeable staking pool can integrate it if it chooses to adopt it. This proposal requires ERC-165 and ERC-721 (requires: 165, 721). Note that this proposal is currently in Review status and is not yet a finalized standard, so its contents may change.

Things to watch out for

Original ERC · ← ERCs