-
Notifications
You must be signed in to change notification settings - Fork 36
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 MarketplaceHooks and MarketFee traits & upgrade to Polkadot v0.9.37 #276
base: main
Are you sure you want to change the base?
Conversation
…FT can be sold in marketplace
… and upgrad rust toolchain
Add MarketplaceHooks and MarketFee traits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not very familiar with the domain but looks good overall. @Szegoo please take a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; Sorry for the late review.
@@ -252,6 +285,11 @@ pub mod pallet { | |||
let sender = ensure_signed(origin)?; | |||
let owner = pallet_uniques::Pallet::<T>::owner(collection_id.into(), nft_id) | |||
.ok_or(Error::<T>::TokenDoesNotExist)?; | |||
// Check MarketplaceHooks function if the can NFT be listed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Check MarketplaceHooks function if the can NFT be listed | |
// Check MarketplaceHooks function to see whether the NFT can be listed |
/// trait. | ||
/// - royalty_info: Royalty account and royalty fee to be calculated in the `MarketplaceHooks` | ||
/// trait. | ||
fn calculate_and_finalize_purchase_and_fees( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the name of this function has too many details. We should probably use something a bit more abstract. But keep in mind that this is just a suggestion, so do whatever you feel is right.
fn calculate_and_finalize_purchase_and_fees( | |
fn finalize_purchase( |
Description
Currently the Market pallet has no way to check if the type of NFT can be sold (i.e. Stakepool v2 NFTs vs PhalaWorld Shell NFTs). To resolve this, there are an introduction to 2 new traits called
MarketplaceHooks
andMarketFee
which will hold the standard market fee percentage constant in theMarketFee
trait and theMarketplaceHooks
will implement 3 functions calledcalculate_market_fee(amount)
calculate_royalty_fee(amount, royalty_fee)
andcan_list_or_buy_in_market(collections_id, nft_id)
that will help prevent NFTs from being listed that are not eligible for the marketplace.Targets
MarketFee
andMarketplaceHooks
Default
for the traits in runtimeMarketplaceHooks
trait