EIPs Explained

ERC-7765 · Draft · ERC · 2024-08-20

ERC-7765: Privileged Non-Fungible Tokens Tied To RWA

An ERC-721 extension for NFTs tied to real-world assets that carry redeemable privileges, with a standard way to exercise a privilege on-chain and check whether it has been used.

What problem does it solve?

NFTs are often sold as a claim on something in the real world: a pair of shoes, a ticket, a service voucher. The holder wants to redeem that claim, and the seller needs an on-chain record that a specific right was used, so it cannot be claimed twice.

Every project builds its own redemption logic today, so wallets, marketplaces and fulfilment services cannot handle these tokens generically. ERC-7765 standardises how an NFT exposes its privileges and how a holder exercises them.

How it works

The token is a normal ERC-721 NFT (transfers and approvals unchanged) that additionally implements IERC7765:

Function / event Purpose
getPrivilegeIds(tokenId) List the privileges attached to a token
isExercisable(to, tokenId, privilegeId) Can this privilege currently be exercised for to?
isExercised(to, tokenId, privilegeId) Has it already been exercised for to?
exercisePrivilege(to, tokenId, privilegeId, data) Exercise it; should emit PrivilegeExercised
PrivilegeExercised(operator, to, tokenId, privilegeId) Signal that off-chain fulfilment can start

The to parameter lets a privilege benefit someone other than the holder or the caller (for example, sending a gift). The data bytes are free-form, for shipping references or for privileges settled on-chain.

An optional IERC7765Metadata extension adds privilegeURI(privilegeId), pointing to JSON with name, description and resource for each privilege.

The standard deliberately does not decide who may call exercisePrivilege; access control is left to each implementation.

Sample code

// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;

interface IERC7765 {
    event PrivilegeExercised(
        address indexed _operator,
        address indexed _to,
        uint256 indexed _tokenId,
        uint256 _privilegeId
    );

    function exercisePrivilege(address _to, uint256 _tokenId, uint256 _privilegeId, bytes calldata _data) external;
    function isExercisable(address _to, uint256 _tokenId, uint256 _privilegeId) external view returns (bool);
    function isExercised(address _to, uint256 _tokenId, uint256 _privilegeId) external view returns (bool);
    function getPrivilegeIds(uint256 _tokenId) external view returns (uint256[] memory);
}

A fulfilment service watching for redemptions (ethers v6):

import { Contract, JsonRpcProvider } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const nft = new Contract(nftAddress, [
  "event PrivilegeExercised(address indexed _operator, address indexed _to, uint256 indexed _tokenId, uint256 _privilegeId)",
], provider);

nft.on("PrivilegeExercised", (operator, to, tokenId, privilegeId) => {
  console.log(`ship privilege ${privilegeId} of token ${tokenId} for ${to}`);
});

Things to know

  • Status: Draft. The interface may still change.
  • The chain only records that a privilege was claimed. Delivering the physical item or service depends entirely on the issuer, so buyers rely on the issuer's off-chain promise.
  • Implementations must track per-token, per-privilege state carefully and define clear access control on exercisePrivilege; the spec calls out both as the main security concerns.
  • Support should be advertised via ERC-165 supportsInterface.

#nft #rwa #redemption #erc721 #privileges

Details

Authors
frank (@frankmint2024) <[email protected]>
Status
Draft
Type
Standards Track / ERC
Created
2024-08-20
Requires

Machine-readable: Markdown · JSON