Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Royalty standard #155

Merged
merged 29 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e033939
Add loyalty standard in NEP-11
superboyiii Sep 2, 2022
60ad293
add mail
superboyiii Sep 2, 2022
f01b436
Change it to an independent standard
superboyiii Sep 5, 2022
b229a55
Apply some feedback
superboyiii Sep 7, 2022
0ef359d
fix
superboyiii Sep 7, 2022
ac114e9
update
superboyiii Sep 7, 2022
7c5aa74
fix
superboyiii Sep 7, 2022
c5c82d5
fix
superboyiii Sep 8, 2022
4a56389
fix safe
superboyiii Sep 8, 2022
6ccfe0c
remove isGlobalRoyalty() & modify the description
superboyiii Sep 13, 2022
2d0ceb7
udpate
superboyiii Sep 13, 2022
2ddf6a3
Vincent's advice
superboyiii Sep 15, 2022
f6d6939
add Vincent to author
superboyiii Sep 15, 2022
e769920
format
superboyiii Sep 15, 2022
fbcaaf5
add royaltyToken in royaltyInfo
superboyiii Jan 31, 2023
674bfa3
update RoyaltiesTransferred
superboyiii Jan 31, 2023
c126eb1
Fix description
superboyiii Feb 9, 2023
a0d3bc6
format
superboyiii Feb 10, 2023
088aad5
Fix the definition of royaltyAmount
superboyiii Feb 10, 2023
d31194e
fix Motivation
superboyiii May 9, 2023
bb726a5
Update nep-x1.mediawiki
superboyiii Oct 10, 2023
4da58cd
Merge branch 'neo-project:master' into add-nep11-royalty
superboyiii Mar 20, 2024
8b61cc9
some improvement on description
superboyiii Mar 20, 2024
1066b62
name proposal as NEP-24
superboyiii Mar 26, 2024
8a8b8c2
fix README.mediawiki
superboyiii Mar 28, 2024
b0d2211
Add Implementation
superboyiii Mar 28, 2024
4cde4d3
little-fix
superboyiii Mar 29, 2024
351f751
Merge branch 'master' into add-nep11-royalty
superboyiii Apr 11, 2024
fd7035a
add example
superboyiii Apr 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
|}
|}
superboyiii marked this conversation as resolved.
Show resolved Hide resolved
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<zhangzhihong@ngd.neo.org>, Vincent Geneste<vincentgeneste@gmail.com>
Type: Standard
Status: Accepted
Created: 2022-09-05
</pre>

superboyiii marked this conversation as resolved.
Show resolved Hide resolved
==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.
superboyiii marked this conversation as resolved.
Show resolved Hide resolved

==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