-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ERC-5666: Add Royalty Debt Registry
- Loading branch information
Bogdan Popa
committed
Mar 27, 2023
1 parent
3aed162
commit b7f71d6
Showing
14 changed files
with
741 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
--- | ||
eip: 5666 | ||
title: ERC-5666 - Registry for royalties payment for NFTs | ||
description: A registry used for paying royalties for any NFT with information about the creator | ||
author: Otniel Nicola (@OT-kthd), Bogdan Popa (@BogdanKTHD) | ||
discussions-to: https://ethereum-magicians.org/t/eip-5666-royalty-debt-registry/13569 | ||
status: Draft | ||
type: Standards Track | ||
category: ERC | ||
created: 2023-03-27 | ||
requires: 165, 2981 | ||
--- | ||
|
||
## Simple Summary | ||
|
||
A standard used for providing a way to pay royalties to a NFT’s creator and also cumulate the total paid value for a specific NFT and make it accessible to every NFT marketplace or ecosystem users. | ||
|
||
## Abstract | ||
|
||
This standard allows anyone to pay royalties for a certain NFT and also to keep track of the royalties amount paid. It will cumulate the value each time a payment is executed through it and make the information public. | ||
|
||
## Motivation | ||
|
||
There are many marketplaces which do not enforce any royalty payment to the NFT creator every time the NFT is sold or re-sold and/or providing a way for doing it. There are some marketplaces which use specific system of royalties, however that system is applicable for the NFTs creates on their platform. | ||
|
||
In this context, there is a need of a way for paying royalties, as it is a strong incentive for creators to keep contributing to the NFTs ecosystem. | ||
|
||
Additionally, this standard will provide a way of computing the amount of royalties paid to a creator for a certain NFT. This could be useful in the context of categorising NFTs in terms of royalties. The term “debt“ is used because the standard aims to provide a way of knowing if there are any royalties left unpaid for the NFTs trades that took place in a marketplace that does not support them and, in that case, expose a way of paying them. | ||
|
||
Not only the owner of it, but anyone could pay royalties for a certain NFT. This could be a way of supporting a creator for his work. | ||
|
||
## Specification | ||
|
||
The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119. | ||
|
||
Every contract compliant with EIP-5666 MUST implement the IERC5666 interface defined as follows: | ||
|
||
## Contract Interface | ||
|
||
```solidity | ||
// @title Royalty Debt Registry | ||
/// Note: the EIP-165 identifier for this interface is 0x253b27b0 | ||
interface IERC5666 { | ||
// Logged when royalties were paid for a NFT | ||
/// @notice Emitted when royalties are paid for the NFT with address tokenAddress and id tokenId | ||
event RoyaltiesPaid(address indexed tokenAddress, uint256 indexed tokenId, uint256 amount); | ||
/// @notice sends msg.value to the creator of a NFT | ||
/// @dev Throws if there are no on-chain informations about the creator | ||
/// @param tokenAddress The address of NFT contract | ||
/// @param tokenId The NFT id | ||
function payRoyalties(address tokenAddress, uint256 tokenId) external payable; | ||
/// @notice Get the amount of royalties which was paid for a NFT | ||
/// @dev | ||
/// @param tokenAddress The address of NFT contract | ||
/// @param tokenId The NFT id | ||
/// @return The amount of royalties paid for the NFT | ||
function getPaidRoyalties(address tokenAddress, uint256 tokenId) external view returns (uint256); | ||
} | ||
``` | ||
|
||
All functions defined as view MAY be implemented as pure or view | ||
|
||
Function payRoyalties MAY be implemented as public or external | ||
|
||
The event RoyaltiesPaid MUST be emitted when the payRoyalties function is called | ||
|
||
The supportsInterface method MUST return true when called with `0x253b27b0` | ||
|
||
## Rationale | ||
|
||
With a lot of places made for trading NFTs dropping down the royalty payment or having a centralised approach, we want to provide a way for anyone to pay royalties to the creators. | ||
|
||
The payment can be made in native coins so it is easy to aggregate the amount of paid royalties. We want this information to be public, so anyone could tell if a creator received royalties in case of under the table trading or in case of marketplaces which don’t support royalties. | ||
|
||
The function used for payment can be called by anyone (not only the NFTs owner) to support the creator at any time. There is a way of seeing the amount of paid royalties in any token, also available for anyone. | ||
|
||
For fetching creator on-chain data we will use EIP-2981, but any other on-chain method of getting the creator address is accepted. | ||
|
||
## Backwards Compatibility | ||
|
||
This EIP is not introducing any backward incompatibilities. | ||
|
||
## Test Cases | ||
|
||
Tests are included in [`ERC5666.test.js`](../assets/eip-5666/test/ERC5666.test.js). | ||
|
||
To run them in terminal, you can use the following commands: | ||
|
||
``` | ||
cd ../assets/eip-5666 | ||
npm install | ||
npx hardhat test | ||
``` | ||
|
||
## Reference Implementation | ||
|
||
See [`ERC5666.sol`](../assets/eip-5666/contracts/ERC5666.sol). | ||
|
||
## Security Considerations | ||
|
||
There are no security considerations related directly to the implementation of this standard. | ||
|
||
## Copyright | ||
|
||
Copyright and related rights waived via https://github.com/ethereum/EIPs/blob/master/LICENSE.md. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
artifacts | ||
cache | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
Creative Commons Legal Code | ||
|
||
CC0 1.0 Universal | ||
|
||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE | ||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN | ||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS | ||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES | ||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS | ||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM | ||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED | ||
HEREUNDER. | ||
|
||
Statement of Purpose | ||
|
||
The laws of most jurisdictions throughout the world automatically confer | ||
exclusive Copyright and Related Rights (defined below) upon the creator | ||
and subsequent owner(s) (each and all, an "owner") of an original work of | ||
authorship and/or a database (each, a "Work"). | ||
|
||
Certain owners wish to permanently relinquish those rights to a Work for | ||
the purpose of contributing to a commons of creative, cultural and | ||
scientific works ("Commons") that the public can reliably and without fear | ||
of later claims of infringement build upon, modify, incorporate in other | ||
works, reuse and redistribute as freely as possible in any form whatsoever | ||
and for any purposes, including without limitation commercial purposes. | ||
These owners may contribute to the Commons to promote the ideal of a free | ||
culture and the further production of creative, cultural and scientific | ||
works, or to gain reputation or greater distribution for their Work in | ||
part through the use and efforts of others. | ||
|
||
For these and/or other purposes and motivations, and without any | ||
expectation of additional consideration or compensation, the person | ||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she | ||
is an owner of Copyright and Related Rights in the Work, voluntarily | ||
elects to apply CC0 to the Work and publicly distribute the Work under its | ||
terms, with knowledge of his or her Copyright and Related Rights in the | ||
Work and the meaning and intended legal effect of CC0 on those rights. | ||
|
||
1. Copyright and Related Rights. A Work made available under CC0 may be | ||
protected by copyright and related or neighboring rights ("Copyright and | ||
Related Rights"). Copyright and Related Rights include, but are not | ||
limited to, the following: | ||
|
||
i. the right to reproduce, adapt, distribute, perform, display, | ||
communicate, and translate a Work; | ||
ii. moral rights retained by the original author(s) and/or performer(s); | ||
iii. publicity and privacy rights pertaining to a person's image or | ||
likeness depicted in a Work; | ||
iv. rights protecting against unfair competition in regards to a Work, | ||
subject to the limitations in paragraph 4(a), below; | ||
v. rights protecting the extraction, dissemination, use and reuse of data | ||
in a Work; | ||
vi. database rights (such as those arising under Directive 96/9/EC of the | ||
European Parliament and of the Council of 11 March 1996 on the legal | ||
protection of databases, and under any national implementation | ||
thereof, including any amended or successor version of such | ||
directive); and | ||
vii. other similar, equivalent or corresponding rights throughout the | ||
world based on applicable law or treaty, and any national | ||
implementations thereof. | ||
|
||
2. Waiver. To the greatest extent permitted by, but not in contravention | ||
of, applicable law, Affirmer hereby overtly, fully, permanently, | ||
irrevocably and unconditionally waives, abandons, and surrenders all of | ||
Affirmer's Copyright and Related Rights and associated claims and causes | ||
of action, whether now known or unknown (including existing as well as | ||
future claims and causes of action), in the Work (i) in all territories | ||
worldwide, (ii) for the maximum duration provided by applicable law or | ||
treaty (including future time extensions), (iii) in any current or future | ||
medium and for any number of copies, and (iv) for any purpose whatsoever, | ||
including without limitation commercial, advertising or promotional | ||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each | ||
member of the public at large and to the detriment of Affirmer's heirs and | ||
successors, fully intending that such Waiver shall not be subject to | ||
revocation, rescission, cancellation, termination, or any other legal or | ||
equitable action to disrupt the quiet enjoyment of the Work by the public | ||
as contemplated by Affirmer's express Statement of Purpose. | ||
|
||
3. Public License Fallback. Should any part of the Waiver for any reason | ||
be judged legally invalid or ineffective under applicable law, then the | ||
Waiver shall be preserved to the maximum extent permitted taking into | ||
account Affirmer's express Statement of Purpose. In addition, to the | ||
extent the Waiver is so judged Affirmer hereby grants to each affected | ||
person a royalty-free, non transferable, non sublicensable, non exclusive, | ||
irrevocable and unconditional license to exercise Affirmer's Copyright and | ||
Related Rights in the Work (i) in all territories worldwide, (ii) for the | ||
maximum duration provided by applicable law or treaty (including future | ||
time extensions), (iii) in any current or future medium and for any number | ||
of copies, and (iv) for any purpose whatsoever, including without | ||
limitation commercial, advertising or promotional purposes (the | ||
"License"). The License shall be deemed effective as of the date CC0 was | ||
applied by Affirmer to the Work. Should any part of the License for any | ||
reason be judged legally invalid or ineffective under applicable law, such | ||
partial invalidity or ineffectiveness shall not invalidate the remainder | ||
of the License, and in such case Affirmer hereby affirms that he or she | ||
will not (i) exercise any of his or her remaining Copyright and Related | ||
Rights in the Work or (ii) assert any associated claims and causes of | ||
action with respect to the Work, in either case contrary to Affirmer's | ||
express Statement of Purpose. | ||
|
||
4. Limitations and Disclaimers. | ||
|
||
a. No trademark or patent rights held by Affirmer are waived, abandoned, | ||
surrendered, licensed or otherwise affected by this document. | ||
b. Affirmer offers the Work as-is and makes no representations or | ||
warranties of any kind concerning the Work, express, implied, | ||
statutory or otherwise, including without limitation warranties of | ||
title, merchantability, fitness for a particular purpose, non | ||
infringement, or the absence of latent or other defects, accuracy, or | ||
the present or absence of errors, whether or not discoverable, all to | ||
the greatest extent permissible under applicable law. | ||
c. Affirmer disclaims responsibility for clearing rights of other persons | ||
that may apply to the Work or any use thereof, including without | ||
limitation any person's Copyright and Related Rights in the Work. | ||
Further, Affirmer disclaims responsibility for obtaining any necessary | ||
consents, permissions or other rights required for any use of the | ||
Work. | ||
d. Affirmer understands and acknowledges that Creative Commons is not a | ||
party to this document and has no duty or obligation with respect to | ||
this CC0 or use of the Work. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<div align="center"> | ||
|
||
# ERC5666 Royalty Debt Registry | ||
|
||
[![License: CC0-1.0](https://img.shields.io/badge/License-CC0-yellow.svg)](https://creativecommons.org/publicdomain/zero/1.0/) | ||
|
||
</div> | ||
|
||
This project provides a reference implementation of the proposed `ERC-5666 Royalty Debt Registry`. | ||
|
||
## Install | ||
|
||
In order to install the required dependencies you need to execute: | ||
```shell | ||
npm install | ||
``` | ||
|
||
## Compile | ||
|
||
In order to compile the solidity contracts you need to execute: | ||
```shell | ||
npx hardhat compile | ||
``` | ||
|
||
## Tests | ||
|
||
```shell | ||
npx hardhat test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
[ | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "tokenAddress", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "tokenId", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "CreatorError", | ||
"type": "error" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "creator", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "amount", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "PaymentError", | ||
"type": "error" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ | ||
"indexed": true, | ||
"internalType": "address", | ||
"name": "tokenAddress", | ||
"type": "address" | ||
}, | ||
{ | ||
"indexed": true, | ||
"internalType": "uint256", | ||
"name": "tokenId", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "uint256", | ||
"name": "amount", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "RoyaltiesPaid", | ||
"type": "event" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "tokenAddress", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "tokenId", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "getPaidRoyalties", | ||
"outputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "", | ||
"type": "uint256" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "tokenAddress", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "tokenId", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "payRoyalties", | ||
"outputs": [], | ||
"stateMutability": "payable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "bytes4", | ||
"name": "interfaceId", | ||
"type": "bytes4" | ||
} | ||
], | ||
"name": "supportsInterface", | ||
"outputs": [ | ||
{ | ||
"internalType": "bool", | ||
"name": "", | ||
"type": "bool" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
} | ||
] |
Oops, something went wrong.