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
Changes from 9 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
137 changes: 137 additions & 0 deletions nep-x1.mediawiki
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<pre>
NEP: Undefined
Title: NFT Royalty Standard
Author: Owen Zhang<zhangzhihong@ngd.neo.org>
Type: Standard
Status: Draft
superboyiii marked this conversation as resolved.
Show resolved Hide resolved
Created: 2022-09-05
</pre>

==Abstract==
superboyiii marked this conversation as resolved.
Show resolved Hide resolved

This NEP defines a global standard to get royalty payment information for non-fungible tokens (NFTs) to enable support for royalty payments across all NFT marketplaces in the NEO Smart Economy.
superboyiii marked this conversation as resolved.
Show resolved Hide resolved

==Motivation==

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

==Specification==

===Common methods===

====isGlobalRoyalty====

<pre>
{
"name": "isGlobalRoyalty",
"safe": true,
"parameters": [],
"returntype": "Boolean"
}
</pre>

This function shows if this contract has <code>global royalty</code> or <code>specific royalty</code> to different tokenId.

If return <code>true</code>, then it has global royalty. All tokenId MUST implement the same static royalty amount.

If return <code>false</code>, then it has specific royalty. MUST store specific royalty amount for each tokenId, static or dynamic, either is OK .

====royaltyInfo====

If <code>isGlobalRoyalty</code> return true, this function should be:

<pre>
{
"name": "royaltyInfo",
superboyiii marked this conversation as resolved.
Show resolved Hide resolved
"safe": true,
"parameters": [],
"returntype": "Array"
}
</pre>

If <code>isGlobalRoyalty</code> return false, this function should be:

<pre>
{
"name": "royaltyInfo",
"safe": true,
"parameters": [
{
"name": "tokenId",
"type": "ByteString"
},
{
"name": "salePrice",
"type": "Integer"
}
],
"returntype": "Array"
superboyiii marked this conversation as resolved.
Show resolved Hide resolved
}
</pre>

Returns a JSON Array which includes <code>royaltyRecipient</code> and <code>royaltyAmount</code>.
superboyiii marked this conversation as resolved.
Show resolved Hide resolved

MUST follow the JSON Array below:
<pre>
[
{
"name":"royaltyRecipient",
"type":"Hash160"
},
{
"name":"royaltyAmount",
"type":"Integer"
}
]
</pre>

<code>royaltyRecipient</code> is the address of who should be sent the royalty payment, SHOULD be a 20-byte address.
superboyiii marked this conversation as resolved.
Show resolved Hide resolved

<code>royaltyAmount</code> Must be a percentage fixed point with a scaling factor of 100 (x/100). For example: "1000" for 10%.

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>ReceivedRoyalties</code>, after sending a payment.

===Events===

====RoyaltiesTransferred====

<pre>
{
"name": "RoyaltiesTransferred",
superboyiii marked this conversation as resolved.
Show resolved Hide resolved
"parameters": [
{
"name": "contractHash",
"type": "Hash160"
},
{
"name": "royaltyRecipient",
superboyiii marked this conversation as resolved.
Show resolved Hide resolved
"type": "Hash160"
},
{
"name": "buyer",
"type": "Hash160"
},
{
"name": "tokenId",
"type": "ByteString"
},
{
"name": "amount",
"type": "Integer"
}
]
}
</pre>

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