mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 16:11:05 +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:
@@ -263,7 +263,7 @@ pub mod pallet {
|
||||
T::CollectionId,
|
||||
Blake2_128Concat,
|
||||
T::ItemId,
|
||||
ItemMetadata<DepositBalanceOf<T, I>, T::StringLimit>,
|
||||
ItemMetadata<ItemMetadataDepositOf<T, I>, T::StringLimit>,
|
||||
OptionQuery,
|
||||
>;
|
||||
|
||||
@@ -559,6 +559,10 @@ pub mod pallet {
|
||||
UnknownItem,
|
||||
/// Swap doesn't exist.
|
||||
UnknownSwap,
|
||||
/// The given item has no metadata set.
|
||||
MetadataNotFound,
|
||||
/// The provided attribute can't be found.
|
||||
AttributeNotFound,
|
||||
/// Item is not for sale.
|
||||
NotForSale,
|
||||
/// The provided bid is too low.
|
||||
@@ -746,10 +750,9 @@ pub mod pallet {
|
||||
Self::do_mint(
|
||||
collection,
|
||||
item,
|
||||
caller.clone(),
|
||||
Some(caller.clone()),
|
||||
mint_to.clone(),
|
||||
item_config,
|
||||
false,
|
||||
|collection_details, collection_config| {
|
||||
// Issuer can mint regardless of mint settings
|
||||
if Self::has_role(&collection, &caller, CollectionRole::Issuer) {
|
||||
@@ -849,9 +852,7 @@ pub mod pallet {
|
||||
Error::<T, I>::NoPermission
|
||||
);
|
||||
}
|
||||
Self::do_mint(collection, item, mint_to.clone(), mint_to, item_config, true, |_, _| {
|
||||
Ok(())
|
||||
})
|
||||
Self::do_mint(collection, item, None, mint_to, item_config, |_, _| Ok(()))
|
||||
}
|
||||
|
||||
/// Destroy a single item.
|
||||
@@ -1362,7 +1363,7 @@ pub mod pallet {
|
||||
/// Clear an attribute for a collection or item.
|
||||
///
|
||||
/// Origin must be either `ForceOrigin` or Signed and the sender should be the Owner of the
|
||||
/// `collection`.
|
||||
/// attribute.
|
||||
///
|
||||
/// Any deposit is freed for the collection's owner.
|
||||
///
|
||||
@@ -1464,7 +1465,7 @@ pub mod pallet {
|
||||
let maybe_check_owner = T::ForceOrigin::try_origin(origin)
|
||||
.map(|_| None)
|
||||
.or_else(|origin| ensure_signed(origin).map(Some).map_err(DispatchError::from))?;
|
||||
Self::do_set_item_metadata(maybe_check_owner, collection, item, data)
|
||||
Self::do_set_item_metadata(maybe_check_owner, collection, item, data, None)
|
||||
}
|
||||
|
||||
/// Clear the metadata for an item.
|
||||
|
||||
Reference in New Issue
Block a user