@@ -12,15 +12,25 @@ use soroban_sdk::{Address, Env, Symbol};
1212/// trait is designed to be used in conjunction with the `NonFungibleToken`
1313/// trait.
1414///
15- /// This implementation follows the ERC2981 standard for royalties, allowing:
16- /// - Setting global royalties for the entire collection
17- /// - Setting per-token royalties that override the global setting
15+ /// This implementation is inspired by the ERC2981 standard for royalties, and
16+ /// additionally, it allows:
17+ /// - Get the royalty info for a token
18+ /// - Set the global default royalty for the entire collection
19+ /// - Set per-token royalties that override the global setting
20+ /// - Remove per-token royalties to fall-back to the global royalty set for the
21+ /// contract
1822///
1923/// `storage.rs` file of this module provides the `NonFungibleRoyalties` trait
2024/// implementation.
2125///
2226/// # Notes
2327///
28+ /// In most marketplaces, royalty calculations are done in amounts of fungible
29+ /// tokens. For example, if an NFT is sold for 10000 USDC and royalty is 10%,
30+ /// 1000 USDC goes to the creator. To preserve the compatibility across
31+ /// Non-Fungible and Fungible tokens, we are using `i128` instead of `u128` for
32+ /// the `sale_price`, due to SEP-41.
33+ ///
2434/// `#[contractimpl]` macro requires even the default implementations to be
2535/// present under its scope. To avoid confusion, we do not provide the default
2636/// implementations here, but we are providing a macro that generates them.
@@ -109,7 +119,7 @@ pub trait NonFungibleRoyalties: NonFungibleToken {
109119 /// * data - `[]`
110120 fn remove_token_royalty ( e : & Env , token_id : u32 , operator : Address ) ;
111121
112- /// Returns `(Address, u128 )` - A tuple containing the receiver address and
122+ /// Returns `(Address, i128 )` - A tuple containing the receiver address and
113123 /// the royalty amount.
114124 ///
115125 /// # Arguments
@@ -123,7 +133,7 @@ pub trait NonFungibleRoyalties: NonFungibleToken {
123133 ///
124134 /// * [`crate::NonFungibleTokenError::NonExistentToken`] - If the token does
125135 /// not exist.
126- fn royalty_info ( e : & Env , token_id : u32 , sale_price : u128 ) -> ( Address , u128 ) ;
136+ fn royalty_info ( e : & Env , token_id : u32 , sale_price : i128 ) -> ( Address , i128 ) ;
127137}
128138
129139// ################## EVENTS ##################
0 commit comments