ERC-7765 Real-world asset privilege NFT (Privileged Non-Fungible Tokens Tied To RWA)

Draft · NFTs & multi-token · created 2024-08-20

An ERC-721 extension standard that attaches privileges a holder can exercise to an NFT linked to a real-world asset (RWA), and standardizes the functions for exercising and querying those privileges.

Why it is needed

To actually receive, in reality, a good that was sold on-chain as an NFT, the holder's rights and whether those rights have been exercised must be verifiable on the blockchain. For example, if a pair of shoes is sold as an NFT, the holder should be able to exercise the right to redeem it off-chain for the physical shoes. But without a common standard for expressing such rights, each project ends up recording and exercising privileges in its own way. Wallets and services have to learn each contract's unique approach individually, making it hard to consistently show which privileges remain on a given NFT or whether they have already been exercised. This standard unifies exercising a privilege, checking whether it is exercisable and querying its exercise history, and listing privileges, all behind one interface, so that services, clients, UIs, and contracts can interoperate.

What to implement

In depth

A structure that inherits ERC-721 as is

This standard inherits all transfer and approval logic from ERC-721 unchanged. Name, symbol, and metadata URI lookups also follow the ERC-721 metadata standard as is. Compatible contracts MUST implement the IERC7765 interface, which is defined on top of IERC721 and IERC165. It is also fully compatible with both IERC721Metadata and IERC721Enumerable, the commonly used optional ERC-721 extensions. In other words, the design keeps the existing NFT ecosystem's transfer, lookup, and enumeration functionality intact while adding only the privilege-related functionality on top.

exercisePrivilege and the PrivilegeExercised event

exercisePrivilege(_to, _tokenId, _privilegeId, _data) is the function that exercises a specific privilege of a token. It must throw if _privilegeId is invalid, and is expected to emit a PrivilegeExercised event on success. The event carries the operator address _operator, the beneficiary address _to, the token ID, and the privilege ID. Once this event is recorded on-chain, it can be used to determine that the user has confirmed exercising the privilege, which then serves as the basis for fulfilling that privilege in reality. The _data field is for additional messages or future extensions, and can be used, for example, to exercise a privilege that takes effect immediately on-chain, such as directly distributing a crypto asset.

Three view functions for querying privilege status

isExercisable(_to, _tokenId, _privilegeId) returns a boolean for whether a given privilege is currently exercisable for the _to address, and isExercised(_to, _tokenId, _privilegeId) returns whether it has already been exercised. Both functions must fail for an invalid _privilegeId. getPrivilegeIds(_tokenId) returns the array of all privilege IDs tied to a token, providing a way to manage the association between NFTs and privilege IDs. With just these functions, wallets and services can check a privilege's existence, exercisability, and exercise history in a standard way.

Why a separate _to address is taken

All three functions, exercisePrivilege, isExercisable, and isExercised, take a _to address as a parameter. This is designed so that someone other than the NFT holder or transaction sender can receive the benefit of the privilege. However, this standard makes no assumptions about who is authorized to perform this exercise. Which externally owned account (EOA) or contract account may call exercisePrivilege is entirely up to the developer using this standard.

The optional privilege metadata extension

IERC7765Metadata is an OPTIONAL extension that provides a unique URI per privilege ID through the privilegeURI(_privilegeId) function. It must fail for an invalid _privilegeId, and the URI is defined per RFC 3986. This URI can point to a JSON file conforming to the ERC-7765 metadata JSON schema, which has three attributes: name, identifying the privilege; description, describing the privilege; and resource, a URI pointing to a resource representing the privilege. A contract implementing IERC7765Metadata SHALL also implement IERC7765.

A proposal still at the draft stage

This proposal's status is Draft. Since its content may still change, when implementing or referencing it, it is best to check the latest state of the original text. A reference implementation (ERC7765Example.sol) is linked in the original text.

Things to watch out for

Original ERC · ← ERCs