-
Notifications
You must be signed in to change notification settings - Fork 1
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 #27
Conversation
…FT can be sold in marketplace
@@ -569,6 +569,9 @@ impl<T: Config> | |||
nft_id: T::ItemId, | |||
budget: &dyn Budget, | |||
) -> DispatchResultWithPostInfo { | |||
// Check Lock to prevent locked NFTs from being burned. Owner must unlock the NFT before | |||
// burning. | |||
ensure!(!Pallet::<T>::is_locked(collection_id, nft_id), pallet_uniques::Error::<T>::Locked); |
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.
Nice design here! Can we add a collection-level lock?
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.
We can do this with the pallet_uniques
function.
/// Disallow further unprivileged transfers for a whole collection.
///
/// Origin must be Signed and the sender should be the Freezer of the `collection`.
///
/// - `collection`: The collection to be frozen.
///
/// Emits `CollectionFrozen`.
///
/// Weight: `O(1)`
#[pallet::call_index(9)]
#[pallet::weight(T::WeightInfo::freeze_collection())]
pub fn freeze_collection(
origin: OriginFor<T>,
collection: T::CollectionId,
) -> DispatchResult {
let origin = ensure_signed(origin)?;
Collection::<T, I>::try_mutate(collection, |maybe_details| {
let details = maybe_details.as_mut().ok_or(Error::<T, I>::UnknownCollection)?;
ensure!(origin == details.freezer, Error::<T, I>::NoPermission);
details.is_frozen = true;
Self::deposit_event(Event::<T, I>::CollectionFrozen { collection });
Ok(())
})
}
@jasl let me know if good to merge. Then can update the cargo in Phala-Network/khala-parachain#254 |
MERGED! |
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