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 MarketplaceHooks and MarketFee traits & upgrade to Polkadot v0.9.37 #276

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

HashWarlock
Copy link
Contributor

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 and MarketFee which will hold the standard market fee percentage constant in the MarketFee trait and the MarketplaceHooks will implement 3 functions called calculate_market_fee(amount) calculate_royalty_fee(amount, royalty_fee) and can_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

  • add new traits MarketFee and MarketplaceHooks
  • implement Default for the traits in runtime
  • access control function in MarketplaceHooks trait
  • run integration tests
  • calculate new weights if needed

Copy link
Contributor

@ilionic ilionic left a 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

Copy link
Contributor

@Szegoo Szegoo left a 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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(
Copy link
Contributor

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.

Suggested change
fn calculate_and_finalize_purchase_and_fees(
fn finalize_purchase(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants