diff --git a/frame/nfts/src/benchmarking.rs b/frame/nfts/src/benchmarking.rs index ae628fbefcce6..d4bbd809ce8be 100644 --- a/frame/nfts/src/benchmarking.rs +++ b/frame/nfts/src/benchmarking.rs @@ -72,6 +72,40 @@ fn add_collection_metadata, I: 'static>() -> (T::AccountId, Account fn mint_item, I: 'static>( index: u16, +) -> (T::ItemId, T::AccountId, AccountIdLookupOf) { + let item = T::Helper::item(index); + let collection = T::Helper::collection(0); + let caller = Collection::::get(collection).unwrap().owner; + if caller != whitelisted_caller() { + whitelist_account!(caller); + } + let caller_lookup = T::Lookup::unlookup(caller.clone()); + let item_exists = Item::::contains_key(&collection, &item); + let item_config = ItemConfigOf::::get(&collection, &item); + if item_exists { + return (item, caller, caller_lookup) + } else if let Some(item_config) = item_config { + assert_ok!(Nfts::::force_mint( + SystemOrigin::Signed(caller.clone()).into(), + collection, + item, + caller_lookup.clone(), + item_config, + )); + } else { + assert_ok!(Nfts::::mint( + SystemOrigin::Signed(caller.clone()).into(), + collection, + item, + caller_lookup.clone(), + None, + )); + } + (item, caller, caller_lookup) +} + +fn lock_item, I: 'static>( + index: u16, ) -> (T::ItemId, T::AccountId, AccountIdLookupOf) { let caller = Collection::::get(T::Helper::collection(0)).unwrap().owner; if caller != whitelisted_caller() { @@ -79,12 +113,27 @@ fn mint_item, I: 'static>( } let caller_lookup = T::Lookup::unlookup(caller.clone()); let item = T::Helper::item(index); - assert_ok!(Nfts::::mint( + assert_ok!(Nfts::::lock_item_transfer( + SystemOrigin::Signed(caller.clone()).into(), + T::Helper::collection(0), + item, + )); + (item, caller, caller_lookup) +} + +fn burn_item, I: 'static>( + index: u16, +) -> (T::ItemId, T::AccountId, AccountIdLookupOf) { + let caller = Collection::::get(T::Helper::collection(0)).unwrap().owner; + if caller != whitelisted_caller() { + whitelist_account!(caller); + } + let caller_lookup = T::Lookup::unlookup(caller.clone()); + let item = T::Helper::item(index); + assert_ok!(Nfts::::burn( SystemOrigin::Signed(caller.clone()).into(), T::Helper::collection(0), item, - caller_lookup.clone(), - None, )); (item, caller, caller_lookup) } @@ -126,6 +175,26 @@ fn add_item_attribute, I: 'static>( (key, caller, caller_lookup) } +fn add_collection_attribute, I: 'static>( + i: u16, +) -> (BoundedVec, T::AccountId, AccountIdLookupOf) { + let caller = Collection::::get(T::Helper::collection(0)).unwrap().owner; + if caller != whitelisted_caller() { + whitelist_account!(caller); + } + let caller_lookup = T::Lookup::unlookup(caller.clone()); + let key: BoundedVec<_, _> = make_filled_vec(i, T::KeyLimit::get() as usize).try_into().unwrap(); + assert_ok!(Nfts::::set_attribute( + SystemOrigin::Signed(caller.clone()).into(), + T::Helper::collection(0), + None, + AttributeNamespace::CollectionOwner, + key.clone(), + vec![0; T::ValueLimit::get() as usize].try_into().unwrap(), + )); + (key, caller, caller_lookup) +} + fn assert_last_event, I: 'static>(generic_event: >::RuntimeEvent) { let events = frame_system::Pallet::::events(); let system_event: ::RuntimeEvent = generic_event.into(); @@ -190,26 +259,25 @@ benchmarks_instance_pallet! { } destroy { - let n in 0 .. 1_000; let m in 0 .. 1_000; + let c in 0 .. 1_000; let a in 0 .. 1_000; let (collection, caller, _) = create_collection::(); add_collection_metadata::(); - for i in 0..n { - mint_item::(i as u16); - } for i in 0..m { - if !Item::::contains_key(collection, T::Helper::item(i as u16)) { - mint_item::(i as u16); - } + mint_item::(i as u16); add_item_metadata::(T::Helper::item(i as u16)); + lock_item::(i as u16); + burn_item::(i as u16); + } + for i in 0..c { + mint_item::(i as u16); + lock_item::(i as u16); + burn_item::(i as u16); } for i in 0..a { - if !Item::::contains_key(collection, T::Helper::item(i as u16)) { - mint_item::(i as u16); - } - add_item_attribute::(T::Helper::item(i as u16)); + add_collection_attribute::(i as u16); } let witness = Collection::::get(collection).unwrap().destroy_witness(); }: _(SystemOrigin::Signed(caller), collection, witness) @@ -234,9 +302,9 @@ benchmarks_instance_pallet! { } burn { - let (collection, caller, caller_lookup) = create_collection::(); + let (collection, caller, _) = create_collection::(); let (item, ..) = mint_item::(0); - }: _(SystemOrigin::Signed(caller.clone()), collection, item, Some(caller_lookup)) + }: _(SystemOrigin::Signed(caller.clone()), collection, item) verify { assert_last_event::(Event::Burned { collection, item, owner: caller }.into()); } diff --git a/frame/nfts/src/features/approvals.rs b/frame/nfts/src/features/approvals.rs index 408c441290fb4..634436a8562d8 100644 --- a/frame/nfts/src/features/approvals.rs +++ b/frame/nfts/src/features/approvals.rs @@ -40,9 +40,7 @@ impl, I: 'static> Pallet { ); if let Some(check_origin) = maybe_check_origin { - let is_admin = Self::has_role(&collection, &check_origin, CollectionRole::Admin); - let permitted = is_admin || check_origin == details.owner; - ensure!(permitted, Error::::NoPermission); + ensure!(check_origin == details.owner, Error::::NoPermission); } let now = frame_system::Pallet::::block_number(); @@ -85,9 +83,7 @@ impl, I: 'static> Pallet { if !is_past_deadline { if let Some(check_origin) = maybe_check_origin { - let is_admin = Self::has_role(&collection, &check_origin, CollectionRole::Admin); - let permitted = is_admin || check_origin == details.owner; - ensure!(permitted, Error::::NoPermission); + ensure!(check_origin == details.owner, Error::::NoPermission); } } @@ -113,9 +109,7 @@ impl, I: 'static> Pallet { Item::::get(&collection, &item).ok_or(Error::::UnknownCollection)?; if let Some(check_origin) = maybe_check_origin { - let is_admin = Self::has_role(&collection, &check_origin, CollectionRole::Admin); - let permitted = is_admin || check_origin == details.owner; - ensure!(permitted, Error::::NoPermission); + ensure!(check_origin == details.owner, Error::::NoPermission); } details.approvals.clear(); diff --git a/frame/nfts/src/features/attributes.rs b/frame/nfts/src/features/attributes.rs index fbd1c93247a52..9098679fa9145 100644 --- a/frame/nfts/src/features/attributes.rs +++ b/frame/nfts/src/features/attributes.rs @@ -33,17 +33,8 @@ impl, I: 'static> Pallet { Error::::MethodDisabled ); - let mut collection_details = - Collection::::get(&collection).ok_or(Error::::UnknownCollection)?; - ensure!( - Self::is_valid_namespace( - &origin, - &namespace, - &collection, - &collection_details.owner, - &maybe_item, - )?, + Self::is_valid_namespace(&origin, &namespace, &collection, &maybe_item)?, Error::::NoPermission ); @@ -66,6 +57,9 @@ impl, I: 'static> Pallet { _ => (), } + let mut collection_details = + Collection::::get(&collection).ok_or(Error::::UnknownCollection)?; + let attribute = Attribute::::get((collection, maybe_item, &namespace, &key)); let attribute_exists = attribute.is_some(); if !attribute_exists { @@ -219,7 +213,7 @@ impl, I: 'static> Pallet { } pub(crate) fn do_clear_attribute( - maybe_check_owner: Option, + maybe_check_origin: Option, collection: T::CollectionId, maybe_item: Option, namespace: AttributeNamespace, @@ -227,21 +221,13 @@ impl, I: 'static> Pallet { ) -> DispatchResult { let (_, deposit) = Attribute::::take((collection, maybe_item, &namespace, &key)) .ok_or(Error::::AttributeNotFound)?; - let mut collection_details = - Collection::::get(&collection).ok_or(Error::::UnknownCollection)?; - if let Some(check_owner) = &maybe_check_owner { + if let Some(check_origin) = &maybe_check_origin { // validate the provided namespace when it's not a root call and the caller is not // the same as the `deposit.account` (e.g. the deposit was paid by different account) - if deposit.account != maybe_check_owner { + if deposit.account != maybe_check_origin { ensure!( - Self::is_valid_namespace( - &check_owner, - &namespace, - &collection, - &collection_details.owner, - &maybe_item, - )?, + Self::is_valid_namespace(&check_origin, &namespace, &collection, &maybe_item)?, Error::::NoPermission ); } @@ -264,17 +250,15 @@ impl, I: 'static> Pallet { .map_or(None, |c| { Some(c.has_disabled_setting(ItemSetting::UnlockedAttributes)) }); - match maybe_is_locked { - Some(is_locked) => { - // when item exists, then only the collection's owner can clear that - // attribute - ensure!( - check_owner == &collection_details.owner, - Error::::NoPermission - ); - ensure!(!is_locked, Error::::LockedItemAttributes); - }, - None => (), + if let Some(is_locked) = maybe_is_locked { + ensure!(!is_locked, Error::::LockedItemAttributes); + // Only the collection's admin can clear attributes in that namespace. + // e.g. in off-chain mints, the attribute's depositor will be the item's + // owner, that's why we need to do this extra check. + ensure!( + Self::has_role(&collection, &check_origin, CollectionRole::Admin), + Error::::NoPermission + ); } }, }, @@ -282,6 +266,9 @@ impl, I: 'static> Pallet { }; } + let mut collection_details = + Collection::::get(&collection).ok_or(Error::::UnknownCollection)?; + collection_details.attributes.saturating_dec(); match deposit.account { @@ -372,12 +359,12 @@ impl, I: 'static> Pallet { origin: &T::AccountId, namespace: &AttributeNamespace, collection: &T::CollectionId, - collection_owner: &T::AccountId, maybe_item: &Option, ) -> Result { let mut result = false; match namespace { - AttributeNamespace::CollectionOwner => result = origin == collection_owner, + AttributeNamespace::CollectionOwner => + result = Self::has_role(&collection, &origin, CollectionRole::Admin), AttributeNamespace::ItemOwner => if let Some(item) = maybe_item { let item_details = diff --git a/frame/nfts/src/features/create_delete_collection.rs b/frame/nfts/src/features/create_delete_collection.rs index 8187fff7fca77..e9434760628ec 100644 --- a/frame/nfts/src/features/create_delete_collection.rs +++ b/frame/nfts/src/features/create_delete_collection.rs @@ -38,6 +38,7 @@ impl, I: 'static> Pallet { owner_deposit: deposit, items: 0, item_metadatas: 0, + item_configs: 0, attributes: 0, }, ); @@ -71,24 +72,23 @@ impl, I: 'static> Pallet { if let Some(check_owner) = maybe_check_owner { ensure!(collection_details.owner == check_owner, Error::::NoPermission); } - ensure!(collection_details.items == witness.items, Error::::BadWitness); + ensure!(collection_details.items == 0, Error::::CollectionNotEmpty); + ensure!(collection_details.attributes == witness.attributes, Error::::BadWitness); ensure!( collection_details.item_metadatas == witness.item_metadatas, Error::::BadWitness ); - ensure!(collection_details.attributes == witness.attributes, Error::::BadWitness); + ensure!( + collection_details.item_configs == witness.item_configs, + Error::::BadWitness + ); - for (item, details) in Item::::drain_prefix(&collection) { - Account::::remove((&details.owner, &collection, &item)); - T::Currency::unreserve(&details.deposit.account, details.deposit.amount); - } for (_, metadata) in ItemMetadataOf::::drain_prefix(&collection) { if let Some(depositor) = metadata.deposit.account { T::Currency::unreserve(&depositor, metadata.deposit.amount); } } - let _ = ItemPriceOf::::clear_prefix(&collection, witness.items, None); - let _ = PendingSwapOf::::clear_prefix(&collection, witness.items, None); + CollectionMetadataOf::::remove(&collection); Self::clear_roles(&collection)?; @@ -103,15 +103,13 @@ impl, I: 'static> Pallet { CollectionAccount::::remove(&collection_details.owner, &collection); T::Currency::unreserve(&collection_details.owner, collection_details.owner_deposit); CollectionConfigOf::::remove(&collection); - let _ = ItemConfigOf::::clear_prefix(&collection, witness.items, None); - let _ = - ItemAttributesApprovalsOf::::clear_prefix(&collection, witness.items, None); + let _ = ItemConfigOf::::clear_prefix(&collection, witness.item_configs, None); Self::deposit_event(Event::Destroyed { collection }); Ok(DestroyWitness { - items: collection_details.items, item_metadatas: collection_details.item_metadatas, + item_configs: collection_details.item_configs, attributes: collection_details.attributes, }) }) diff --git a/frame/nfts/src/features/create_delete_item.rs b/frame/nfts/src/features/create_delete_item.rs index 0319f2c8a0f18..cd96d28448055 100644 --- a/frame/nfts/src/features/create_delete_item.rs +++ b/frame/nfts/src/features/create_delete_item.rs @@ -66,6 +66,7 @@ impl, I: 'static> Pallet { ensure!(existing_config == item_config, Error::::InconsistentItemConfig); } else { ItemConfigOf::::insert(&collection, &item, item_config); + collection_details.item_configs.saturating_inc(); } T::Currency::reserve(&deposit_account, deposit_amount)?; @@ -107,7 +108,11 @@ impl, I: 'static> Pallet { let collection_details = Collection::::get(&collection).ok_or(Error::::UnknownCollection)?; - ensure!(collection_details.owner == signer, Error::::NoPermission); + + ensure!( + Self::has_role(&collection, &signer, CollectionRole::Issuer), + Error::::NoPermission + ); let item_config = ItemConfig { settings: Self::get_default_item_settings(&collection)? }; Self::do_mint( @@ -118,9 +123,11 @@ impl, I: 'static> Pallet { item_config, |_, _| Ok(()), )?; + let origin = Self::find_account_by_role(&collection, CollectionRole::Admin) + .unwrap_or(collection_details.owner.clone()); for (key, value) in attributes { Self::do_set_attribute( - collection_details.owner.clone(), + origin.clone(), collection, Some(item), AttributeNamespace::CollectionOwner, @@ -131,7 +138,7 @@ impl, I: 'static> Pallet { } if !metadata.len().is_zero() { Self::do_set_item_metadata( - Some(collection_details.owner.clone()), + Some(origin.clone()), collection, item, metadata, @@ -148,6 +155,9 @@ impl, I: 'static> Pallet { ) -> DispatchResult { ensure!(!T::Locker::is_locked(collection, item), Error::::ItemLocked); let item_config = Self::get_item_config(&collection, &item)?; + // NOTE: if item's settings are not empty (e.g. item's metadata is locked) + // then we keep the config record and don't remove it + let remove_config = !item_config.has_disabled_settings(); let owner = Collection::::try_mutate( &collection, |maybe_collection_details| -> Result { @@ -161,6 +171,10 @@ impl, I: 'static> Pallet { T::Currency::unreserve(&details.deposit.account, details.deposit.amount); collection_details.items.saturating_dec(); + if remove_config { + collection_details.item_configs.saturating_dec(); + } + // Clear the metadata if it's not locked. if item_config.is_setting_enabled(ItemSetting::UnlockedMetadata) { if let Some(metadata) = ItemMetadataOf::::take(&collection, &item) { @@ -188,9 +202,7 @@ impl, I: 'static> Pallet { PendingSwapOf::::remove(&collection, &item); ItemAttributesApprovalsOf::::remove(&collection, &item); - // NOTE: if item's settings are not empty (e.g. item's metadata is locked) - // then we keep the record and don't remove it - if !item_config.has_disabled_settings() { + if remove_config { ItemConfigOf::::remove(&collection, &item); } diff --git a/frame/nfts/src/features/lock.rs b/frame/nfts/src/features/lock.rs index c28fdda983774..8b4914baeb450 100644 --- a/frame/nfts/src/features/lock.rs +++ b/frame/nfts/src/features/lock.rs @@ -24,10 +24,7 @@ impl, I: 'static> Pallet { collection: T::CollectionId, lock_settings: CollectionSettings, ) -> DispatchResult { - ensure!( - Self::has_role(&collection, &origin, CollectionRole::Freezer), - Error::::NoPermission - ); + ensure!(Self::collection_owner(collection) == Some(origin), Error::::NoPermission); ensure!( !lock_settings.is_disabled(CollectionSetting::DepositRequired), Error::::WrongSetting @@ -85,17 +82,17 @@ impl, I: 'static> Pallet { } pub(crate) fn do_lock_item_properties( - maybe_check_owner: Option, + maybe_check_origin: Option, collection: T::CollectionId, item: T::ItemId, lock_metadata: bool, lock_attributes: bool, ) -> DispatchResult { - let collection_details = - Collection::::get(&collection).ok_or(Error::::UnknownCollection)?; - - if let Some(check_owner) = &maybe_check_owner { - ensure!(check_owner == &collection_details.owner, Error::::NoPermission); + if let Some(check_origin) = &maybe_check_origin { + ensure!( + Self::has_role(&collection, &check_origin, CollectionRole::Admin), + Error::::NoPermission + ); } ItemConfigOf::::try_mutate(collection, item, |maybe_config| { diff --git a/frame/nfts/src/features/metadata.rs b/frame/nfts/src/features/metadata.rs index 232262bdbb8fc..fde0296784d11 100644 --- a/frame/nfts/src/features/metadata.rs +++ b/frame/nfts/src/features/metadata.rs @@ -21,13 +21,20 @@ use frame_support::pallet_prelude::*; impl, I: 'static> Pallet { /// Note: if `maybe_depositor` is None, that means the depositor will be a collection's owner pub(crate) fn do_set_item_metadata( - maybe_check_owner: Option, + maybe_check_origin: Option, collection: T::CollectionId, item: T::ItemId, data: BoundedVec, maybe_depositor: Option, ) -> DispatchResult { - let is_root = maybe_check_owner.is_none(); + if let Some(check_origin) = &maybe_check_origin { + ensure!( + Self::has_role(&collection, &check_origin, CollectionRole::Admin), + Error::::NoPermission + ); + } + + let is_root = maybe_check_origin.is_none(); let mut collection_details = Collection::::get(&collection).ok_or(Error::::UnknownCollection)?; @@ -37,10 +44,6 @@ impl, I: 'static> Pallet { Error::::LockedItemMetadata ); - if let Some(check_owner) = &maybe_check_owner { - ensure!(check_owner == &collection_details.owner, Error::::NoPermission); - } - let collection_config = Self::get_collection_config(&collection)?; ItemMetadataOf::::try_mutate_exists(collection, item, |metadata| { @@ -89,22 +92,26 @@ impl, I: 'static> Pallet { } pub(crate) fn do_clear_item_metadata( - maybe_check_owner: Option, + maybe_check_origin: Option, collection: T::CollectionId, item: T::ItemId, ) -> DispatchResult { - let is_root = maybe_check_owner.is_none(); + if let Some(check_origin) = &maybe_check_origin { + ensure!( + Self::has_role(&collection, &check_origin, CollectionRole::Admin), + Error::::NoPermission + ); + } + + let is_root = maybe_check_origin.is_none(); let metadata = ItemMetadataOf::::take(collection, item) .ok_or(Error::::MetadataNotFound)?; let mut collection_details = Collection::::get(&collection).ok_or(Error::::UnknownCollection)?; + let depositor_account = metadata.deposit.account.unwrap_or(collection_details.owner.clone()); - if let Some(check_owner) = &maybe_check_owner { - ensure!(check_owner == &collection_details.owner, Error::::NoPermission); - } - // NOTE: if the item was previously burned, the ItemConfigOf record might not exist let is_locked = Self::get_item_config(&collection, &item) .map_or(false, |c| c.has_disabled_setting(ItemSetting::UnlockedMetadata)); @@ -125,29 +132,32 @@ impl, I: 'static> Pallet { } pub(crate) fn do_set_collection_metadata( - maybe_check_owner: Option, + maybe_check_origin: Option, collection: T::CollectionId, data: BoundedVec, ) -> DispatchResult { + if let Some(check_origin) = &maybe_check_origin { + ensure!( + Self::has_role(&collection, &check_origin, CollectionRole::Admin), + Error::::NoPermission + ); + } + + let is_root = maybe_check_origin.is_none(); let collection_config = Self::get_collection_config(&collection)?; ensure!( - maybe_check_owner.is_none() || - collection_config.is_setting_enabled(CollectionSetting::UnlockedMetadata), + is_root || collection_config.is_setting_enabled(CollectionSetting::UnlockedMetadata), Error::::LockedCollectionMetadata ); let mut details = Collection::::get(&collection).ok_or(Error::::UnknownCollection)?; - if let Some(check_owner) = &maybe_check_owner { - ensure!(check_owner == &details.owner, Error::::NoPermission); - } CollectionMetadataOf::::try_mutate_exists(collection, |metadata| { let old_deposit = metadata.take().map_or(Zero::zero(), |m| m.deposit); details.owner_deposit.saturating_reduce(old_deposit); let mut deposit = Zero::zero(); - if maybe_check_owner.is_some() && - collection_config.is_setting_enabled(CollectionSetting::DepositRequired) + if !is_root && collection_config.is_setting_enabled(CollectionSetting::DepositRequired) { deposit = T::DepositPerByte::get() .saturating_mul(((data.len()) as u32).into()) @@ -170,18 +180,22 @@ impl, I: 'static> Pallet { } pub(crate) fn do_clear_collection_metadata( - maybe_check_owner: Option, + maybe_check_origin: Option, collection: T::CollectionId, ) -> DispatchResult { - let details = - Collection::::get(&collection).ok_or(Error::::UnknownCollection)?; - if let Some(check_owner) = &maybe_check_owner { - ensure!(check_owner == &details.owner, Error::::NoPermission); + if let Some(check_origin) = &maybe_check_origin { + ensure!( + Self::has_role(&collection, &check_origin, CollectionRole::Admin), + Error::::NoPermission + ); } + let details = + Collection::::get(&collection).ok_or(Error::::UnknownCollection)?; let collection_config = Self::get_collection_config(&collection)?; + ensure!( - maybe_check_owner.is_none() || + maybe_check_origin.is_none() || collection_config.is_setting_enabled(CollectionSetting::UnlockedMetadata), Error::::LockedCollectionMetadata ); diff --git a/frame/nfts/src/features/roles.rs b/frame/nfts/src/features/roles.rs index f3fa277b15617..f91f3ecb6f348 100644 --- a/frame/nfts/src/features/roles.rs +++ b/frame/nfts/src/features/roles.rs @@ -82,6 +82,21 @@ impl, I: 'static> Pallet { .map_or(false, |roles| roles.has_role(role)) } + /// Finds the account by a provided role within a collection. + /// + /// - `collection_id`: A collection to check the role in. + /// - `role`: A role to find the account for. + /// + /// Returns `Some(T::AccountId)` if the record was found, `None` otherwise. + pub(crate) fn find_account_by_role( + collection_id: &T::CollectionId, + role: CollectionRole, + ) -> Option { + CollectionRoleOf::::iter_prefix(&collection_id).into_iter().find_map( + |(account, roles)| if roles.has_role(role) { Some(account.clone()) } else { None }, + ) + } + /// Groups provided roles by account, given one account could have multiple roles. /// /// - `input`: A vector of (Account, Role) tuples. diff --git a/frame/nfts/src/features/settings.rs b/frame/nfts/src/features/settings.rs index 91bff9dc683f8..080d7b97f13b1 100644 --- a/frame/nfts/src/features/settings.rs +++ b/frame/nfts/src/features/settings.rs @@ -57,7 +57,7 @@ impl, I: 'static> Pallet { } pub(crate) fn do_update_mint_settings( - maybe_check_owner: Option, + maybe_check_origin: Option, collection: T::CollectionId, mint_settings: MintSettings< BalanceOf, @@ -65,10 +65,11 @@ impl, I: 'static> Pallet { T::CollectionId, >, ) -> DispatchResult { - let details = - Collection::::get(&collection).ok_or(Error::::UnknownCollection)?; - if let Some(check_owner) = &maybe_check_owner { - ensure!(check_owner == &details.owner, Error::::NoPermission); + if let Some(check_origin) = &maybe_check_origin { + ensure!( + Self::has_role(&collection, &check_origin, CollectionRole::Issuer), + Error::::NoPermission + ); } CollectionConfigOf::::try_mutate(collection, |maybe_config| { diff --git a/frame/nfts/src/features/transfer.rs b/frame/nfts/src/features/transfer.rs index 998df81cd1fe1..00b5d4e76882a 100644 --- a/frame/nfts/src/features/transfer.rs +++ b/frame/nfts/src/features/transfer.rs @@ -48,16 +48,6 @@ impl, I: 'static> Pallet { Item::::get(&collection, &item).ok_or(Error::::UnknownItem)?; with_details(&collection_details, &mut details)?; - if details.deposit.account == details.owner { - // Move the deposit to the new owner. - T::Currency::repatriate_reserved( - &details.owner, - &dest, - details.deposit.amount, - Reserved, - )?; - } - Account::::remove((&details.owner, &collection, &item)); Account::::insert((&dest, &collection, &item), ()); let origin = details.owner; diff --git a/frame/nfts/src/lib.rs b/frame/nfts/src/lib.rs index 2d19cf0455ad4..4d9547659a2a7 100644 --- a/frame/nfts/src/lib.rs +++ b/frame/nfts/src/lib.rs @@ -30,6 +30,7 @@ #[cfg(feature = "runtime-benchmarks")] mod benchmarking; +pub mod migration; #[cfg(test)] pub mod mock; #[cfg(test)] @@ -58,6 +59,9 @@ pub use pallet::*; pub use types::*; pub use weights::WeightInfo; +/// The log target of this pallet. +pub const LOG_TARGET: &'static str = "runtime::nfts"; + type AccountIdLookupOf = <::Lookup as StaticLookup>::Source; #[frame_support::pallet] @@ -67,9 +71,13 @@ pub mod pallet { use frame_system::pallet_prelude::*; use sp_runtime::traits::{IdentifyAccount, Verify}; + /// The current storage version. + const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + #[pallet::pallet] #[pallet::generate_store(pub(super) trait Store)] - pub struct Pallet(_); + #[pallet::storage_version(STORAGE_VERSION)] + pub struct Pallet(PhantomData<(T, I)>); #[cfg(feature = "runtime-benchmarks")] pub trait BenchmarkHelper { @@ -628,6 +636,8 @@ pub mod pallet { MaxAttributesLimitReached, /// The provided namespace isn't supported in this call. WrongNamespace, + /// Can't delete non-empty collections. + CollectionNotEmpty, } #[pallet::call] @@ -719,20 +729,22 @@ pub mod pallet { /// The origin must conform to `ForceOrigin` or must be `Signed` and the sender must be the /// owner of the `collection`. /// + /// NOTE: The collection must have 0 items to be destroyed. + /// /// - `collection`: The identifier of the collection to be destroyed. /// - `witness`: Information on the items minted in the collection. This must be /// correct. /// /// Emits `Destroyed` event when successful. /// - /// Weight: `O(n + m)` where: - /// - `n = witness.items` + /// Weight: `O(m + c + a)` where: /// - `m = witness.item_metadatas` + /// - `c = witness.item_configs` /// - `a = witness.attributes` #[pallet::call_index(2)] #[pallet::weight(T::WeightInfo::destroy( - witness.items, - witness.item_metadatas, + witness.item_metadatas, + witness.item_configs, witness.attributes, ))] pub fn destroy( @@ -746,8 +758,8 @@ pub mod pallet { let details = Self::do_destroy_collection(collection, witness, maybe_check_owner)?; Ok(Some(T::WeightInfo::destroy( - details.items, details.item_metadatas, + details.item_configs, details.attributes, )) .into()) @@ -755,7 +767,7 @@ pub mod pallet { /// Mint an item of a particular collection. /// - /// The origin must be Signed and the sender must be the Issuer of the `collection`. + /// The origin must be Signed and the sender must comply with the `mint_settings` rules. /// /// - `collection`: The collection of the item to be minted. /// - `item`: An identifier of the new item. @@ -789,11 +801,6 @@ pub mod pallet { mint_to.clone(), item_config, |collection_details, collection_config| { - // Issuer can mint regardless of mint settings - if Self::has_role(&collection, &caller, CollectionRole::Issuer) { - return Ok(()) - } - let mint_settings = collection_config.mint_settings; let now = frame_system::Pallet::::block_number(); @@ -805,7 +812,12 @@ pub mod pallet { } match mint_settings.mint_type { - MintType::Issuer => return Err(Error::::NoPermission.into()), + MintType::Issuer => { + ensure!( + Self::has_role(&collection, &caller, CollectionRole::Issuer), + Error::::NoPermission + ); + }, MintType::HolderOf(collection_id) => { let MintWitness { owned_item } = witness_data.ok_or(Error::::BadWitness)?; @@ -899,38 +911,30 @@ pub mod pallet { /// Destroy a single item. /// - /// Origin must be Signed and the signing account must be either: - /// - the Admin of the `collection`; - /// - the Owner of the `item`; + /// The origin must conform to `ForceOrigin` or must be Signed and the signing account must + /// be the owner of the `item`. /// /// - `collection`: The collection of the item to be burned. /// - `item`: The item to be burned. - /// - `check_owner`: If `Some` then the operation will fail with `WrongOwner` unless the - /// item is owned by this value. /// - /// Emits `Burned` with the actual amount burned. + /// Emits `Burned`. /// /// Weight: `O(1)` - /// Modes: `check_owner.is_some()`. #[pallet::call_index(5)] #[pallet::weight(T::WeightInfo::burn())] pub fn burn( origin: OriginFor, collection: T::CollectionId, item: T::ItemId, - check_owner: Option>, ) -> DispatchResult { - let origin = ensure_signed(origin)?; - let check_owner = check_owner.map(T::Lookup::lookup).transpose()?; + let maybe_check_origin = T::ForceOrigin::try_origin(origin) + .map(|_| None) + .or_else(|origin| ensure_signed(origin).map(Some).map_err(DispatchError::from))?; Self::do_burn(collection, item, |details| { - let is_admin = Self::has_role(&collection, &origin, CollectionRole::Admin); - let is_permitted = is_admin || details.owner == origin; - ensure!(is_permitted, Error::::NoPermission); - ensure!( - check_owner.map_or(true, |o| o == details.owner), - Error::::WrongOwner - ); + if let Some(check_origin) = maybe_check_origin { + ensure!(details.owner == check_origin, Error::::NoPermission); + } Ok(()) }) } @@ -938,7 +942,6 @@ pub mod pallet { /// Move an item from the sender account to another. /// /// Origin must be Signed and the signing account must be either: - /// - the Admin of the `collection`; /// - the Owner of the `item`; /// - the approved delegate for the `item` (in this case, the approval is reset). /// @@ -962,8 +965,7 @@ pub mod pallet { let dest = T::Lookup::lookup(dest)?; Self::do_transfer(collection, item, dest, |_, details| { - let is_admin = Self::has_role(&collection, &origin, CollectionRole::Admin); - if details.owner != origin && !is_admin { + if details.owner != origin { let deadline = details.approvals.get(&origin).ok_or(Error::::NoPermission)?; if let Some(d) = deadline { @@ -1086,12 +1088,13 @@ pub mod pallet { /// Disallows specified settings for the whole collection. /// - /// Origin must be Signed and the sender should be the Freezer of the `collection`. + /// Origin must be Signed and the sender should be the Owner of the `collection`. /// /// - `collection`: The collection to be locked. /// - `lock_settings`: The settings to be locked. /// /// Note: it's possible to only lock(set) the setting, but not to unset it. + /// /// Emits `CollectionLocked`. /// /// Weight: `O(1)` @@ -1243,7 +1246,6 @@ pub mod pallet { /// /// Origin must be either: /// - the `Force` origin; - /// - `Signed` with the signer being the Admin of the `collection`; /// - `Signed` with the signer being the Owner of the `item`; /// /// Arguments: @@ -1273,7 +1275,6 @@ pub mod pallet { /// /// Origin must be either: /// - the `Force` origin; - /// - `Signed` with the signer being the Admin of the `collection`; /// - `Signed` with the signer being the Owner of the `item`; /// /// Arguments: @@ -1298,8 +1299,8 @@ pub mod pallet { /// Disallows changing the metadata or attributes of the item. /// - /// Origin must be either `ForceOrigin` or Signed and the sender should be the Owner of the - /// `collection`. + /// Origin must be either `ForceOrigin` or Signed and the sender should be the Admin + /// of the `collection`. /// /// - `collection`: The collection if the `item`. /// - `item`: An item to be locked. @@ -1307,8 +1308,8 @@ pub mod pallet { /// - `lock_attributes`: Specifies whether the attributes in the `CollectionOwner` namespace /// should be locked. /// - /// Note: `lock_attributes` affects the attributes in the `CollectionOwner` namespace - /// only. When the metadata or attributes are locked, it won't be possible the unlock them. + /// Note: `lock_attributes` affects the attributes in the `CollectionOwner` namespace only. + /// When the metadata or attributes are locked, it won't be possible the unlock them. /// /// Emits `ItemPropertiesLocked`. /// @@ -1322,11 +1323,11 @@ pub mod pallet { lock_metadata: bool, lock_attributes: bool, ) -> DispatchResult { - let maybe_check_owner = T::ForceOrigin::try_origin(origin) + let maybe_check_origin = T::ForceOrigin::try_origin(origin) .map(|_| None) .or_else(|origin| ensure_signed(origin).map(Some).map_err(DispatchError::from))?; Self::do_lock_item_properties( - maybe_check_owner, + maybe_check_origin, collection, item, lock_metadata, @@ -1337,7 +1338,7 @@ pub mod pallet { /// Set an attribute for a collection or item. /// /// Origin must be Signed and must conform to the namespace ruleset: - /// - `CollectionOwner` namespace could be modified by the `collection` owner only; + /// - `CollectionOwner` namespace could be modified by the `collection` Admin only; /// - `ItemOwner` namespace could be modified by the `maybe_item` owner only. `maybe_item` /// should be set in that case; /// - `Account(AccountId)` namespace could be modified only when the `origin` was given a @@ -1367,15 +1368,12 @@ pub mod pallet { value: BoundedVec, ) -> DispatchResult { let origin = ensure_signed(origin)?; - Self::do_set_attribute( - origin.clone(), - collection, - maybe_item, - namespace, - key, - value, - origin, - ) + let depositor = match namespace { + AttributeNamespace::CollectionOwner => + Self::collection_owner(collection).ok_or(Error::::UnknownCollection)?, + _ => origin.clone(), + }; + Self::do_set_attribute(origin, collection, maybe_item, namespace, key, value, depositor) } /// Force-set an attribute for a collection or item. @@ -1490,7 +1488,7 @@ pub mod pallet { /// Set the metadata for an item. /// - /// Origin must be either `ForceOrigin` or Signed and the sender should be the Owner of the + /// Origin must be either `ForceOrigin` or Signed and the sender should be the Admin of the /// `collection`. /// /// If the origin is Signed, then funds of signer are reserved according to the formula: @@ -1512,15 +1510,15 @@ pub mod pallet { item: T::ItemId, data: BoundedVec, ) -> DispatchResult { - let maybe_check_owner = T::ForceOrigin::try_origin(origin) + let maybe_check_origin = 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, None) + Self::do_set_item_metadata(maybe_check_origin, collection, item, data, None) } /// Clear the metadata for an item. /// - /// Origin must be either `ForceOrigin` or Signed and the sender should be the Owner of the + /// Origin must be either `ForceOrigin` or Signed and the sender should be the Admin of the /// `collection`. /// /// Any deposit is freed for the collection's owner. @@ -1538,15 +1536,15 @@ pub mod pallet { collection: T::CollectionId, item: T::ItemId, ) -> DispatchResult { - let maybe_check_owner = T::ForceOrigin::try_origin(origin) + let maybe_check_origin = T::ForceOrigin::try_origin(origin) .map(|_| None) .or_else(|origin| ensure_signed(origin).map(Some).map_err(DispatchError::from))?; - Self::do_clear_item_metadata(maybe_check_owner, collection, item) + Self::do_clear_item_metadata(maybe_check_origin, collection, item) } /// Set the metadata for a collection. /// - /// Origin must be either `ForceOrigin` or `Signed` and the sender should be the Owner of + /// Origin must be either `ForceOrigin` or `Signed` and the sender should be the Admin of /// the `collection`. /// /// If the origin is `Signed`, then funds of signer are reserved according to the formula: @@ -1566,15 +1564,15 @@ pub mod pallet { collection: T::CollectionId, data: BoundedVec, ) -> DispatchResult { - let maybe_check_owner = T::ForceOrigin::try_origin(origin) + let maybe_check_origin = T::ForceOrigin::try_origin(origin) .map(|_| None) .or_else(|origin| ensure_signed(origin).map(Some).map_err(DispatchError::from))?; - Self::do_set_collection_metadata(maybe_check_owner, collection, data) + Self::do_set_collection_metadata(maybe_check_origin, collection, data) } /// Clear the metadata for a collection. /// - /// Origin must be either `ForceOrigin` or `Signed` and the sender should be the Owner of + /// Origin must be either `ForceOrigin` or `Signed` and the sender should be the Admin of /// the `collection`. /// /// Any deposit is freed for the collection's owner. @@ -1590,10 +1588,10 @@ pub mod pallet { origin: OriginFor, collection: T::CollectionId, ) -> DispatchResult { - let maybe_check_owner = T::ForceOrigin::try_origin(origin) + let maybe_check_origin = T::ForceOrigin::try_origin(origin) .map(|_| None) .or_else(|origin| ensure_signed(origin).map(Some).map_err(DispatchError::from))?; - Self::do_clear_collection_metadata(maybe_check_owner, collection) + Self::do_clear_collection_metadata(maybe_check_origin, collection) } /// Set (or reset) the acceptance of ownership for a particular account. @@ -1640,8 +1638,8 @@ pub mod pallet { /// Update mint settings. /// - /// Origin must be either `ForceOrigin` or `Signed` and the sender should be the Owner of - /// the `collection`. + /// Origin must be either `ForceOrigin` or `Signed` and the sender should be the Issuer + /// of the `collection`. /// /// - `collection`: The identifier of the collection to change. /// - `mint_settings`: The new mint settings. @@ -1658,15 +1656,15 @@ pub mod pallet { T::CollectionId, >, ) -> DispatchResult { - let maybe_check_owner = T::ForceOrigin::try_origin(origin) + let maybe_check_origin = T::ForceOrigin::try_origin(origin) .map(|_| None) .or_else(|origin| ensure_signed(origin).map(Some).map_err(DispatchError::from))?; - Self::do_update_mint_settings(maybe_check_owner, collection, mint_settings) + Self::do_update_mint_settings(maybe_check_origin, collection, mint_settings) } /// Set (or reset) the price for an item. /// - /// Origin must be Signed and must be the owner of the asset `item`. + /// Origin must be Signed and must be the owner of the `item`. /// /// - `collection`: The collection of the item. /// - `item`: The item to set the price for. @@ -1827,7 +1825,7 @@ pub mod pallet { /// its metadata, attributes, who can mint it (`None` for anyone) and until what block /// number. /// - `signature`: The signature of the `data` object. - /// - `signer`: The `data` object's signer. Should be an owner of the collection. + /// - `signer`: The `data` object's signer. Should be an Issuer of the collection. /// /// Emits `Issued` on success. /// Emits `AttributeSet` if the attributes were provided. @@ -1853,7 +1851,7 @@ pub mod pallet { /// - `data`: The pre-signed approval that consists of the information about the item, /// attributes to update and until what block number. /// - `signature`: The signature of the `data` object. - /// - `signer`: The `data` object's signer. Should be an owner of the collection for the + /// - `signer`: The `data` object's signer. Should be an Admin of the collection for the /// `CollectionOwner` namespace. /// /// Emits `AttributeSet` for each provided attribute. diff --git a/frame/nfts/src/migration.rs b/frame/nfts/src/migration.rs new file mode 100644 index 0000000000000..33ee87e4b9284 --- /dev/null +++ b/frame/nfts/src/migration.rs @@ -0,0 +1,117 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use super::*; +use frame_support::{log, traits::OnRuntimeUpgrade}; + +pub mod v1 { + use frame_support::{pallet_prelude::*, weights::Weight}; + + use super::*; + + #[derive(Decode)] + pub struct OldCollectionDetails { + pub owner: AccountId, + pub owner_deposit: DepositBalance, + pub items: u32, + pub item_metadatas: u32, + pub attributes: u32, + } + + impl OldCollectionDetails { + fn migrate_to_v1(self, item_configs: u32) -> CollectionDetails { + CollectionDetails { + owner: self.owner, + owner_deposit: self.owner_deposit, + items: self.items, + item_metadatas: self.item_metadatas, + item_configs, + attributes: self.attributes, + } + } + } + + pub struct MigrateToV1(sp_std::marker::PhantomData); + impl OnRuntimeUpgrade for MigrateToV1 { + fn on_runtime_upgrade() -> Weight { + let current_version = Pallet::::current_storage_version(); + let onchain_version = Pallet::::on_chain_storage_version(); + + log::info!( + target: LOG_TARGET, + "Running migration with current storage version {:?} / onchain {:?}", + current_version, + onchain_version + ); + + if onchain_version == 0 && current_version == 1 { + let mut translated = 0u64; + let mut configs_iterated = 0u64; + Collection::::translate::< + OldCollectionDetails>, + _, + >(|key, old_value| { + let item_configs = ItemConfigOf::::iter_prefix(&key).count() as u32; + configs_iterated += item_configs as u64; + translated.saturating_inc(); + Some(old_value.migrate_to_v1(item_configs)) + }); + + current_version.put::>(); + + log::info!( + target: LOG_TARGET, + "Upgraded {} records, storage to version {:?}", + translated, + current_version + ); + T::DbWeight::get().reads_writes(translated + configs_iterated + 1, translated + 1) + } else { + log::info!( + target: LOG_TARGET, + "Migration did not execute. This probably should be removed" + ); + T::DbWeight::get().reads(1) + } + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, &'static str> { + let current_version = Pallet::::current_storage_version(); + let onchain_version = Pallet::::on_chain_storage_version(); + ensure!(onchain_version == 0 && current_version == 1, "migration from version 0 to 1."); + let prev_count = Collection::::iter().count(); + Ok((prev_count as u32).encode()) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(prev_count: Vec) -> Result<(), &'static str> { + let prev_count: u32 = Decode::decode(&mut prev_count.as_slice()).expect( + "the state parameter should be something that was generated by pre_upgrade", + ); + let post_count = Collection::::iter().count() as u32; + assert_eq!( + prev_count, post_count, + "the records count before and after the migration should be the same" + ); + + ensure!(Pallet::::on_chain_storage_version() == 1, "wrong storage version"); + + Ok(()) + } + } +} diff --git a/frame/nfts/src/tests.rs b/frame/nfts/src/tests.rs index e44e4151f84a0..694468aceebe5 100644 --- a/frame/nfts/src/tests.rs +++ b/frame/nfts/src/tests.rs @@ -215,21 +215,44 @@ fn lifecycle_should_work() { assert_eq!(items(), vec![(account(1), 0, 70), (account(10), 0, 42), (account(20), 0, 69)]); assert_eq!(Collection::::get(0).unwrap().items, 3); assert_eq!(Collection::::get(0).unwrap().item_metadatas, 0); + assert_eq!(Collection::::get(0).unwrap().item_configs, 3); - assert_eq!(Balances::reserved_balance(&account(2)), 0); + assert_eq!(Balances::reserved_balance(&account(1)), 8); assert_ok!(Nfts::transfer(RuntimeOrigin::signed(account(1)), 0, 70, account(2))); - assert_eq!(Balances::reserved_balance(&account(2)), 1); + assert_eq!(Balances::reserved_balance(&account(1)), 8); + assert_eq!(Balances::reserved_balance(&account(2)), 0); assert_ok!(Nfts::set_metadata(RuntimeOrigin::signed(account(1)), 0, 42, bvec![42, 42])); - assert_eq!(Balances::reserved_balance(&account(1)), 10); + assert_eq!(Balances::reserved_balance(&account(1)), 11); assert!(ItemMetadataOf::::contains_key(0, 42)); assert_ok!(Nfts::set_metadata(RuntimeOrigin::signed(account(1)), 0, 69, bvec![69, 69])); - assert_eq!(Balances::reserved_balance(&account(1)), 13); + assert_eq!(Balances::reserved_balance(&account(1)), 14); assert!(ItemMetadataOf::::contains_key(0, 69)); - + assert!(ItemConfigOf::::contains_key(0, 69)); let w = Nfts::get_destroy_witness(&0).unwrap(); - assert_eq!(w.items, 3); assert_eq!(w.item_metadatas, 2); + assert_eq!(w.item_configs, 3); + assert_noop!( + Nfts::destroy(RuntimeOrigin::signed(account(1)), 0, w), + Error::::CollectionNotEmpty + ); + + assert_ok!(Nfts::set_attribute( + RuntimeOrigin::signed(account(1)), + 0, + Some(69), + AttributeNamespace::CollectionOwner, + bvec![0], + bvec![0], + )); + assert_ok!(Nfts::burn(RuntimeOrigin::signed(account(10)), 0, 42)); + assert_ok!(Nfts::burn(RuntimeOrigin::signed(account(20)), 0, 69)); + assert_ok!(Nfts::burn(RuntimeOrigin::root(), 0, 70)); + + let w = Nfts::get_destroy_witness(&0).unwrap(); + assert_eq!(w.attributes, 1); + assert_eq!(w.item_metadatas, 0); + assert_eq!(w.item_configs, 0); assert_ok!(Nfts::destroy(RuntimeOrigin::signed(account(1)), 0, w)); assert_eq!(Balances::reserved_balance(&account(1)), 0); @@ -240,6 +263,8 @@ fn lifecycle_should_work() { assert!(!CollectionMetadataOf::::contains_key(0)); assert!(!ItemMetadataOf::::contains_key(0, 42)); assert!(!ItemMetadataOf::::contains_key(0, 69)); + assert!(!ItemConfigOf::::contains_key(0, 69)); + assert_eq!(attributes(0), vec![]); assert_eq!(collections(), vec![]); assert_eq!(items(), vec![]); }); @@ -256,14 +281,51 @@ fn destroy_with_bad_witness_should_not_work() { )); let w = Collection::::get(0).unwrap().destroy_witness(); - assert_ok!(Nfts::mint(RuntimeOrigin::signed(account(1)), 0, 42, account(1), None)); assert_noop!( - Nfts::destroy(RuntimeOrigin::signed(account(1)), 0, w), + Nfts::destroy( + RuntimeOrigin::signed(account(1)), + 0, + DestroyWitness { item_configs: 1, ..w } + ), Error::::BadWitness ); }); } +#[test] +fn destroy_should_work() { + new_test_ext().execute_with(|| { + Balances::make_free_balance_be(&account(1), 100); + assert_ok!(Nfts::create( + RuntimeOrigin::signed(account(1)), + account(1), + collection_config_with_all_settings_enabled() + )); + + assert_ok!(Nfts::mint(RuntimeOrigin::signed(account(1)), 0, 42, account(2), None)); + assert_noop!( + Nfts::destroy( + RuntimeOrigin::signed(account(1)), + 0, + Nfts::get_destroy_witness(&0).unwrap() + ), + Error::::CollectionNotEmpty + ); + assert_ok!(Nfts::lock_item_transfer(RuntimeOrigin::signed(account(1)), 0, 42)); + assert_ok!(Nfts::burn(RuntimeOrigin::signed(account(2)), 0, 42)); + assert_eq!(Collection::::get(0).unwrap().item_configs, 1); + assert_eq!(ItemConfigOf::::iter_prefix(0).count() as u32, 1); + assert!(ItemConfigOf::::contains_key(0, 42)); + assert_ok!(Nfts::destroy( + RuntimeOrigin::signed(account(1)), + 0, + Nfts::get_destroy_witness(&0).unwrap() + )); + assert!(!ItemConfigOf::::contains_key(0, 42)); + assert_eq!(ItemConfigOf::::iter_prefix(0).count() as u32, 0); + }); +} + #[test] fn mint_should_work() { new_test_ext().execute_with(|| { @@ -491,8 +553,9 @@ fn origin_guards_should_work() { Nfts::mint(RuntimeOrigin::signed(account(2)), 0, 69, account(2), None), Error::::NoPermission ); + assert_ok!(Nfts::mint(RuntimeOrigin::signed(account(1)), 0, 43, account(2), None)); assert_noop!( - Nfts::burn(RuntimeOrigin::signed(account(2)), 0, 42, None), + Nfts::burn(RuntimeOrigin::signed(account(1)), 0, 43), Error::::NoPermission ); let w = Nfts::get_destroy_witness(&0).unwrap(); @@ -536,13 +599,13 @@ fn transfer_owner_should_work() { // Mint and set metadata now and make sure that deposit gets transferred back. assert_ok!(Nfts::set_collection_metadata( - RuntimeOrigin::signed(account(2)), + RuntimeOrigin::signed(account(1)), 0, bvec![0u8; 20], )); assert_ok!(Nfts::mint(RuntimeOrigin::signed(account(1)), 0, 42, account(1), None)); assert_eq!(Balances::reserved_balance(&account(1)), 1); - assert_ok!(Nfts::set_metadata(RuntimeOrigin::signed(account(2)), 0, 42, bvec![0u8; 20])); + assert_ok!(Nfts::set_metadata(RuntimeOrigin::signed(account(1)), 0, 42, bvec![0u8; 20])); assert_ok!(Nfts::set_accept_ownership(RuntimeOrigin::signed(account(3)), Some(0))); assert_ok!(Nfts::transfer_ownership(RuntimeOrigin::signed(account(2)), 0, account(3))); assert_eq!(collections(), vec![(account(3), 0)]); @@ -552,8 +615,9 @@ fn transfer_owner_should_work() { assert_eq!(Balances::reserved_balance(&account(3)), 44); assert_ok!(Nfts::transfer(RuntimeOrigin::signed(account(1)), 0, 42, account(2))); - assert_eq!(Balances::reserved_balance(&account(1)), 0); - assert_eq!(Balances::reserved_balance(&account(2)), 1); + // reserved_balance of accounts 1 & 2 should be unchanged: + assert_eq!(Balances::reserved_balance(&account(1)), 1); + assert_eq!(Balances::reserved_balance(&account(2)), 0); // 2's acceptance from before is reset when it became an owner, so it cannot be transferred // without a fresh acceptance. @@ -583,8 +647,14 @@ fn set_team_should_work() { assert_ok!(Nfts::mint(RuntimeOrigin::signed(account(2)), 0, 42, account(2), None)); assert_ok!(Nfts::lock_item_transfer(RuntimeOrigin::signed(account(4)), 0, 42)); assert_ok!(Nfts::unlock_item_transfer(RuntimeOrigin::signed(account(4)), 0, 42)); - assert_ok!(Nfts::transfer(RuntimeOrigin::signed(account(3)), 0, 42, account(3))); - assert_ok!(Nfts::burn(RuntimeOrigin::signed(account(3)), 0, 42, None)); + assert_noop!( + Nfts::transfer(RuntimeOrigin::signed(account(3)), 0, 42, account(3)), + Error::::NoPermission + ); + assert_noop!( + Nfts::burn(RuntimeOrigin::signed(account(3)), 0, 42), + Error::::NoPermission + ); }); } @@ -594,7 +664,7 @@ fn set_collection_metadata_should_work() { // Cannot add metadata to unknown item assert_noop!( Nfts::set_collection_metadata(RuntimeOrigin::signed(account(1)), 0, bvec![0u8; 20]), - Error::::NoConfig, + Error::::NoPermission, ); assert_ok!(Nfts::force_create( RuntimeOrigin::root(), @@ -668,7 +738,7 @@ fn set_collection_metadata_should_work() { ); assert_noop!( Nfts::clear_collection_metadata(RuntimeOrigin::signed(account(1)), 1), - Error::::UnknownCollection + Error::::NoPermission ); assert_noop!( Nfts::clear_collection_metadata(RuntimeOrigin::signed(account(1)), 0), @@ -743,7 +813,7 @@ fn set_item_metadata_should_work() { ); assert_noop!( Nfts::clear_metadata(RuntimeOrigin::signed(account(1)), 1, 42), - Error::::MetadataNotFound, + Error::::NoPermission, ); assert_ok!(Nfts::clear_metadata(RuntimeOrigin::root(), 0, 42)); assert!(!ItemMetadataOf::::contains_key(0, 42)); @@ -832,6 +902,7 @@ fn set_collection_owner_attributes_should_work() { ); assert_eq!(Balances::reserved_balance(account(1)), 16); + assert_ok!(Nfts::burn(RuntimeOrigin::root(), 0, 0)); let w = Nfts::get_destroy_witness(&0).unwrap(); assert_ok!(Nfts::destroy(RuntimeOrigin::signed(account(1)), 0, w)); assert_eq!(attributes(0), vec![]); @@ -997,7 +1068,7 @@ fn set_item_owner_attributes_should_work() { assert_eq!(Balances::reserved_balance(account(3)), 13); // validate attributes on item deletion - assert_ok!(Nfts::burn(RuntimeOrigin::signed(account(3)), 0, 0, None)); + assert_ok!(Nfts::burn(RuntimeOrigin::signed(account(3)), 0, 0)); assert_eq!( attributes(0), vec![ @@ -1317,7 +1388,7 @@ fn preserve_config_for_frozen_items() { assert_ok!(Nfts::mint(RuntimeOrigin::signed(account(1)), 0, 1, account(1), None)); // if the item is not locked/frozen then the config gets deleted on item burn - assert_ok!(Nfts::burn(RuntimeOrigin::signed(account(1)), 0, 1, Some(account(1)))); + assert_ok!(Nfts::burn(RuntimeOrigin::signed(account(1)), 0, 1)); assert!(!ItemConfigOf::::contains_key(0, 1)); // lock the item and ensure the config stays unchanged @@ -1329,7 +1400,7 @@ fn preserve_config_for_frozen_items() { let config = ItemConfigOf::::get(0, 0).unwrap(); assert_eq!(config, expect_config); - assert_ok!(Nfts::burn(RuntimeOrigin::signed(account(1)), 0, 0, Some(account(1)))); + assert_ok!(Nfts::burn(RuntimeOrigin::signed(account(1)), 0, 0)); let config = ItemConfigOf::::get(0, 0).unwrap(); assert_eq!(config, expect_config); @@ -1405,6 +1476,7 @@ fn force_update_collection_should_work() { Balances::make_free_balance_be(&account(5), 100); assert_ok!(Nfts::force_collection_owner(RuntimeOrigin::root(), 0, account(5))); + assert_ok!(Nfts::set_team(RuntimeOrigin::root(), 0, account(2), account(5), account(4))); assert_eq!(collections(), vec![(account(5), 0)]); assert_eq!(Balances::reserved_balance(account(1)), 2); assert_eq!(Balances::reserved_balance(account(5)), 63); @@ -1475,7 +1547,7 @@ fn burn_works() { )); assert_noop!( - Nfts::burn(RuntimeOrigin::signed(account(5)), 0, 42, Some(account(5))), + Nfts::burn(RuntimeOrigin::signed(account(5)), 0, 42), Error::::UnknownItem ); @@ -1496,16 +1568,12 @@ fn burn_works() { assert_eq!(Balances::reserved_balance(account(1)), 2); assert_noop!( - Nfts::burn(RuntimeOrigin::signed(account(0)), 0, 42, None), + Nfts::burn(RuntimeOrigin::signed(account(0)), 0, 42), Error::::NoPermission ); - assert_noop!( - Nfts::burn(RuntimeOrigin::signed(account(5)), 0, 42, Some(account(6))), - Error::::WrongOwner - ); - assert_ok!(Nfts::burn(RuntimeOrigin::signed(account(5)), 0, 42, Some(account(5)))); - assert_ok!(Nfts::burn(RuntimeOrigin::signed(account(3)), 0, 69, Some(account(5)))); + assert_ok!(Nfts::burn(RuntimeOrigin::signed(account(5)), 0, 42)); + assert_ok!(Nfts::burn(RuntimeOrigin::signed(account(5)), 0, 69)); assert_eq!(Balances::reserved_balance(account(1)), 0); }); } @@ -1819,21 +1887,21 @@ fn cancel_approval_works_with_admin() { None )); assert_noop!( - Nfts::cancel_approval(RuntimeOrigin::signed(account(1)), 1, 42, account(1)), + Nfts::cancel_approval(RuntimeOrigin::signed(account(2)), 1, 42, account(1)), Error::::UnknownItem ); assert_noop!( - Nfts::cancel_approval(RuntimeOrigin::signed(account(1)), 0, 43, account(1)), + Nfts::cancel_approval(RuntimeOrigin::signed(account(2)), 0, 43, account(1)), Error::::UnknownItem ); assert_noop!( - Nfts::cancel_approval(RuntimeOrigin::signed(account(1)), 0, 42, account(4)), + Nfts::cancel_approval(RuntimeOrigin::signed(account(2)), 0, 42, account(4)), Error::::NotDelegate ); - assert_ok!(Nfts::cancel_approval(RuntimeOrigin::signed(account(1)), 0, 42, account(3))); + assert_ok!(Nfts::cancel_approval(RuntimeOrigin::signed(account(2)), 0, 42, account(3))); assert_noop!( - Nfts::cancel_approval(RuntimeOrigin::signed(account(1)), 0, 42, account(1)), + Nfts::cancel_approval(RuntimeOrigin::signed(account(2)), 0, 42, account(1)), Error::::NotDelegate ); }); @@ -3013,6 +3081,7 @@ fn add_remove_item_attributes_approval_should_work() { #[test] fn pre_signed_mints_should_work() { new_test_ext().execute_with(|| { + let user_0 = account(0); let user_1_pair = sp_core::sr25519::Pair::from_string("//Alice", None).unwrap(); let user_1_signer = MultiSigner::Sr25519(user_1_pair.public()); let user_1 = user_1_signer.clone().into_account(); @@ -3029,10 +3098,10 @@ fn pre_signed_mints_should_work() { let user_2 = account(2); let user_3 = account(3); - Balances::make_free_balance_be(&user_1, 100); + Balances::make_free_balance_be(&user_0, 100); Balances::make_free_balance_be(&user_2, 100); assert_ok!(Nfts::create( - RuntimeOrigin::signed(user_1.clone()), + RuntimeOrigin::signed(user_0.clone()), user_1.clone(), collection_config_with_all_settings_enabled(), )); @@ -3069,7 +3138,7 @@ fn pre_signed_mints_should_work() { assert_eq!(deposit.account, Some(user_2.clone())); assert_eq!(deposit.amount, 3); - assert_eq!(Balances::free_balance(&user_1), 100 - 2); // 2 - collection deposit + assert_eq!(Balances::free_balance(&user_0), 100 - 2); // 2 - collection deposit assert_eq!(Balances::free_balance(&user_2), 100 - 1 - 3 - 6); // 1 - item deposit, 3 - metadata, 6 - attributes assert_noop!( @@ -3082,7 +3151,7 @@ fn pre_signed_mints_should_work() { Error::::AlreadyExists ); - assert_ok!(Nfts::burn(RuntimeOrigin::signed(user_2.clone()), 0, 0, Some(user_2.clone()))); + assert_ok!(Nfts::burn(RuntimeOrigin::signed(user_2.clone()), 0, 0)); assert_eq!(Balances::free_balance(&user_2), 100 - 6); // validate the `only_account` field diff --git a/frame/nfts/src/types.rs b/frame/nfts/src/types.rs index f8ab2a355b48b..fe6d31c12acec 100644 --- a/frame/nfts/src/types.rs +++ b/frame/nfts/src/types.rs @@ -92,6 +92,8 @@ pub struct CollectionDetails { pub(super) items: u32, /// The total number of outstanding item metadata of this collection. pub(super) item_metadatas: u32, + /// The total number of outstanding item configs of this collection. + pub(super) item_configs: u32, /// The total number of attributes for this collection. pub(super) attributes: u32, } @@ -99,12 +101,12 @@ pub struct CollectionDetails { /// Witness data for the destroy transactions. #[derive(Copy, Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo, MaxEncodedLen)] pub struct DestroyWitness { - /// The total number of outstanding items of this collection. - #[codec(compact)] - pub items: u32, /// The total number of items in this collection that have outstanding item metadata. #[codec(compact)] pub item_metadatas: u32, + /// The total number of outstanding item configs of this collection. + #[codec(compact)] + pub item_configs: u32, /// The total number of attributes for this collection. #[codec(compact)] pub attributes: u32, @@ -113,8 +115,8 @@ pub struct DestroyWitness { impl CollectionDetails { pub fn destroy_witness(&self) -> DestroyWitness { DestroyWitness { - items: self.items, item_metadatas: self.item_metadatas, + item_configs: self.item_configs, attributes: self.attributes, } } diff --git a/frame/nfts/src/weights.rs b/frame/nfts/src/weights.rs index 858ae2fec9226..3d447c8d264d4 100644 --- a/frame/nfts/src/weights.rs +++ b/frame/nfts/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_nfts //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-03-10, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-osnnfcqu-project-145-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -33,7 +33,7 @@ // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --json-file=/builds/parity/mirrors/substrate/.git/.artifacts/bench.json +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/substrate/.git/.artifacts/bench.json // --pallet=pallet_nfts // --chain=dev // --header=./HEADER-APACHE2 @@ -51,7 +51,7 @@ use sp_std::marker::PhantomData; pub trait WeightInfo { fn create() -> Weight; fn force_create() -> Weight; - fn destroy(n: u32, m: u32, a: u32, ) -> Weight; + fn destroy(m: u32, c: u32, a: u32, ) -> Weight; fn mint() -> Weight; fn force_mint() -> Weight; fn burn() -> Weight; @@ -96,7 +96,7 @@ impl WeightInfo for SubstrateWeight { /// Storage: Nfts NextCollectionId (r:1 w:1) /// Proof: Nfts NextCollectionId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionRoleOf (r:0 w:1) /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:0 w:1) @@ -106,17 +106,16 @@ impl WeightInfo for SubstrateWeight { fn create() -> Weight { // Proof Size summary in bytes: // Measured: `214` - // Estimated: `3054` - // Minimum execution time: 33_769 nanoseconds. - Weight::from_parts(36_031_000, 0) - .saturating_add(Weight::from_parts(0, 3054)) + // Estimated: `5038` + // Minimum execution time: 37_598_000 picoseconds. + Weight::from_parts(38_703_000, 5038) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Nfts NextCollectionId (r:1 w:1) /// Proof: Nfts NextCollectionId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionRoleOf (r:0 w:1) /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:0 w:1) @@ -126,54 +125,45 @@ impl WeightInfo for SubstrateWeight { fn force_create() -> Weight { // Proof Size summary in bytes: // Measured: `42` - // Estimated: `3054` - // Minimum execution time: 21_767 nanoseconds. - Weight::from_parts(22_565_000, 0) - .saturating_add(Weight::from_parts(0, 3054)) + // Estimated: `5038` + // Minimum execution time: 25_899_000 picoseconds. + Weight::from_parts(26_385_000, 5038) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) - /// Storage: Nfts Item (r:1001 w:1000) - /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) - /// Storage: Nfts ItemMetadataOf (r:1001 w:1000) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts ItemMetadataOf (r:1 w:0) /// Proof: Nfts ItemMetadataOf (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:1 w:1) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts Attribute (r:1001 w:1000) /// Proof: Nfts Attribute (max_values: None, max_size: Some(446), added: 2921, mode: MaxEncodedLen) - /// Storage: Nfts CollectionRoleOf (r:0 w:1) - /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1000 w:1000) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) /// Storage: Nfts CollectionMetadataOf (r:0 w:1) /// Proof: Nfts CollectionMetadataOf (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:0 w:1) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) - /// Storage: Nfts ItemConfigOf (r:0 w:1000) - /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) - /// Storage: Nfts Account (r:0 w:1000) - /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) /// Storage: Nfts CollectionAccount (r:0 w:1) /// Proof: Nfts CollectionAccount (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - /// The range of component `n` is `[0, 1000]`. /// The range of component `m` is `[0, 1000]`. + /// The range of component `c` is `[0, 1000]`. /// The range of component `a` is `[0, 1000]`. - fn destroy(_n: u32, m: u32, a: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `172781 + m * (127 ±0) + a * (402 ±0)` - // Estimated: `3347427 + m * (2615 ±0) + a * (2921 ±0)` - // Minimum execution time: 26_973_627 nanoseconds. - Weight::from_parts(19_692_361_714, 0) - .saturating_add(Weight::from_parts(0, 3347427)) - // Standard Error: 17_036 - .saturating_add(Weight::from_parts(7_797_219, 0).saturating_mul(m.into())) - // Standard Error: 17_036 - .saturating_add(Weight::from_parts(9_504_128, 0).saturating_mul(a.into())) + fn destroy(m: u32, _c: u32, a: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `32218 + a * (364 ±0)` + // Estimated: `2538589 + a * (2921 ±0)` + // Minimum execution time: 1_129_980_000 picoseconds. + Weight::from_parts(1_096_213_543, 2538589) + // Standard Error: 5_210 + .saturating_add(Weight::from_parts(92, 0).saturating_mul(m.into())) + // Standard Error: 5_210 + .saturating_add(Weight::from_parts(5_480_550, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(1004_u64)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(3005_u64)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().writes(1005_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into()))) - .saturating_add(Weight::from_parts(0, 2615).saturating_mul(m.into())) .saturating_add(Weight::from_parts(0, 2921).saturating_mul(a.into())) } /// Storage: Nfts CollectionConfigOf (r:1 w:0) @@ -181,7 +171,7 @@ impl WeightInfo for SubstrateWeight { /// Storage: Nfts Item (r:1 w:1) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionRoleOf (r:1 w:0) /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:1) @@ -190,11 +180,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) fn mint() -> Weight { // Proof Size summary in bytes: - // Measured: `448` - // Estimated: `13506` - // Minimum execution time: 44_837 nanoseconds. - Weight::from_parts(46_794_000, 0) - .saturating_add(Weight::from_parts(0, 13506)) + // Measured: `453` + // Estimated: `18460` + // Minimum execution time: 49_434_000 picoseconds. + Weight::from_parts(50_248_000, 18460) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -203,7 +192,7 @@ impl WeightInfo for SubstrateWeight { /// Storage: Nfts Item (r:1 w:1) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:1) @@ -212,22 +201,19 @@ impl WeightInfo for SubstrateWeight { /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) fn force_mint() -> Weight { // Proof Size summary in bytes: - // Measured: `448` - // Estimated: `13506` - // Minimum execution time: 43_976 nanoseconds. - Weight::from_parts(44_831_000, 0) - .saturating_add(Weight::from_parts(0, 13506)) + // Measured: `453` + // Estimated: `18460` + // Minimum execution time: 47_393_000 picoseconds. + Weight::from_parts(47_906_000, 18460) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: Nfts ItemConfigOf (r:1 w:1) /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts Item (r:1 w:1) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) - /// Storage: Nfts CollectionRoleOf (r:1 w:0) - /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts ItemMetadataOf (r:1 w:0) /// Proof: Nfts ItemMetadataOf (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) /// Storage: Nfts Account (r:0 w:1) @@ -240,26 +226,21 @@ impl WeightInfo for SubstrateWeight { /// Proof: Nfts PendingSwapOf (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen) fn burn() -> Weight { // Proof Size summary in bytes: - // Measured: `647` - // Estimated: `13573` - // Minimum execution time: 48_233 nanoseconds. - Weight::from_parts(50_113_000, 0) - .saturating_add(Weight::from_parts(0, 13573)) - .saturating_add(T::DbWeight::get().reads(5_u64)) + // Measured: `594` + // Estimated: `14993` + // Minimum execution time: 47_188_000 picoseconds. + Weight::from_parts(47_746_000, 14993) + .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:0) /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) /// Storage: Nfts Item (r:1 w:1) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) - /// Storage: Nfts CollectionRoleOf (r:1 w:0) - /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Nfts Account (r:0 w:2) /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) /// Storage: Nfts ItemPriceOf (r:0 w:1) @@ -268,16 +249,15 @@ impl WeightInfo for SubstrateWeight { /// Proof: Nfts PendingSwapOf (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen) fn transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `882` - // Estimated: `16109` - // Minimum execution time: 55_452 nanoseconds. - Weight::from_parts(57_642_000, 0) - .saturating_add(Weight::from_parts(0, 16109)) - .saturating_add(T::DbWeight::get().reads(6_u64)) - .saturating_add(T::DbWeight::get().writes(6_u64)) + // Measured: `623` + // Estimated: `14926` + // Minimum execution time: 37_984_000 picoseconds. + Weight::from_parts(38_446_000, 14926) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts Item (r:5000 w:5000) @@ -285,13 +265,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `i` is `[0, 5000]`. fn redeposit(i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `756 + i * (140 ±0)` - // Estimated: `5103 + i * (3336 ±0)` - // Minimum execution time: 15_598 nanoseconds. - Weight::from_parts(15_926_000, 0) - .saturating_add(Weight::from_parts(0, 5103)) - // Standard Error: 13_692 - .saturating_add(Weight::from_parts(14_040_741, 0).saturating_mul(i.into())) + // Measured: `761 + i * (140 ±0)` + // Estimated: `8077 + i * (3336 ±0)` + // Minimum execution time: 17_297_000 picoseconds. + Weight::from_parts(17_634_000, 8077) + // Standard Error: 17_773 + .saturating_add(Weight::from_parts(14_395_819, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) @@ -304,10 +283,9 @@ impl WeightInfo for SubstrateWeight { fn lock_item_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `401` - // Estimated: `5067` - // Minimum execution time: 19_686 nanoseconds. - Weight::from_parts(20_404_000, 0) - .saturating_add(Weight::from_parts(0, 5067)) + // Estimated: `7047` + // Minimum execution time: 21_827_000 picoseconds. + Weight::from_parts(22_134_000, 7047) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -318,101 +296,96 @@ impl WeightInfo for SubstrateWeight { fn unlock_item_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `401` - // Estimated: `5067` - // Minimum execution time: 19_172 nanoseconds. - Weight::from_parts(20_151_000, 0) - .saturating_add(Weight::from_parts(0, 5067)) + // Estimated: `7047` + // Minimum execution time: 21_549_000 picoseconds. + Weight::from_parts(21_987_000, 7047) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: Nfts CollectionRoleOf (r:1 w:0) - /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:0) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:1) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) fn lock_collection() -> Weight { // Proof Size summary in bytes: - // Measured: `289` - // Estimated: `5092` - // Minimum execution time: 17_063 nanoseconds. - Weight::from_parts(17_482_000, 0) - .saturating_add(Weight::from_parts(0, 5092)) + // Measured: `338` + // Estimated: `7087` + // Minimum execution time: 18_930_000 picoseconds. + Weight::from_parts(19_200_000, 7087) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Nfts OwnershipAcceptance (r:1 w:1) /// Proof: Nfts OwnershipAcceptance (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionAccount (r:0 w:2) /// Proof: Nfts CollectionAccount (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) fn transfer_ownership() -> Weight { // Proof Size summary in bytes: - // Measured: `381` - // Estimated: `5082` - // Minimum execution time: 21_974 nanoseconds. - Weight::from_parts(22_770_000, 0) - .saturating_add(Weight::from_parts(0, 5082)) + // Measured: `386` + // Estimated: `7066` + // Minimum execution time: 24_929_000 picoseconds. + Weight::from_parts(25_786_000, 7066) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) - /// Storage: Nfts CollectionRoleOf (r:0 w:4) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:1 w:4) /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) fn set_team() -> Weight { // Proof Size summary in bytes: - // Measured: `362` - // Estimated: `2555` - // Minimum execution time: 24_341 nanoseconds. - Weight::from_parts(25_059_000, 0) - .saturating_add(Weight::from_parts(0, 2555)) - .saturating_add(T::DbWeight::get().reads(1_u64)) + // Measured: `367` + // Estimated: `7083` + // Minimum execution time: 28_245_000 picoseconds. + Weight::from_parts(28_490_000, 7083) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionAccount (r:0 w:2) /// Proof: Nfts CollectionAccount (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) fn force_collection_owner() -> Weight { // Proof Size summary in bytes: - // Measured: `304` - // Estimated: `2555` - // Minimum execution time: 16_897 nanoseconds. - Weight::from_parts(17_560_000, 0) - .saturating_add(Weight::from_parts(0, 2555)) + // Measured: `309` + // Estimated: `3549` + // Minimum execution time: 19_971_000 picoseconds. + Weight::from_parts(20_276_000, 3549) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:0 w:1) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) fn force_collection_config() -> Weight { // Proof Size summary in bytes: // Measured: `242` - // Estimated: `2555` - // Minimum execution time: 13_239 nanoseconds. - Weight::from_parts(13_963_000, 0) - .saturating_add(Weight::from_parts(0, 2555)) + // Estimated: `3549` + // Minimum execution time: 15_924_000 picoseconds. + Weight::from_parts(16_258_000, 3549) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:1) /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) fn lock_item_properties() -> Weight { // Proof Size summary in bytes: - // Measured: `445` - // Estimated: `5078` - // Minimum execution time: 17_187 nanoseconds. - Weight::from_parts(17_942_000, 0) - .saturating_add(Weight::from_parts(0, 5078)) + // Measured: `401` + // Estimated: `7047` + // Minimum execution time: 20_780_000 picoseconds. + Weight::from_parts(21_109_000, 7047) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:0) @@ -421,42 +394,41 @@ impl WeightInfo for SubstrateWeight { /// Proof: Nfts Attribute (max_values: None, max_size: Some(446), added: 2921, mode: MaxEncodedLen) fn set_attribute() -> Weight { // Proof Size summary in bytes: - // Measured: `474` - // Estimated: `10547` - // Minimum execution time: 40_925 nanoseconds. - Weight::from_parts(42_733_000, 0) - .saturating_add(Weight::from_parts(0, 10547)) - .saturating_add(T::DbWeight::get().reads(4_u64)) + // Measured: `537` + // Estimated: `18045` + // Minimum execution time: 50_817_000 picoseconds. + Weight::from_parts(51_585_000, 18045) + .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts Attribute (r:1 w:1) /// Proof: Nfts Attribute (max_values: None, max_size: Some(446), added: 2921, mode: MaxEncodedLen) fn force_set_attribute() -> Weight { // Proof Size summary in bytes: - // Measured: `337` - // Estimated: `5476` - // Minimum execution time: 24_486 nanoseconds. - Weight::from_parts(25_409_000, 0) - .saturating_add(Weight::from_parts(0, 5476)) + // Measured: `342` + // Estimated: `7460` + // Minimum execution time: 28_821_000 picoseconds. + Weight::from_parts(29_417_000, 7460) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: Nfts Attribute (r:1 w:1) /// Proof: Nfts Attribute (max_values: None, max_size: Some(446), added: 2921, mode: MaxEncodedLen) - /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:0) /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) fn clear_attribute() -> Weight { // Proof Size summary in bytes: - // Measured: `916` - // Estimated: `7999` - // Minimum execution time: 36_643 nanoseconds. - Weight::from_parts(37_805_000, 0) - .saturating_add(Weight::from_parts(0, 7999)) - .saturating_add(T::DbWeight::get().reads(3_u64)) + // Measured: `979` + // Estimated: `14507` + // Minimum execution time: 47_021_000 picoseconds. + Weight::from_parts(47_509_000, 14507) + .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: Nfts Item (r:1 w:0) @@ -466,10 +438,9 @@ impl WeightInfo for SubstrateWeight { fn approve_item_attributes() -> Weight { // Proof Size summary in bytes: // Measured: `379` - // Estimated: `6492` - // Minimum execution time: 16_798 nanoseconds. - Weight::from_parts(17_326_000, 0) - .saturating_add(Weight::from_parts(0, 6492)) + // Estimated: `8472` + // Minimum execution time: 19_457_000 picoseconds. + Weight::from_parts(19_738_000, 8472) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -485,20 +456,21 @@ impl WeightInfo for SubstrateWeight { fn cancel_item_attributes_approval(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `899 + n * (396 ±0)` - // Estimated: `12016 + n * (2921 ±0)` - // Minimum execution time: 25_524 nanoseconds. - Weight::from_parts(26_107_000, 0) - .saturating_add(Weight::from_parts(0, 12016)) - // Standard Error: 5_460 - .saturating_add(Weight::from_parts(9_030_830, 0).saturating_mul(n.into())) + // Estimated: `15976 + n * (2921 ±0)` + // Minimum execution time: 29_027_000 picoseconds. + Weight::from_parts(29_376_000, 15976) + // Standard Error: 3_500 + .saturating_add(Weight::from_parts(5_568_116, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 2921).saturating_mul(n.into())) } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:0) /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) @@ -507,104 +479,97 @@ impl WeightInfo for SubstrateWeight { /// Proof: Nfts ItemMetadataOf (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) fn set_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `474` - // Estimated: `10241` - // Minimum execution time: 34_400 nanoseconds. - Weight::from_parts(35_469_000, 0) - .saturating_add(Weight::from_parts(0, 10241)) - .saturating_add(T::DbWeight::get().reads(4_u64)) + // Measured: `537` + // Estimated: `17739` + // Minimum execution time: 41_658_000 picoseconds. + Weight::from_parts(42_241_000, 17739) + .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts ItemMetadataOf (r:1 w:1) /// Proof: Nfts ItemMetadataOf (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:0) /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) fn clear_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `609` - // Estimated: `7693` - // Minimum execution time: 31_560 nanoseconds. - Weight::from_parts(33_081_000, 0) - .saturating_add(Weight::from_parts(0, 7693)) - .saturating_add(T::DbWeight::get().reads(3_u64)) + // Measured: `672` + // Estimated: `14201` + // Minimum execution time: 39_838_000 picoseconds. + Weight::from_parts(40_757_000, 14201) + .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionMetadataOf (r:1 w:1) /// Proof: Nfts CollectionMetadataOf (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) fn set_collection_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `333` - // Estimated: `7665` - // Minimum execution time: 28_821 nanoseconds. - Weight::from_parts(30_010_000, 0) - .saturating_add(Weight::from_parts(0, 7665)) - .saturating_add(T::DbWeight::get().reads(3_u64)) + // Measured: `396` + // Estimated: `14173` + // Minimum execution time: 37_327_000 picoseconds. + Weight::from_parts(37_874_000, 14173) + .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts CollectionMetadataOf (r:1 w:1) /// Proof: Nfts CollectionMetadataOf (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) fn clear_collection_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `476` - // Estimated: `7665` - // Minimum execution time: 27_608 nanoseconds. - Weight::from_parts(28_766_000, 0) - .saturating_add(Weight::from_parts(0, 7665)) - .saturating_add(T::DbWeight::get().reads(3_u64)) + // Measured: `539` + // Estimated: `14173` + // Minimum execution time: 35_305_000 picoseconds. + Weight::from_parts(36_213_000, 14173) + .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Nfts Item (r:1 w:1) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) - /// Storage: Nfts CollectionRoleOf (r:1 w:0) - /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) fn approve_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `466` - // Estimated: `8428` - // Minimum execution time: 23_987 nanoseconds. - Weight::from_parts(24_819_000, 0) - .saturating_add(Weight::from_parts(0, 8428)) - .saturating_add(T::DbWeight::get().reads(3_u64)) + // Measured: `408` + // Estimated: `7864` + // Minimum execution time: 22_680_000 picoseconds. + Weight::from_parts(23_126_000, 7864) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Nfts Item (r:1 w:1) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) - /// Storage: Nfts CollectionRoleOf (r:1 w:0) - /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) fn cancel_approval() -> Weight { // Proof Size summary in bytes: - // Measured: `474` - // Estimated: `5880` - // Minimum execution time: 21_254 nanoseconds. - Weight::from_parts(21_826_000, 0) - .saturating_add(Weight::from_parts(0, 5880)) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Measured: `416` + // Estimated: `4326` + // Minimum execution time: 19_837_000 picoseconds. + Weight::from_parts(20_352_000, 4326) + .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Nfts Item (r:1 w:1) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) - /// Storage: Nfts CollectionRoleOf (r:1 w:0) - /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) fn clear_all_transfer_approvals() -> Weight { // Proof Size summary in bytes: - // Measured: `474` - // Estimated: `5880` - // Minimum execution time: 20_272 nanoseconds. - Weight::from_parts(20_922_000, 0) - .saturating_add(Weight::from_parts(0, 5880)) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Measured: `416` + // Estimated: `4326` + // Minimum execution time: 18_911_000 picoseconds. + Weight::from_parts(19_233_000, 4326) + .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Nfts OwnershipAcceptance (r:1 w:1) @@ -612,38 +577,35 @@ impl WeightInfo for SubstrateWeight { fn set_accept_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `42` - // Estimated: `2527` - // Minimum execution time: 14_287 nanoseconds. - Weight::from_parts(14_960_000, 0) - .saturating_add(Weight::from_parts(0, 2527)) + // Estimated: `3517` + // Minimum execution time: 17_292_000 picoseconds. + Weight::from_parts(17_568_000, 3517) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Nfts CollectionConfigOf (r:1 w:1) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) fn set_collection_max_supply() -> Weight { // Proof Size summary in bytes: - // Measured: `333` - // Estimated: `5103` - // Minimum execution time: 17_948 nanoseconds. - Weight::from_parts(18_780_000, 0) - .saturating_add(Weight::from_parts(0, 5103)) + // Measured: `338` + // Estimated: `7087` + // Minimum execution time: 20_323_000 picoseconds. + Weight::from_parts(20_692_000, 7087) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:1) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) fn update_mint_settings() -> Weight { // Proof Size summary in bytes: - // Measured: `333` - // Estimated: `5103` - // Minimum execution time: 16_616 nanoseconds. - Weight::from_parts(17_155_000, 0) - .saturating_add(Weight::from_parts(0, 5103)) + // Measured: `289` + // Estimated: `7072` + // Minimum execution time: 19_971_000 picoseconds. + Weight::from_parts(20_159_000, 7072) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -658,10 +620,9 @@ impl WeightInfo for SubstrateWeight { fn set_price() -> Weight { // Proof Size summary in bytes: // Measured: `516` - // Estimated: `8407` - // Minimum execution time: 22_777 nanoseconds. - Weight::from_parts(23_955_000, 0) - .saturating_add(Weight::from_parts(0, 8407)) + // Estimated: `11377` + // Minimum execution time: 26_202_000 picoseconds. + Weight::from_parts(26_499_000, 11377) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -670,37 +631,33 @@ impl WeightInfo for SubstrateWeight { /// Storage: Nfts ItemPriceOf (r:1 w:1) /// Proof: Nfts ItemPriceOf (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:0) /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Nfts Account (r:0 w:2) /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) /// Storage: Nfts PendingSwapOf (r:0 w:1) /// Proof: Nfts PendingSwapOf (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen) fn buy_item() -> Weight { // Proof Size summary in bytes: - // Measured: `934` - // Estimated: `16129` - // Minimum execution time: 61_131 nanoseconds. - Weight::from_parts(62_791_000, 0) - .saturating_add(Weight::from_parts(0, 16129)) - .saturating_add(T::DbWeight::get().reads(6_u64)) - .saturating_add(T::DbWeight::get().writes(6_u64)) + // Measured: `767` + // Estimated: `18480` + // Minimum execution time: 50_601_000 picoseconds. + Weight::from_parts(51_283_000, 18480) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } /// The range of component `n` is `[0, 10]`. fn pay_tips(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_952 nanoseconds. - Weight::from_parts(3_975_700, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 11_254 - .saturating_add(Weight::from_parts(3_501_698, 0).saturating_mul(n.into())) + // Minimum execution time: 2_733_000 picoseconds. + Weight::from_parts(5_568_590, 0) + // Standard Error: 14_136 + .saturating_add(Weight::from_parts(3_763_928, 0).saturating_mul(n.into())) } /// Storage: Nfts Item (r:2 w:0) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) @@ -709,10 +666,9 @@ impl WeightInfo for SubstrateWeight { fn create_swap() -> Weight { // Proof Size summary in bytes: // Measured: `524` - // Estimated: `6672` - // Minimum execution time: 20_327 nanoseconds. - Weight::from_parts(21_714_000, 0) - .saturating_add(Weight::from_parts(0, 6672)) + // Estimated: `7662` + // Minimum execution time: 22_901_000 picoseconds. + Weight::from_parts(23_673_000, 7662) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -723,10 +679,9 @@ impl WeightInfo for SubstrateWeight { fn cancel_swap() -> Weight { // Proof Size summary in bytes: // Measured: `511` - // Estimated: `5882` - // Minimum execution time: 20_668 nanoseconds. - Weight::from_parts(21_416_000, 0) - .saturating_add(Weight::from_parts(0, 5882)) + // Estimated: `7862` + // Minimum execution time: 22_532_000 picoseconds. + Weight::from_parts(22_831_000, 7862) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -735,29 +690,28 @@ impl WeightInfo for SubstrateWeight { /// Storage: Nfts PendingSwapOf (r:1 w:2) /// Proof: Nfts PendingSwapOf (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:2 w:0) /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Nfts Account (r:0 w:4) /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) /// Storage: Nfts ItemPriceOf (r:0 w:2) /// Proof: Nfts ItemPriceOf (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen) fn claim_swap() -> Weight { // Proof Size summary in bytes: - // Measured: `1097` - // Estimated: `21970` - // Minimum execution time: 88_006 nanoseconds. - Weight::from_parts(90_390_000, 0) - .saturating_add(Weight::from_parts(0, 21970)) - .saturating_add(T::DbWeight::get().reads(8_u64)) - .saturating_add(T::DbWeight::get().writes(11_u64)) + // Measured: `896` + // Estimated: `24321` + // Minimum execution time: 77_668_000 picoseconds. + Weight::from_parts(78_407_000, 24321) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(10_u64)) } /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:2 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts Item (r:1 w:1) @@ -775,14 +729,13 @@ impl WeightInfo for SubstrateWeight { /// The range of component `n` is `[0, 10]`. fn mint_pre_signed(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `596` - // Estimated: `16180 + n * (2921 ±0)` - // Minimum execution time: 124_967 nanoseconds. - Weight::from_parts(131_602_642, 0) - .saturating_add(Weight::from_parts(0, 16180)) - // Standard Error: 36_480 - .saturating_add(Weight::from_parts(25_811_394, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(6_u64)) + // Measured: `659` + // Estimated: `29192 + n * (2921 ±0)` + // Minimum execution time: 133_147_000 picoseconds. + Weight::from_parts(138_031_439, 29192) + // Standard Error: 28_665 + .saturating_add(Weight::from_parts(28_206_062, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(6_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -792,10 +745,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) /// Storage: Nfts ItemAttributesApprovalsOf (r:1 w:1) /// Proof: Nfts ItemAttributesApprovalsOf (max_values: None, max_size: Some(681), added: 3156, mode: MaxEncodedLen) - /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts Attribute (r:10 w:10) /// Proof: Nfts Attribute (max_values: None, max_size: Some(446), added: 2921, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) @@ -803,13 +756,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `n` is `[0, 10]`. fn set_attributes_pre_signed(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `716` - // Estimated: `14198 + n * (2921 ±0)` - // Minimum execution time: 84_153 nanoseconds. - Weight::from_parts(96_401_623, 0) - .saturating_add(Weight::from_parts(0, 14198)) - // Standard Error: 70_244 - .saturating_add(Weight::from_parts(26_866_222, 0).saturating_mul(n.into())) + // Measured: `721` + // Estimated: `20142 + n * (2921 ±0)` + // Minimum execution time: 78_243_000 picoseconds. + Weight::from_parts(90_947_408, 20142) + // Standard Error: 75_516 + .saturating_add(Weight::from_parts(28_059_623, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -823,7 +775,7 @@ impl WeightInfo for () { /// Storage: Nfts NextCollectionId (r:1 w:1) /// Proof: Nfts NextCollectionId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionRoleOf (r:0 w:1) /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:0 w:1) @@ -833,17 +785,16 @@ impl WeightInfo for () { fn create() -> Weight { // Proof Size summary in bytes: // Measured: `214` - // Estimated: `3054` - // Minimum execution time: 33_769 nanoseconds. - Weight::from_parts(36_031_000, 0) - .saturating_add(Weight::from_parts(0, 3054)) + // Estimated: `5038` + // Minimum execution time: 37_598_000 picoseconds. + Weight::from_parts(38_703_000, 5038) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: Nfts NextCollectionId (r:1 w:1) /// Proof: Nfts NextCollectionId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionRoleOf (r:0 w:1) /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:0 w:1) @@ -853,54 +804,45 @@ impl WeightInfo for () { fn force_create() -> Weight { // Proof Size summary in bytes: // Measured: `42` - // Estimated: `3054` - // Minimum execution time: 21_767 nanoseconds. - Weight::from_parts(22_565_000, 0) - .saturating_add(Weight::from_parts(0, 3054)) + // Estimated: `5038` + // Minimum execution time: 25_899_000 picoseconds. + Weight::from_parts(26_385_000, 5038) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) - /// Storage: Nfts Item (r:1001 w:1000) - /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) - /// Storage: Nfts ItemMetadataOf (r:1001 w:1000) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts ItemMetadataOf (r:1 w:0) /// Proof: Nfts ItemMetadataOf (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:1 w:1) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts Attribute (r:1001 w:1000) /// Proof: Nfts Attribute (max_values: None, max_size: Some(446), added: 2921, mode: MaxEncodedLen) - /// Storage: Nfts CollectionRoleOf (r:0 w:1) - /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1000 w:1000) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) /// Storage: Nfts CollectionMetadataOf (r:0 w:1) /// Proof: Nfts CollectionMetadataOf (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:0 w:1) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) - /// Storage: Nfts ItemConfigOf (r:0 w:1000) - /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) - /// Storage: Nfts Account (r:0 w:1000) - /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) /// Storage: Nfts CollectionAccount (r:0 w:1) /// Proof: Nfts CollectionAccount (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - /// The range of component `n` is `[0, 1000]`. /// The range of component `m` is `[0, 1000]`. + /// The range of component `c` is `[0, 1000]`. /// The range of component `a` is `[0, 1000]`. - fn destroy(_n: u32, m: u32, a: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `172781 + m * (127 ±0) + a * (402 ±0)` - // Estimated: `3347427 + m * (2615 ±0) + a * (2921 ±0)` - // Minimum execution time: 26_973_627 nanoseconds. - Weight::from_parts(19_692_361_714, 0) - .saturating_add(Weight::from_parts(0, 3347427)) - // Standard Error: 17_036 - .saturating_add(Weight::from_parts(7_797_219, 0).saturating_mul(m.into())) - // Standard Error: 17_036 - .saturating_add(Weight::from_parts(9_504_128, 0).saturating_mul(a.into())) + fn destroy(m: u32, _c: u32, a: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `32218 + a * (364 ±0)` + // Estimated: `2538589 + a * (2921 ±0)` + // Minimum execution time: 1_129_980_000 picoseconds. + Weight::from_parts(1_096_213_543, 2538589) + // Standard Error: 5_210 + .saturating_add(Weight::from_parts(92, 0).saturating_mul(m.into())) + // Standard Error: 5_210 + .saturating_add(Weight::from_parts(5_480_550, 0).saturating_mul(a.into())) .saturating_add(RocksDbWeight::get().reads(1004_u64)) - .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(m.into()))) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(a.into()))) - .saturating_add(RocksDbWeight::get().writes(3005_u64)) - .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(m.into()))) + .saturating_add(RocksDbWeight::get().writes(1005_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(a.into()))) - .saturating_add(Weight::from_parts(0, 2615).saturating_mul(m.into())) .saturating_add(Weight::from_parts(0, 2921).saturating_mul(a.into())) } /// Storage: Nfts CollectionConfigOf (r:1 w:0) @@ -908,7 +850,7 @@ impl WeightInfo for () { /// Storage: Nfts Item (r:1 w:1) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionRoleOf (r:1 w:0) /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:1) @@ -917,11 +859,10 @@ impl WeightInfo for () { /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) fn mint() -> Weight { // Proof Size summary in bytes: - // Measured: `448` - // Estimated: `13506` - // Minimum execution time: 44_837 nanoseconds. - Weight::from_parts(46_794_000, 0) - .saturating_add(Weight::from_parts(0, 13506)) + // Measured: `453` + // Estimated: `18460` + // Minimum execution time: 49_434_000 picoseconds. + Weight::from_parts(50_248_000, 18460) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -930,7 +871,7 @@ impl WeightInfo for () { /// Storage: Nfts Item (r:1 w:1) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:1) @@ -939,22 +880,19 @@ impl WeightInfo for () { /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) fn force_mint() -> Weight { // Proof Size summary in bytes: - // Measured: `448` - // Estimated: `13506` - // Minimum execution time: 43_976 nanoseconds. - Weight::from_parts(44_831_000, 0) - .saturating_add(Weight::from_parts(0, 13506)) + // Measured: `453` + // Estimated: `18460` + // Minimum execution time: 47_393_000 picoseconds. + Weight::from_parts(47_906_000, 18460) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// Storage: Nfts ItemConfigOf (r:1 w:1) /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts Item (r:1 w:1) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) - /// Storage: Nfts CollectionRoleOf (r:1 w:0) - /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts ItemMetadataOf (r:1 w:0) /// Proof: Nfts ItemMetadataOf (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) /// Storage: Nfts Account (r:0 w:1) @@ -967,26 +905,21 @@ impl WeightInfo for () { /// Proof: Nfts PendingSwapOf (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen) fn burn() -> Weight { // Proof Size summary in bytes: - // Measured: `647` - // Estimated: `13573` - // Minimum execution time: 48_233 nanoseconds. - Weight::from_parts(50_113_000, 0) - .saturating_add(Weight::from_parts(0, 13573)) - .saturating_add(RocksDbWeight::get().reads(5_u64)) + // Measured: `594` + // Estimated: `14993` + // Minimum execution time: 47_188_000 picoseconds. + Weight::from_parts(47_746_000, 14993) + .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:0) /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) /// Storage: Nfts Item (r:1 w:1) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) - /// Storage: Nfts CollectionRoleOf (r:1 w:0) - /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Nfts Account (r:0 w:2) /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) /// Storage: Nfts ItemPriceOf (r:0 w:1) @@ -995,16 +928,15 @@ impl WeightInfo for () { /// Proof: Nfts PendingSwapOf (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen) fn transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `882` - // Estimated: `16109` - // Minimum execution time: 55_452 nanoseconds. - Weight::from_parts(57_642_000, 0) - .saturating_add(Weight::from_parts(0, 16109)) - .saturating_add(RocksDbWeight::get().reads(6_u64)) - .saturating_add(RocksDbWeight::get().writes(6_u64)) + // Measured: `623` + // Estimated: `14926` + // Minimum execution time: 37_984_000 picoseconds. + Weight::from_parts(38_446_000, 14926) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts Item (r:5000 w:5000) @@ -1012,13 +944,12 @@ impl WeightInfo for () { /// The range of component `i` is `[0, 5000]`. fn redeposit(i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `756 + i * (140 ±0)` - // Estimated: `5103 + i * (3336 ±0)` - // Minimum execution time: 15_598 nanoseconds. - Weight::from_parts(15_926_000, 0) - .saturating_add(Weight::from_parts(0, 5103)) - // Standard Error: 13_692 - .saturating_add(Weight::from_parts(14_040_741, 0).saturating_mul(i.into())) + // Measured: `761 + i * (140 ±0)` + // Estimated: `8077 + i * (3336 ±0)` + // Minimum execution time: 17_297_000 picoseconds. + Weight::from_parts(17_634_000, 8077) + // Standard Error: 17_773 + .saturating_add(Weight::from_parts(14_395_819, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(i.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) @@ -1031,10 +962,9 @@ impl WeightInfo for () { fn lock_item_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `401` - // Estimated: `5067` - // Minimum execution time: 19_686 nanoseconds. - Weight::from_parts(20_404_000, 0) - .saturating_add(Weight::from_parts(0, 5067)) + // Estimated: `7047` + // Minimum execution time: 21_827_000 picoseconds. + Weight::from_parts(22_134_000, 7047) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1045,101 +975,96 @@ impl WeightInfo for () { fn unlock_item_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `401` - // Estimated: `5067` - // Minimum execution time: 19_172 nanoseconds. - Weight::from_parts(20_151_000, 0) - .saturating_add(Weight::from_parts(0, 5067)) + // Estimated: `7047` + // Minimum execution time: 21_549_000 picoseconds. + Weight::from_parts(21_987_000, 7047) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } - /// Storage: Nfts CollectionRoleOf (r:1 w:0) - /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:0) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:1) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) fn lock_collection() -> Weight { // Proof Size summary in bytes: - // Measured: `289` - // Estimated: `5092` - // Minimum execution time: 17_063 nanoseconds. - Weight::from_parts(17_482_000, 0) - .saturating_add(Weight::from_parts(0, 5092)) + // Measured: `338` + // Estimated: `7087` + // Minimum execution time: 18_930_000 picoseconds. + Weight::from_parts(19_200_000, 7087) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Nfts OwnershipAcceptance (r:1 w:1) /// Proof: Nfts OwnershipAcceptance (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionAccount (r:0 w:2) /// Proof: Nfts CollectionAccount (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) fn transfer_ownership() -> Weight { // Proof Size summary in bytes: - // Measured: `381` - // Estimated: `5082` - // Minimum execution time: 21_974 nanoseconds. - Weight::from_parts(22_770_000, 0) - .saturating_add(Weight::from_parts(0, 5082)) + // Measured: `386` + // Estimated: `7066` + // Minimum execution time: 24_929_000 picoseconds. + Weight::from_parts(25_786_000, 7066) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) - /// Storage: Nfts CollectionRoleOf (r:0 w:4) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:1 w:4) /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) fn set_team() -> Weight { // Proof Size summary in bytes: - // Measured: `362` - // Estimated: `2555` - // Minimum execution time: 24_341 nanoseconds. - Weight::from_parts(25_059_000, 0) - .saturating_add(Weight::from_parts(0, 2555)) - .saturating_add(RocksDbWeight::get().reads(1_u64)) + // Measured: `367` + // Estimated: `7083` + // Minimum execution time: 28_245_000 picoseconds. + Weight::from_parts(28_490_000, 7083) + .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionAccount (r:0 w:2) /// Proof: Nfts CollectionAccount (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) fn force_collection_owner() -> Weight { // Proof Size summary in bytes: - // Measured: `304` - // Estimated: `2555` - // Minimum execution time: 16_897 nanoseconds. - Weight::from_parts(17_560_000, 0) - .saturating_add(Weight::from_parts(0, 2555)) + // Measured: `309` + // Estimated: `3549` + // Minimum execution time: 19_971_000 picoseconds. + Weight::from_parts(20_276_000, 3549) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:0 w:1) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) fn force_collection_config() -> Weight { // Proof Size summary in bytes: // Measured: `242` - // Estimated: `2555` - // Minimum execution time: 13_239 nanoseconds. - Weight::from_parts(13_963_000, 0) - .saturating_add(Weight::from_parts(0, 2555)) + // Estimated: `3549` + // Minimum execution time: 15_924_000 picoseconds. + Weight::from_parts(16_258_000, 3549) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } - /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:1) /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) fn lock_item_properties() -> Weight { // Proof Size summary in bytes: - // Measured: `445` - // Estimated: `5078` - // Minimum execution time: 17_187 nanoseconds. - Weight::from_parts(17_942_000, 0) - .saturating_add(Weight::from_parts(0, 5078)) + // Measured: `401` + // Estimated: `7047` + // Minimum execution time: 20_780_000 picoseconds. + Weight::from_parts(21_109_000, 7047) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:0) @@ -1148,42 +1073,41 @@ impl WeightInfo for () { /// Proof: Nfts Attribute (max_values: None, max_size: Some(446), added: 2921, mode: MaxEncodedLen) fn set_attribute() -> Weight { // Proof Size summary in bytes: - // Measured: `474` - // Estimated: `10547` - // Minimum execution time: 40_925 nanoseconds. - Weight::from_parts(42_733_000, 0) - .saturating_add(Weight::from_parts(0, 10547)) - .saturating_add(RocksDbWeight::get().reads(4_u64)) + // Measured: `537` + // Estimated: `18045` + // Minimum execution time: 50_817_000 picoseconds. + Weight::from_parts(51_585_000, 18045) + .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts Attribute (r:1 w:1) /// Proof: Nfts Attribute (max_values: None, max_size: Some(446), added: 2921, mode: MaxEncodedLen) fn force_set_attribute() -> Weight { // Proof Size summary in bytes: - // Measured: `337` - // Estimated: `5476` - // Minimum execution time: 24_486 nanoseconds. - Weight::from_parts(25_409_000, 0) - .saturating_add(Weight::from_parts(0, 5476)) + // Measured: `342` + // Estimated: `7460` + // Minimum execution time: 28_821_000 picoseconds. + Weight::from_parts(29_417_000, 7460) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: Nfts Attribute (r:1 w:1) /// Proof: Nfts Attribute (max_values: None, max_size: Some(446), added: 2921, mode: MaxEncodedLen) - /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:0) /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) fn clear_attribute() -> Weight { // Proof Size summary in bytes: - // Measured: `916` - // Estimated: `7999` - // Minimum execution time: 36_643 nanoseconds. - Weight::from_parts(37_805_000, 0) - .saturating_add(Weight::from_parts(0, 7999)) - .saturating_add(RocksDbWeight::get().reads(3_u64)) + // Measured: `979` + // Estimated: `14507` + // Minimum execution time: 47_021_000 picoseconds. + Weight::from_parts(47_509_000, 14507) + .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: Nfts Item (r:1 w:0) @@ -1193,10 +1117,9 @@ impl WeightInfo for () { fn approve_item_attributes() -> Weight { // Proof Size summary in bytes: // Measured: `379` - // Estimated: `6492` - // Minimum execution time: 16_798 nanoseconds. - Weight::from_parts(17_326_000, 0) - .saturating_add(Weight::from_parts(0, 6492)) + // Estimated: `8472` + // Minimum execution time: 19_457_000 picoseconds. + Weight::from_parts(19_738_000, 8472) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1212,20 +1135,21 @@ impl WeightInfo for () { fn cancel_item_attributes_approval(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `899 + n * (396 ±0)` - // Estimated: `12016 + n * (2921 ±0)` - // Minimum execution time: 25_524 nanoseconds. - Weight::from_parts(26_107_000, 0) - .saturating_add(Weight::from_parts(0, 12016)) - // Standard Error: 5_460 - .saturating_add(Weight::from_parts(9_030_830, 0).saturating_mul(n.into())) + // Estimated: `15976 + n * (2921 ±0)` + // Minimum execution time: 29_027_000 picoseconds. + Weight::from_parts(29_376_000, 15976) + // Standard Error: 3_500 + .saturating_add(Weight::from_parts(5_568_116, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 2921).saturating_mul(n.into())) } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:0) /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) @@ -1234,104 +1158,97 @@ impl WeightInfo for () { /// Proof: Nfts ItemMetadataOf (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) fn set_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `474` - // Estimated: `10241` - // Minimum execution time: 34_400 nanoseconds. - Weight::from_parts(35_469_000, 0) - .saturating_add(Weight::from_parts(0, 10241)) - .saturating_add(RocksDbWeight::get().reads(4_u64)) + // Measured: `537` + // Estimated: `17739` + // Minimum execution time: 41_658_000 picoseconds. + Weight::from_parts(42_241_000, 17739) + .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts ItemMetadataOf (r:1 w:1) /// Proof: Nfts ItemMetadataOf (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:0) /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) fn clear_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `609` - // Estimated: `7693` - // Minimum execution time: 31_560 nanoseconds. - Weight::from_parts(33_081_000, 0) - .saturating_add(Weight::from_parts(0, 7693)) - .saturating_add(RocksDbWeight::get().reads(3_u64)) + // Measured: `672` + // Estimated: `14201` + // Minimum execution time: 39_838_000 picoseconds. + Weight::from_parts(40_757_000, 14201) + .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionMetadataOf (r:1 w:1) /// Proof: Nfts CollectionMetadataOf (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) fn set_collection_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `333` - // Estimated: `7665` - // Minimum execution time: 28_821 nanoseconds. - Weight::from_parts(30_010_000, 0) - .saturating_add(Weight::from_parts(0, 7665)) - .saturating_add(RocksDbWeight::get().reads(3_u64)) + // Measured: `396` + // Estimated: `14173` + // Minimum execution time: 37_327_000 picoseconds. + Weight::from_parts(37_874_000, 14173) + .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts CollectionMetadataOf (r:1 w:1) /// Proof: Nfts CollectionMetadataOf (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) fn clear_collection_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `476` - // Estimated: `7665` - // Minimum execution time: 27_608 nanoseconds. - Weight::from_parts(28_766_000, 0) - .saturating_add(Weight::from_parts(0, 7665)) - .saturating_add(RocksDbWeight::get().reads(3_u64)) + // Measured: `539` + // Estimated: `14173` + // Minimum execution time: 35_305_000 picoseconds. + Weight::from_parts(36_213_000, 14173) + .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Nfts Item (r:1 w:1) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) - /// Storage: Nfts CollectionRoleOf (r:1 w:0) - /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) fn approve_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `466` - // Estimated: `8428` - // Minimum execution time: 23_987 nanoseconds. - Weight::from_parts(24_819_000, 0) - .saturating_add(Weight::from_parts(0, 8428)) - .saturating_add(RocksDbWeight::get().reads(3_u64)) + // Measured: `408` + // Estimated: `7864` + // Minimum execution time: 22_680_000 picoseconds. + Weight::from_parts(23_126_000, 7864) + .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Nfts Item (r:1 w:1) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) - /// Storage: Nfts CollectionRoleOf (r:1 w:0) - /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) fn cancel_approval() -> Weight { // Proof Size summary in bytes: - // Measured: `474` - // Estimated: `5880` - // Minimum execution time: 21_254 nanoseconds. - Weight::from_parts(21_826_000, 0) - .saturating_add(Weight::from_parts(0, 5880)) - .saturating_add(RocksDbWeight::get().reads(2_u64)) + // Measured: `416` + // Estimated: `4326` + // Minimum execution time: 19_837_000 picoseconds. + Weight::from_parts(20_352_000, 4326) + .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Nfts Item (r:1 w:1) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) - /// Storage: Nfts CollectionRoleOf (r:1 w:0) - /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) fn clear_all_transfer_approvals() -> Weight { // Proof Size summary in bytes: - // Measured: `474` - // Estimated: `5880` - // Minimum execution time: 20_272 nanoseconds. - Weight::from_parts(20_922_000, 0) - .saturating_add(Weight::from_parts(0, 5880)) - .saturating_add(RocksDbWeight::get().reads(2_u64)) + // Measured: `416` + // Estimated: `4326` + // Minimum execution time: 18_911_000 picoseconds. + Weight::from_parts(19_233_000, 4326) + .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Nfts OwnershipAcceptance (r:1 w:1) @@ -1339,38 +1256,35 @@ impl WeightInfo for () { fn set_accept_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `42` - // Estimated: `2527` - // Minimum execution time: 14_287 nanoseconds. - Weight::from_parts(14_960_000, 0) - .saturating_add(Weight::from_parts(0, 2527)) + // Estimated: `3517` + // Minimum execution time: 17_292_000 picoseconds. + Weight::from_parts(17_568_000, 3517) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Nfts CollectionConfigOf (r:1 w:1) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) fn set_collection_max_supply() -> Weight { // Proof Size summary in bytes: - // Measured: `333` - // Estimated: `5103` - // Minimum execution time: 17_948 nanoseconds. - Weight::from_parts(18_780_000, 0) - .saturating_add(Weight::from_parts(0, 5103)) + // Measured: `338` + // Estimated: `7087` + // Minimum execution time: 20_323_000 picoseconds. + Weight::from_parts(20_692_000, 7087) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } - /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:1) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) fn update_mint_settings() -> Weight { // Proof Size summary in bytes: - // Measured: `333` - // Estimated: `5103` - // Minimum execution time: 16_616 nanoseconds. - Weight::from_parts(17_155_000, 0) - .saturating_add(Weight::from_parts(0, 5103)) + // Measured: `289` + // Estimated: `7072` + // Minimum execution time: 19_971_000 picoseconds. + Weight::from_parts(20_159_000, 7072) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1385,10 +1299,9 @@ impl WeightInfo for () { fn set_price() -> Weight { // Proof Size summary in bytes: // Measured: `516` - // Estimated: `8407` - // Minimum execution time: 22_777 nanoseconds. - Weight::from_parts(23_955_000, 0) - .saturating_add(Weight::from_parts(0, 8407)) + // Estimated: `11377` + // Minimum execution time: 26_202_000 picoseconds. + Weight::from_parts(26_499_000, 11377) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1397,37 +1310,33 @@ impl WeightInfo for () { /// Storage: Nfts ItemPriceOf (r:1 w:1) /// Proof: Nfts ItemPriceOf (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:1 w:0) /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Nfts Account (r:0 w:2) /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) /// Storage: Nfts PendingSwapOf (r:0 w:1) /// Proof: Nfts PendingSwapOf (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen) fn buy_item() -> Weight { // Proof Size summary in bytes: - // Measured: `934` - // Estimated: `16129` - // Minimum execution time: 61_131 nanoseconds. - Weight::from_parts(62_791_000, 0) - .saturating_add(Weight::from_parts(0, 16129)) - .saturating_add(RocksDbWeight::get().reads(6_u64)) - .saturating_add(RocksDbWeight::get().writes(6_u64)) + // Measured: `767` + // Estimated: `18480` + // Minimum execution time: 50_601_000 picoseconds. + Weight::from_parts(51_283_000, 18480) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// The range of component `n` is `[0, 10]`. fn pay_tips(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_952 nanoseconds. - Weight::from_parts(3_975_700, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 11_254 - .saturating_add(Weight::from_parts(3_501_698, 0).saturating_mul(n.into())) + // Minimum execution time: 2_733_000 picoseconds. + Weight::from_parts(5_568_590, 0) + // Standard Error: 14_136 + .saturating_add(Weight::from_parts(3_763_928, 0).saturating_mul(n.into())) } /// Storage: Nfts Item (r:2 w:0) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) @@ -1436,10 +1345,9 @@ impl WeightInfo for () { fn create_swap() -> Weight { // Proof Size summary in bytes: // Measured: `524` - // Estimated: `6672` - // Minimum execution time: 20_327 nanoseconds. - Weight::from_parts(21_714_000, 0) - .saturating_add(Weight::from_parts(0, 6672)) + // Estimated: `7662` + // Minimum execution time: 22_901_000 picoseconds. + Weight::from_parts(23_673_000, 7662) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1450,10 +1358,9 @@ impl WeightInfo for () { fn cancel_swap() -> Weight { // Proof Size summary in bytes: // Measured: `511` - // Estimated: `5882` - // Minimum execution time: 20_668 nanoseconds. - Weight::from_parts(21_416_000, 0) - .saturating_add(Weight::from_parts(0, 5882)) + // Estimated: `7862` + // Minimum execution time: 22_532_000 picoseconds. + Weight::from_parts(22_831_000, 7862) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1462,29 +1369,28 @@ impl WeightInfo for () { /// Storage: Nfts PendingSwapOf (r:1 w:2) /// Proof: Nfts PendingSwapOf (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen) /// Storage: Nfts Collection (r:1 w:0) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts ItemConfigOf (r:2 w:0) /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Nfts Account (r:0 w:4) /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) /// Storage: Nfts ItemPriceOf (r:0 w:2) /// Proof: Nfts ItemPriceOf (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen) fn claim_swap() -> Weight { // Proof Size summary in bytes: - // Measured: `1097` - // Estimated: `21970` - // Minimum execution time: 88_006 nanoseconds. - Weight::from_parts(90_390_000, 0) - .saturating_add(Weight::from_parts(0, 21970)) - .saturating_add(RocksDbWeight::get().reads(8_u64)) - .saturating_add(RocksDbWeight::get().writes(11_u64)) + // Measured: `896` + // Estimated: `24321` + // Minimum execution time: 77_668_000 picoseconds. + Weight::from_parts(78_407_000, 24321) + .saturating_add(RocksDbWeight::get().reads(7_u64)) + .saturating_add(RocksDbWeight::get().writes(10_u64)) } /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:2 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Nfts Item (r:1 w:1) @@ -1502,14 +1408,13 @@ impl WeightInfo for () { /// The range of component `n` is `[0, 10]`. fn mint_pre_signed(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `596` - // Estimated: `16180 + n * (2921 ±0)` - // Minimum execution time: 124_967 nanoseconds. - Weight::from_parts(131_602_642, 0) - .saturating_add(Weight::from_parts(0, 16180)) - // Standard Error: 36_480 - .saturating_add(Weight::from_parts(25_811_394, 0).saturating_mul(n.into())) - .saturating_add(RocksDbWeight::get().reads(6_u64)) + // Measured: `659` + // Estimated: `29192 + n * (2921 ±0)` + // Minimum execution time: 133_147_000 picoseconds. + Weight::from_parts(138_031_439, 29192) + // Standard Error: 28_665 + .saturating_add(Weight::from_parts(28_206_062, 0).saturating_mul(n.into())) + .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(6_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -1519,10 +1424,10 @@ impl WeightInfo for () { /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) /// Storage: Nfts ItemAttributesApprovalsOf (r:1 w:1) /// Proof: Nfts ItemAttributesApprovalsOf (max_values: None, max_size: Some(681), added: 3156, mode: MaxEncodedLen) - /// Storage: Nfts Collection (r:1 w:1) - /// Proof: Nfts Collection (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) /// Storage: Nfts CollectionConfigOf (r:1 w:0) /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) /// Storage: Nfts Attribute (r:10 w:10) /// Proof: Nfts Attribute (max_values: None, max_size: Some(446), added: 2921, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) @@ -1530,13 +1435,12 @@ impl WeightInfo for () { /// The range of component `n` is `[0, 10]`. fn set_attributes_pre_signed(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `716` - // Estimated: `14198 + n * (2921 ±0)` - // Minimum execution time: 84_153 nanoseconds. - Weight::from_parts(96_401_623, 0) - .saturating_add(Weight::from_parts(0, 14198)) - // Standard Error: 70_244 - .saturating_add(Weight::from_parts(26_866_222, 0).saturating_mul(n.into())) + // Measured: `721` + // Estimated: `20142 + n * (2921 ±0)` + // Minimum execution time: 78_243_000 picoseconds. + Weight::from_parts(90_947_408, 20142) + // Standard Error: 75_516 + .saturating_add(Weight::from_parts(28_059_623, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64))