mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 13:57:58 +00:00
[NFTs] Track item's metadata depositor (#13124)
* Refactor do_mint() * Track the depositor of item's metadata * Revert back the access control * On collection destroy return the metadata deposit * Clear the metadata on item burn returning the deposit * Address comments * Fix clippy * Don't return Ok on non-existing attribute removal
This commit is contained in:
@@ -82,12 +82,13 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
Account::<T, I>::remove((&details.owner, &collection, &item));
|
||||
T::Currency::unreserve(&details.deposit.account, details.deposit.amount);
|
||||
}
|
||||
#[allow(deprecated)]
|
||||
ItemMetadataOf::<T, I>::remove_prefix(&collection, None);
|
||||
#[allow(deprecated)]
|
||||
ItemPriceOf::<T, I>::remove_prefix(&collection, None);
|
||||
#[allow(deprecated)]
|
||||
PendingSwapOf::<T, I>::remove_prefix(&collection, None);
|
||||
for (_, metadata) in ItemMetadataOf::<T, I>::drain_prefix(&collection) {
|
||||
if let Some(depositor) = metadata.deposit.account {
|
||||
T::Currency::unreserve(&depositor, metadata.deposit.amount);
|
||||
}
|
||||
}
|
||||
let _ = ItemPriceOf::<T, I>::clear_prefix(&collection, witness.items, None);
|
||||
let _ = PendingSwapOf::<T, I>::clear_prefix(&collection, witness.items, None);
|
||||
CollectionMetadataOf::<T, I>::remove(&collection);
|
||||
Self::clear_roles(&collection)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user