EIPs Explained

ERC-6786 · Draft · ERC · 2023-03-27

ERC-6786: Registry for royalties payment for NFTs

A draft registry where anyone can pay royalties for any NFT in ETH and anyone can read how much has been paid in total, as an opt-in fix for marketplaces that skip royalties.

What problem does it solve?

ERC-2981 lets an NFT contract announce who should receive royalties and how much, but nothing forces a marketplace to pay. Many trades happen on venues that ignore royalties, or privately, and creators have no on-chain record of what they have actually received.

ERC-6786 proposes a simple royalty debt registry. Any buyer, seller or fan can send royalties for a specific NFT through it, the payment is forwarded to the creator, and the registry keeps a public running total per token. The authors use the word "debt" because the totals can be compared with trading history to see whether royalties were left unpaid.

How it works

The registry exposes one payable function, one view and one event:

Member Purpose
payRoyalties(tokenAddress, tokenId) payable Forwards msg.value to the NFT's creator and adds it to the token's total
getPaidRoyalties(tokenAddress, tokenId) Cumulative royalties paid for that NFT
RoyaltiesPaid(tokenAddress, tokenId, amount) Emitted on every payment
  • The creator's address is looked up on-chain, by default via ERC-2981 royaltyInfo, though the spec allows other on-chain sources. If no creator information is found, payRoyalties reverts.
  • Payments are in the chain's native coin, which keeps the totals easy to aggregate.
  • The registry must report support for interface ID 0x253b27b0 through ERC-165.

Anyone can call payRoyalties, not just the NFT's owner, so it can also be used to tip a creator.

Sample code

A minimal registry using ERC-2981 to find the receiver:

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

interface IERC2981 {
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external view returns (address receiver, uint256 royaltyAmount);
}

contract RoyaltyDebtRegistry {
    event RoyaltiesPaid(address indexed tokenAddress, uint256 indexed tokenId, uint256 amount);
    mapping(address => mapping(uint256 => uint256)) private paid;

    function payRoyalties(address tokenAddress, uint256 tokenId) external payable {
        (address creator, ) = IERC2981(tokenAddress).royaltyInfo(tokenId, 0);
        require(creator != address(0), "no creator info");
        paid[tokenAddress][tokenId] += msg.value;
        emit RoyaltiesPaid(tokenAddress, tokenId, msg.value);
        (bool ok, ) = creator.call{value: msg.value}("");
        require(ok, "transfer failed");
    }

    function getPaidRoyalties(address tokenAddress, uint256 tokenId) external view returns (uint256) {
        return paid[tokenAddress][tokenId];
    }

    function supportsInterface(bytes4 id) external pure returns (bool) {
        return id == 0x253b27b0 || id == 0x01ffc9a7;
    }
}

Paying from a script (ethers v6):

await registry.payRoyalties(nftAddress, tokenId, { value: parseEther("0.01") });

Things to know

  • Status is Draft.
  • Paying through the registry is voluntary; it records goodwill payments but does not enforce royalties.
  • The running total is only as meaningful as the creator lookup: if the NFT's royaltyInfo receiver changes, past totals stay attached to the token, not to a person.
  • Only native-coin payments are tracked; royalties paid in tokens or directly to the creator are invisible to the registry.
  • The spec lists no security considerations, but any real deployment should still guard the external call to the creator (reentrancy, receivers that reject ETH).

#nft #royalties #registry #creators #draft

Details

Authors
Otniel Nicola (@OT-kthd), Bogdan Popa (@BogdanKTHD)
Status
Draft
Type
Standards Track / ERC
Created
2023-03-27
Requires

Machine-readable: Markdown · JSON