Skip to content

Commit

Permalink
Add Royalty standard (#155)
Browse files Browse the repository at this point in the history
* Add loyalty standard in NEP-11

* add mail

* Change it to an independent standard

* Apply some feedback

* fix

* update

* fix

* fix

* fix safe

* remove isGlobalRoyalty() & modify the description

* udpate

* Vincent's advice

* add Vincent to author

* format

* add royaltyToken in royaltyInfo

* update RoyaltiesTransferred

* Fix description

* format

* Fix the definition of royaltyAmount

* fix Motivation

* Update nep-x1.mediawiki

Co-authored-by: Shargon <[email protected]>

* some improvement on description

* name proposal as NEP-24

* fix README.mediawiki

* Add Implementation

* little-fix

* add example

---------

Co-authored-by: Shargon <[email protected]>
  • Loading branch information
superboyiii and shargon authored Apr 17, 2024
1 parent c60434e commit a69b528
Show file tree
Hide file tree
Showing 2 changed files with 177 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,21 @@ First review [[nep-1.mediawiki|NEP-1]]. Then clone the repository and add your N
| Informational
| Accepted
|-
|
| [[nep-23.mediawiki|23]]
| JSON-RPC error handling and codes
| Anna Shaleva, Roman Khimov
| Informational
| Accepted
|-
|
| [https://github.com/neo-project/proposals/pull/155 24]
| NFT Royalty Standard
| Owen Zhang, Vincent Geneste
| Standard
| Accepted
|-
|
| Dynamic Sharding
|
| Standard
Expand Down Expand Up @@ -146,4 +154,4 @@ First review [[nep-1.mediawiki|NEP-1]]. Then clone the repository and add your N
|
| Standard
| Stub
|}
|}
168 changes: 168 additions & 0 deletions nep-24.mediawiki
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<pre>
NEP: 24
Title: NFT Royalty Standard
Author: Owen Zhang<[email protected]>, Vincent Geneste<[email protected]>
Type: Standard
Status: Accepted
Created: 2022-09-05
</pre>

==Abstract==

This NEP defines a global standard to get royalty payment information for Non-Fungible Tokens (NFTs) in order to enable support for royalty payments across all NFT marketplaces in the NEO Smart Economy.
Reference: The NFT Standard [NEP-11](https://github.com/neo-project/proposals/blob/master/nep-11.mediawiki)

==Motivation==

There is a need for supporting royalty information, which is useful not only for royalty payments across NFT marketplaces but also good to protect creative copyright. Currently, there is no standard for creators to declare royalty to all marketplaces in their NFTs. In this sense, they have to discuss the royalty with different marketplaces, otherwise these marketplaces, which haven't touched with the creators, can't get royalty details and define the royalty in their marketplace contract by themselves. This standard is compatible with [NEP-11](https://github.com/neo-project/proposals/blob/master/nep-11.mediawiki).

==Specification==

NEP-11 compliant contracts MAY implement this NEP for royalties to provide a standard method of specifying royalty payment information.

===Common methods===

====royaltyInfo====

<pre>
{
"name": "royaltyInfo",
"safe": true,
"parameters": [
{
"name": "tokenId",
"type": "ByteString"
},
{
"name": "royaltyToken",
"type": "Hash160"
},
{
"name": "salePrice",
"type": "Integer"
}
],
"returntype": "Array"
}
</pre>

Returns a NeoVM Array stack item with single or multi array, each array still has two elements, for example:

Single royaltyRecipient

<pre>
[
[
{
"name":"royaltyRecipient",
"type":"Hash160"
},
{
"name":"royaltyAmount",
"type":"Integer"
}
]
]
</pre>

Multi royaltyRecipient

<pre>
[
[
{
"name":"royaltyRecipient",
"type":"Hash160"
},
{
"name":"royaltyAmount",
"type":"Integer"
}
],
[
{
"name":"royaltyRecipient",
"type":"Hash160"
},
{
"name":"royaltyAmount",
"type":"Integer"
}
],
[
{
"name":"royaltyRecipient",
"type":"Hash160"
},
{
"name":"royaltyAmount",
"type":"Integer"
}
]
]
</pre>

<code>royaltyToken</code> is the token hash for royalty payment.

<code>salePrice</code> MUST be amount without decimals.

<code>royaltyRecipient</code> is the address of who will be sent the royalty payment, MUST be a 20-byte address.

<code>royaltyAmount</code> MUST be the royalty amount without decimals rather than a percentage so there's no dispute between marketplaces about how much is the calculated result.

This function is not for initial sale or mint, it's only for secondary marketplaces.

Marketplaces that support this method MAY implement any method of calculating or transferring royalties to the royalty recipient.

Marketplaces MUST pay the royalty in the same unit of exchange as that of the <code>salePrice</code> passed to royaltyInfo(). For example, if the sale price is in NEO, then the royalty payment must also be paid in NEO, and if the sale price is in GAS, then the royalty payment must also be paid in GAS.

The royaltyInfo() function MUST NOT ignore the <code>salePrice</code>, <code>royaltyAmount</code> MAY be dynamic due to <code>salePrice</code> and time.

Marketplaces that support this standard MUST emit the event, <code>RoyaltiesTransferred</code> for each recipient, after sending a payment.

===Events===

====RoyaltiesTransferred====

<pre>
{
"name": "RoyaltiesTransferred",
"parameters": [
{
"name": "royaltyToken",
"type": "Hash160"
},
{
"name": "royaltyRecipient",
"type": "Hash160"
},
{
"name": "buyer",
"type": "Hash160"
},
{
"name": "tokenId",
"type": "ByteString"
},
{
"name": "amount",
"type": "Integer"
}
]
}
</pre>

<code>royaltyToken</code> MUST be the same address as that in <code>royaltyInfo</code> method.

<code>royaltyRecipient</code> MUST be the same address as that in <code>royaltyInfo</code> method.

MUST trigger after marketplaces transferring royalties to the royalty recipient if <code>royaltyInfo</code> method is implemented.

Each <code>royaltyRecipient</code> has 1 event. That means if there are 5 <code>royaltyRecipient</code> in <code>royaltyInfo</code> method, 5 <code>RoyaltiesTransferred</code> events MUST be triggered.

==Implementation==

https://github.com/OnBlockIO/n3-tokens-contracts/blob/6b01ac3f46b18629f880dcac4e2f5bb4e7f94a37/contracts/NEP11/GhostMarket.NFT.py#L475

https://github.com/neo-project/neo-devpack-dotnet/blob/master/examples/Example.SmartContract.SampleRoyaltyNEP11Token/SampleRoyaltyNEP11Token.cs

0 comments on commit a69b528

Please sign in to comment.