diff --git a/pallets/nfts/src/benchmarking.rs b/pallets/nfts/src/benchmarking.rs index bfe961e8..33c7dc5c 100644 --- a/pallets/nfts/src/benchmarking.rs +++ b/pallets/nfts/src/benchmarking.rs @@ -274,6 +274,7 @@ benchmarks_instance_pallet! { mint { let (collection, caller, caller_lookup) = create_collection::(); let item = T::Helper::item(0); + T::Currency::make_free_balance_be(&caller, T::Currency::minimum_balance() + T::CollectionDeposit::get() + T::CollectionBalanceDeposit::get()); }: _(SystemOrigin::Signed(caller.clone()), collection, item, caller_lookup, None) verify { assert_last_event::(Event::Issued { collection, item, owner: caller }.into()); @@ -282,6 +283,7 @@ benchmarks_instance_pallet! { force_mint { let (collection, caller, caller_lookup) = create_collection::(); let item = T::Helper::item(0); + T::Currency::make_free_balance_be(&caller, T::Currency::minimum_balance() + T::CollectionDeposit::get() + T::CollectionBalanceDeposit::get()); }: _(SystemOrigin::Signed(caller.clone()), collection, item, caller_lookup, default_item_config()) verify { assert_last_event::(Event::Issued { collection, item, owner: caller }.into()); @@ -667,7 +669,7 @@ benchmarks_instance_pallet! { let price = ItemPrice::::from(0u32); let origin = SystemOrigin::Signed(seller.clone()).into(); Nfts::::set_price(origin, collection, item, Some(price), Some(buyer_lookup))?; - T::Currency::make_free_balance_be(&buyer, DepositBalanceOf::::max_value()); + T::Currency::make_free_balance_be(&buyer, T::Currency::minimum_balance() + price + T::CollectionBalanceDeposit::get()); }: _(SystemOrigin::Signed(buyer.clone()), collection, item, price) verify { assert_last_event::(Event::ItemBought { @@ -757,7 +759,7 @@ benchmarks_instance_pallet! { let duration = T::MaxDeadlineDuration::get(); let target: T::AccountId = account("target", 0, SEED); let target_lookup = T::Lookup::unlookup(target.clone()); - T::Currency::make_free_balance_be(&target, T::Currency::minimum_balance()); + T::Currency::make_free_balance_be(&target, T::Currency::minimum_balance() + T::CollectionBalanceDeposit::get()); let origin = SystemOrigin::Signed(caller.clone()); frame_system::Pallet::::set_block_number(One::one()); Nfts::::transfer(origin.clone().into(), collection, item2, target_lookup)?; diff --git a/pallets/nfts/src/common_functions.rs b/pallets/nfts/src/common_functions.rs index 38f6cfc8..f27a9029 100644 --- a/pallets/nfts/src/common_functions.rs +++ b/pallets/nfts/src/common_functions.rs @@ -19,7 +19,7 @@ use alloc::vec::Vec; -use frame_support::pallet_prelude::*; +use frame_support::{pallet_prelude::*, sp_runtime::ArithmeticError}; use crate::*; @@ -92,6 +92,52 @@ impl, I: 'static> Pallet { Self::deposit_event(Event::NextCollectionIdIncremented { next_id }); } + /// Increment the number of items in the `collection` owned by the `owner`. If no entry exists + /// for the `owner` in `AccountBalance`, create a new record and reserve `deposit_amount` from + /// the `deposit_account`. + pub(crate) fn increment_account_balance( + collection: T::CollectionId, + owner: &T::AccountId, + (deposit_account, deposit_amount): (&T::AccountId, DepositBalanceOf), + ) -> DispatchResult { + AccountBalance::::mutate(collection, owner, |maybe_balance| -> DispatchResult { + match maybe_balance { + None => { + T::Currency::reserve(deposit_account, deposit_amount)?; + *maybe_balance = Some((1, (deposit_account.clone(), deposit_amount))); + }, + Some((balance, _deposit)) => { + balance.saturating_inc(); + }, + } + Ok(()) + }) + } + + /// Decrement the number of `collection` items owned by the `owner`. If the `owner`'s item + /// count reaches zero after the reduction, remove the `AccountBalance` record and unreserve + /// the deposited funds. + pub(crate) fn decrement_account_balance( + collection: T::CollectionId, + owner: &T::AccountId, + ) -> DispatchResult { + AccountBalance::::try_mutate_exists( + collection, + owner, + |maybe_balance| -> DispatchResult { + let (balance, (deposit_account, deposit_amount)) = + maybe_balance.as_mut().ok_or(Error::::NoItemOwned)?; + + *balance = balance.checked_sub(1).ok_or(ArithmeticError::Underflow)?; + if balance.is_zero() { + T::Currency::unreserve(deposit_account, *deposit_amount); + *maybe_balance = None; + } + Ok(()) + }, + ) + } + #[allow(missing_docs)] #[cfg(any(test, feature = "runtime-benchmarks"))] pub fn set_next_id(id: T::CollectionId) { @@ -105,3 +151,87 @@ impl, I: 'static> Pallet { .expect("Failed to get next collection ID") } } + +#[cfg(test)] +mod tests { + use crate::{mock::*, tests::*, Currency, Error, ReservableCurrency}; + + #[test] + fn increment_account_balance_works() { + new_test_ext().execute_with(|| { + let collection_id = 0; + let deposit_account = account(1); + let deposit_amount = balance_deposit(); + let owner = account(2); + assert_noop!( + Nfts::increment_account_balance( + collection_id, + &owner, + (&deposit_account, deposit_amount) + ), + BalancesError::::InsufficientBalance + ); + Balances::make_free_balance_be(&deposit_account, 100); + // Initialize `AccountBalance` and increase the collection item count for the new + // account. + assert_ok!(Nfts::increment_account_balance( + collection_id, + &owner, + (&deposit_account, deposit_amount) + )); + assert_eq!(Balances::reserved_balance(&deposit_account), deposit_amount); + assert_eq!( + AccountBalance::get(collection_id, &owner), + Some((1, (deposit_account.clone(), deposit_amount))) + ); + // Increment the balance of a non-zero balance account. No additional reserves. + assert_ok!(Nfts::increment_account_balance( + collection_id, + &owner, + (&deposit_account, deposit_amount) + )); + assert_eq!(Balances::reserved_balance(&deposit_account), deposit_amount); + assert_eq!( + AccountBalance::get(collection_id, &owner), + Some((2, (deposit_account.clone(), deposit_amount))) + ); + }); + } + + #[test] + fn decrement_account_balance_works() { + new_test_ext().execute_with(|| { + let collection_id = 0; + let balance = 2u32; + let deposit_account = account(1); + let deposit_amount = balance_deposit(); + let owner = account(2); + + Balances::make_free_balance_be(&deposit_account, 100); + // Decrement non-existing `AccountBalance` record. + assert_noop!( + Nfts::decrement_account_balance(collection_id, &deposit_account), + Error::::NoItemOwned + ); + // Set account balance and reserve `DepositBalance`. + AccountBalance::insert( + collection_id, + &owner, + (&balance, (&deposit_account, deposit_amount)), + ); + Balances::reserve(&deposit_account, deposit_amount).expect("should work"); + // Successfully decrement the value of the `AccountBalance` entry. + assert_ok!(Nfts::decrement_account_balance(collection_id, &owner)); + assert_eq!( + AccountBalance::get(collection_id, &owner), + Some((balance - 1, (deposit_account.clone(), deposit_amount))) + ); + assert_eq!(Balances::reserved_balance(&deposit_account), deposit_amount); + // `AccountBalance` record is deleted, and the depositor's funds are unreserved if + // the `AccountBalance` value reaches zero after decrementing. + assert_ok!(Nfts::decrement_account_balance(collection_id, &owner)); + assert_eq!(Balances::reserved_balance(&deposit_account), 0); + assert!(!AccountBalance::contains_key(collection_id, &owner)); + }); + } +} diff --git a/pallets/nfts/src/features/approvals.rs b/pallets/nfts/src/features/approvals.rs index e40fb6e8..fd1e6ae4 100644 --- a/pallets/nfts/src/features/approvals.rs +++ b/pallets/nfts/src/features/approvals.rs @@ -216,7 +216,12 @@ impl, I: 'static> Pallet { Self::is_pallet_feature_enabled(PalletFeature::Approvals), Error::::MethodDisabled ); - ensure!(AccountBalance::::get(collection, &owner) > 0, Error::::NoItemOwned); + ensure!( + AccountBalance::::get(collection, &owner) + .filter(|(balance, _)| !balance.is_zero()) + .is_some(), + Error::::NoItemOwned + ); let collection_config = Self::get_collection_config(&collection)?; ensure!( diff --git a/pallets/nfts/src/features/atomic_swap.rs b/pallets/nfts/src/features/atomic_swap.rs index 75945d43..1ffd6dce 100644 --- a/pallets/nfts/src/features/atomic_swap.rs +++ b/pallets/nfts/src/features/atomic_swap.rs @@ -209,13 +209,20 @@ impl, I: 'static> Pallet { } // This also removes the swap. - Self::do_transfer(send_collection_id, send_item_id, receive_item.owner.clone(), |_, _| { - Ok(()) - })?; + Self::do_transfer( + send_collection_id, + send_item_id, + receive_item.owner.clone(), + Some(&receive_item.owner), + |_, _| Ok(()), + )?; + // Owner of `send_item` is responsible for the deposit if the collection balance + // went to zero due to the previous transfer. Self::do_transfer( receive_collection_id, receive_item_id, send_item.owner.clone(), + Some(&send_item.owner), |_, _| Ok(()), )?; diff --git a/pallets/nfts/src/features/buy_sell.rs b/pallets/nfts/src/features/buy_sell.rs index 476053ee..2b4d2967 100644 --- a/pallets/nfts/src/features/buy_sell.rs +++ b/pallets/nfts/src/features/buy_sell.rs @@ -158,7 +158,7 @@ impl, I: 'static> Pallet { let old_owner = details.owner.clone(); - Self::do_transfer(collection, item, buyer.clone(), |_, _| Ok(()))?; + Self::do_transfer(collection, item, buyer.clone(), Some(&buyer), |_, _| Ok(()))?; Self::deposit_event(Event::ItemBought { collection, diff --git a/pallets/nfts/src/features/create_delete_item.rs b/pallets/nfts/src/features/create_delete_item.rs index 0e51759c..5c687d42 100644 --- a/pallets/nfts/src/features/create_delete_item.rs +++ b/pallets/nfts/src/features/create_delete_item.rs @@ -18,7 +18,7 @@ //! This module contains helper methods to perform functionality associated with minting and burning //! items for the NFTs pallet. -use frame_support::{pallet_prelude::*, sp_runtime::ArithmeticError, traits::ExistenceRequirement}; +use frame_support::{pallet_prelude::*, traits::ExistenceRequirement}; use crate::*; @@ -68,20 +68,20 @@ impl, I: 'static> Pallet { collection_details.items.saturating_inc(); - AccountBalance::::mutate(collection, &mint_to, |balance| { - balance.saturating_inc(); - }); - let collection_config = Self::get_collection_config(&collection)?; - let deposit_amount = - match collection_config.is_setting_enabled(CollectionSetting::DepositRequired) { - true => T::ItemDeposit::get(), - false => Zero::zero(), - }; - let deposit_account = match maybe_depositor { - None => collection_details.owner.clone(), - Some(depositor) => depositor, - }; + let deposit_required = + collection_config.is_setting_enabled(CollectionSetting::DepositRequired); + let deposit_account = + maybe_depositor.unwrap_or_else(|| collection_details.owner.clone()); + + let balance_deposit = deposit_required + .then_some(T::CollectionBalanceDeposit::get()) + .unwrap_or_default(); + Self::increment_account_balance( + collection, + &mint_to, + (&deposit_account, balance_deposit), + )?; let item_owner = mint_to.clone(); Account::::insert((&item_owner, &collection, &item), ()); @@ -93,9 +93,11 @@ impl, I: 'static> Pallet { collection_details.item_configs.saturating_inc(); } - T::Currency::reserve(&deposit_account, deposit_amount)?; + let item_deposit = + deposit_required.then_some(T::ItemDeposit::get()).unwrap_or_default(); + T::Currency::reserve(&deposit_account, item_deposit)?; - let deposit = ItemDeposit { account: deposit_account, amount: deposit_amount }; + let deposit = ItemDeposit { account: deposit_account, amount: item_deposit }; let details = ItemDetails { owner: item_owner, approvals: ApprovalsOf::::default(), @@ -264,12 +266,7 @@ impl, I: 'static> Pallet { PendingSwapOf::::remove(collection, item); ItemAttributesApprovalsOf::::remove(collection, item); - let balance = AccountBalance::::take(collection, &owner) - .checked_sub(1) - .ok_or(ArithmeticError::Underflow)?; - if balance > 0 { - AccountBalance::::insert(collection, &owner, balance); - } + Self::decrement_account_balance(collection, &owner)?; if remove_config { ItemConfigOf::::remove(collection, item); diff --git a/pallets/nfts/src/features/transfer.rs b/pallets/nfts/src/features/transfer.rs index ffe0befe..9f5dc77b 100644 --- a/pallets/nfts/src/features/transfer.rs +++ b/pallets/nfts/src/features/transfer.rs @@ -28,6 +28,8 @@ impl, I: 'static> Pallet { /// - `collection`: The ID of the collection to which the NFT belongs. /// - `item`: The ID of the NFT to transfer. /// - `dest`: The destination account to which the NFT will be transferred. + /// - `depositor`: The account reserving the `CollectionBalanceDeposit` from if `dest` holds no + /// items in the collection. /// - `with_details`: A closure that provides access to the collection and item details, /// allowing customization of the transfer process. /// @@ -48,6 +50,7 @@ impl, I: 'static> Pallet { collection: T::CollectionId, item: T::ItemId, dest: T::AccountId, + depositor: Option<&T::AccountId>, with_details: impl FnOnce( &CollectionDetailsFor, &mut ItemDetailsFor, @@ -87,16 +90,18 @@ impl, I: 'static> Pallet { with_details(&collection_details, &mut details)?; // Update account balance of the owner. - let balance = AccountBalance::::take(collection, &details.owner) - .checked_sub(1) - .ok_or(Error::::NoItemOwned)?; - if balance > 0 { - AccountBalance::::insert(collection, &details.owner, balance); - } + Self::decrement_account_balance(collection, &details.owner)?; + + let deposit_amount = collection_config + .is_setting_enabled(CollectionSetting::DepositRequired) + .then_some(T::CollectionBalanceDeposit::get()) + .unwrap_or_default(); + // Reserve `CollectionBalanceDeposit` from the depositor if provided. Otherwise, reserve + // from the item's owner. + let deposit_account = depositor.unwrap_or(&details.owner); + // Update account balance of the destination account. - AccountBalance::::mutate(collection, &dest, |balance| { - balance.saturating_inc(); - }); + Self::increment_account_balance(collection, &dest, (deposit_account, deposit_amount))?; // Update account ownership information. Account::::remove((&details.owner, &collection, &item)); diff --git a/pallets/nfts/src/impl_nonfungibles.rs b/pallets/nfts/src/impl_nonfungibles.rs index b014e3ed..e8fa4457 100644 --- a/pallets/nfts/src/impl_nonfungibles.rs +++ b/pallets/nfts/src/impl_nonfungibles.rs @@ -411,7 +411,11 @@ impl, I: 'static> Transfer for Pallet { item: &Self::ItemId, destination: &T::AccountId, ) -> DispatchResult { - Self::do_transfer(*collection, *item, destination.clone(), |_, _| Ok(())) + // The item's owner pays for the deposit of `AccountBalance` if the `dest` holds no items + // in `collection`. If `dest` paid the deposit, a malicious actor could transfer NFTs to + // reserve involuntary deposits for `dest` . The deposit amount can be accounted for in the + // off chain price of the NFT. + Self::do_transfer(*collection, *item, destination.clone(), None, |_, _| Ok(())) } fn disable_transfer(collection: &Self::CollectionId, item: &Self::ItemId) -> DispatchResult { diff --git a/pallets/nfts/src/lib.rs b/pallets/nfts/src/lib.rs index 2851e826..ef1f5e5f 100644 --- a/pallets/nfts/src/lib.rs +++ b/pallets/nfts/src/lib.rs @@ -178,12 +178,6 @@ pub mod pallet { #[pallet::constant] type CollectionDeposit: Get>; - /// The basic amount of funds that must be reserved for a collection approval. - // Key: `sizeof((CollectionId, AccountId, AccountId))` bytes. - // Value: `sizeof((Option, Balance))` bytes. - #[pallet::constant] - type CollectionApprovalDeposit: Get>; - /// The basic amount of funds that must be reserved for an item. #[pallet::constant] type ItemDeposit: Get>; @@ -259,6 +253,18 @@ pub mod pallet { /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; + + /// The basic amount of funds that must be reserved for a collection approval. + // Key: `sizeof((CollectionId, AccountId, AccountId))` bytes. + // Value: `sizeof((Option, Balance))` bytes. + #[pallet::constant] + type CollectionApprovalDeposit: Get>; + + /// The basic amount of funds that must be reversed for an account's collection balance. + // Key: `sizeof((CollectionId, AccountId))` bytes. + // Value: `sizeof((u32, Some(AccountId, Balance)))` bytes. + #[pallet::constant] + type CollectionBalanceDeposit: Get>; } /// Details of a collection. @@ -435,8 +441,8 @@ pub mod pallet { T::CollectionId, Blake2_128Concat, T::AccountId, - u32, - ValueQuery, + // (Account's collection items, Deposit details). + (u32, AccountDepositOf), >; /// Permission for a delegate to transfer all owner's collection items. @@ -1086,7 +1092,11 @@ pub mod pallet { let origin = ensure_signed(origin)?; let dest = T::Lookup::lookup(dest)?; - Self::do_transfer(collection, item, dest, |_, details| { + // The item's owner pays for the deposit of `AccountBalance` if the `dest` holds no + // items in `collection`. A malicious actor could have a deposit reserved from `dest` + // without them knowing about the transfer. The deposit amount can be accounted for + // in the off chain price of the NFT. + Self::do_transfer(collection, item, dest, None, |_, details| { if details.owner != origin { Self::check_approval(&collection, &Some(item), &details.owner, &origin)?; } diff --git a/pallets/nfts/src/mock.rs b/pallets/nfts/src/mock.rs index c6e4211e..efd72722 100644 --- a/pallets/nfts/src/mock.rs +++ b/pallets/nfts/src/mock.rs @@ -66,6 +66,7 @@ impl Config for Test { type ApprovalsLimit = ConstU32<10>; type AttributeDepositBase = ConstU64<1>; type CollectionApprovalDeposit = ConstU64<1>; + type CollectionBalanceDeposit = ConstU64<1>; type CollectionDeposit = ConstU64<2>; type CollectionId = u32; type CreateOrigin = AsEnsureOriginWithArg>; diff --git a/pallets/nfts/src/tests.rs b/pallets/nfts/src/tests.rs index 5c78450d..fbf73ce3 100644 --- a/pallets/nfts/src/tests.rs +++ b/pallets/nfts/src/tests.rs @@ -18,7 +18,7 @@ //! Tests for Nfts pallet. use enumflags2::BitFlags; -use frame_support::{ +pub(crate) use frame_support::{ assert_noop, assert_ok, dispatch::WithPostDispatchInfo, traits::{ @@ -27,7 +27,7 @@ use frame_support::{ }, }; use frame_system::pallet_prelude::BlockNumberFor; -use pallet_balances::Error as BalancesError; +pub(crate) use pallet_balances::Error as BalancesError; use sp_core::{bounded::BoundedVec, Pair}; use sp_runtime::{ traits::{Dispatchable, IdentifyAccount}, @@ -38,19 +38,15 @@ use sp_runtime::{ use crate::{mock::*, Event, SystemConfig, *}; type AccountIdOf = ::AccountId; -type AccountBalance = crate::AccountBalance; +pub(crate) type AccountBalance = crate::AccountBalance; type CollectionApprovals = crate::CollectionApprovals; type CollectionApprovalDeposit = ::CollectionApprovalDeposit; type WeightOf = ::WeightInfo; -fn account(id: u8) -> AccountIdOf { +pub(crate) fn account(id: u8) -> AccountIdOf { [id; 32].into() } -fn root() -> RuntimeOrigin { - RuntimeOrigin::root() -} - fn none() -> RuntimeOrigin { RuntimeOrigin::none() } @@ -162,6 +158,14 @@ fn item_config_from_disabled_settings(settings: BitFlags) -> ItemCo ItemConfig { settings: ItemSettings::from_disabled(settings) } } +pub(crate) fn balance_deposit() -> DepositBalanceOf { + <::CollectionBalanceDeposit>::get() +} + +pub(crate) fn item_deposit() -> DepositBalanceOf { + <::ItemDeposit>::get() +} + #[test] fn basic_setup_works() { new_test_ext().execute_with(|| { @@ -195,6 +199,8 @@ fn basic_minting_should_work() { #[test] fn lifecycle_should_work() { new_test_ext().execute_with(|| { + let balance_deposit = balance_deposit(); + Balances::make_free_balance_be(&account(1), 100); Balances::make_free_balance_be(&account(2), 100); assert_ok!(Nfts::create( @@ -219,7 +225,7 @@ fn lifecycle_should_work() { account(10), default_item_config() )); - assert_eq!(Balances::reserved_balance(&account(1)), 6); + assert_eq!(Balances::reserved_balance(&account(1)), 6 + balance_deposit); assert_ok!(Nfts::force_mint( RuntimeOrigin::signed(account(1)), 0, @@ -227,23 +233,23 @@ fn lifecycle_should_work() { account(20), default_item_config() )); - assert_eq!(Balances::reserved_balance(&account(1)), 7); + assert_eq!(Balances::reserved_balance(&account(1)), 7 + 2 * balance_deposit); assert_ok!(Nfts::mint(RuntimeOrigin::signed(account(1)), 0, 70, account(1), None)); 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(1)), 8); + assert_eq!(Balances::reserved_balance(&account(1)), 8 + 3 * balance_deposit); assert_ok!(Nfts::transfer(RuntimeOrigin::signed(account(1)), 0, 70, account(2))); - assert_eq!(Balances::reserved_balance(&account(1)), 8); + assert_eq!(Balances::reserved_balance(&account(1)), 8 + 3 * balance_deposit); 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)), 11); + assert_eq!(Balances::reserved_balance(&account(1)), 11 + 3 * balance_deposit); 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)), 14); + assert_eq!(Balances::reserved_balance(&account(1)), 14 + 3 * balance_deposit); assert!(ItemMetadataOf::::contains_key(0, 69)); assert!(ItemConfigOf::::contains_key(0, 69)); let w = Nfts::get_destroy_witness(&0).unwrap(); @@ -525,33 +531,45 @@ fn mint_should_work() { #[test] fn mint_should_update_account_balance_works() { new_test_ext().execute_with(|| { + let balance_deposit = balance_deposit(); let collection_id = 0; - let owner = account(1); + let dest = account(1); + let owner = account(2); + Balances::make_free_balance_be(&owner, 100); assert_ok!(Nfts::force_create( RuntimeOrigin::root(), owner.clone(), - default_collection_config() + collection_config_with_all_settings_enabled() )); - assert_ok!(Nfts::mint( RuntimeOrigin::signed(owner.clone()), collection_id, 42, - owner.clone(), + dest.clone(), None )); - assert_eq!(AccountBalance::get(collection_id, &owner), 1); - - // Additive. + // Minting reserves a deposit because `dest` doesn't have an item in the collection yet and + // thus a storage item has to be created. + assert_eq!( + AccountBalance::get(collection_id, dest.clone()), + Some((1, (owner.clone(), balance_deposit))) + ); + assert_eq!(Balances::reserved_balance(&owner), item_deposit() + balance_deposit); assert_ok!(Nfts::mint( RuntimeOrigin::signed(owner.clone()), collection_id, 43, - owner.clone(), + dest.clone(), None )); - assert_eq!(AccountBalance::get(collection_id, &owner), 2); + // `dest` already has an item in the collection so no extra deposit is reserved. + assert_eq!( + AccountBalance::get(collection_id, &dest), + Some((2, (owner.clone(), balance_deposit))) + ); + assert_eq!(Balances::reserved_balance(&owner), (2 * item_deposit()) + balance_deposit); + assert_eq!(Balances::reserved_balance(&dest), 0); }); } @@ -615,15 +633,18 @@ fn transfer_should_work() { #[test] fn transfer_should_update_account_balance_works() { new_test_ext().execute_with(|| { + let balance_deposit = balance_deposit(); let collection_id = 0; - let dest = account(3); + let delegate = account(1); + let dest = account(2); let item_id = 42; - let owner = account(1); + let owner = account(3); + Balances::make_free_balance_be(&owner, 100); assert_ok!(Nfts::force_create( RuntimeOrigin::root(), owner.clone(), - default_collection_config() + collection_config_with_all_settings_enabled() )); assert_ok!(Nfts::force_mint( RuntimeOrigin::signed(owner.clone()), @@ -639,13 +660,45 @@ fn transfer_should_update_account_balance_works() { dest.clone() )); assert!(!AccountBalance::contains_key(collection_id, &owner)); - assert_eq!(AccountBalance::get(collection_id, &dest), 1); + assert_eq!( + AccountBalance::get(collection_id, &dest), + Some((1, (owner.clone(), balance_deposit))) + ); + // Reserve funds from `owner` when transferring to `dest`. + assert_eq!(Balances::reserved_balance(&owner), item_deposit() + balance_deposit); + assert_eq!(Balances::reserved_balance(&dest), 0); + + // Approve `delegate` for approved transfer case. + assert_ok!(Nfts::approve_transfer( + RuntimeOrigin::signed(dest.clone()), + collection_id, + item_id, + delegate.clone(), + None + )); + Balances::make_free_balance_be(&dest, Balances::minimum_balance() + balance_deposit); + assert_ok!(Nfts::transfer( + RuntimeOrigin::signed(delegate.clone()), + collection_id, + item_id, + owner.clone() + )); + assert_eq!( + AccountBalance::get(collection_id, &owner), + Some((1, (dest.clone(), balance_deposit))) + ); + // Reserve funds from `dest` during a delegated transfer initiated by the + // `delegate` back to `owner`. + assert_eq!(Balances::reserved_balance(&owner), item_deposit()); + assert_eq!(Balances::reserved_balance(&delegate), 0); + assert_eq!(Balances::reserved_balance(&dest), balance_deposit); }); } #[test] fn locking_transfer_should_work() { new_test_ext().execute_with(|| { + Balances::make_free_balance_be(&account(1), 100); assert_ok!(Nfts::force_create( RuntimeOrigin::root(), account(1), @@ -732,6 +785,8 @@ fn origin_guards_should_work() { #[test] fn transfer_owner_should_work() { new_test_ext().execute_with(|| { + let balance_deposit = balance_deposit(); + Balances::make_free_balance_be(&account(1), 100); Balances::make_free_balance_be(&account(2), 100); Balances::make_free_balance_be(&account(3), 100); @@ -772,7 +827,7 @@ fn transfer_owner_should_work() { 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_eq!(Balances::reserved_balance(&account(1)), 1 + balance_deposit); 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))); @@ -783,8 +838,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))); - // reserved_balance of accounts 1 & 2 should be unchanged: - assert_eq!(Balances::reserved_balance(&account(1)), 1); + // The reserved balance of account 1 is incremented to create a new storage record for the + // account 2. + assert_eq!(Balances::reserved_balance(&account(1)), 1 + balance_deposit); 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 @@ -960,6 +1016,8 @@ fn set_collection_metadata_should_work() { #[test] fn set_item_metadata_should_work() { new_test_ext().execute_with(|| { + let balance_deposit = balance_deposit(); + Balances::make_free_balance_be(&account(1), 30); // Cannot add metadata to unknown item @@ -977,7 +1035,7 @@ fn set_item_metadata_should_work() { // Successfully add metadata and take deposit assert_ok!(Nfts::set_metadata(RuntimeOrigin::signed(account(1)), 0, 42, bvec![0u8; 20])); - assert_eq!(Balances::free_balance(&account(1)), 8); + assert_eq!(Balances::free_balance(&account(1)), 8 - balance_deposit); assert!(ItemMetadataOf::::contains_key(0, 42)); // Force origin works, too. @@ -985,9 +1043,9 @@ fn set_item_metadata_should_work() { // Update deposit assert_ok!(Nfts::set_metadata(RuntimeOrigin::signed(account(1)), 0, 42, bvec![0u8; 15])); - assert_eq!(Balances::free_balance(&account(1)), 13); + assert_eq!(Balances::free_balance(&account(1)), 13 - balance_deposit); assert_ok!(Nfts::set_metadata(RuntimeOrigin::signed(account(1)), 0, 42, bvec![0u8; 25])); - assert_eq!(Balances::free_balance(&account(1)), 3); + assert_eq!(Balances::free_balance(&account(1)), 3 - balance_deposit); // Cannot over-reserve assert_noop!( @@ -1031,6 +1089,8 @@ fn set_item_metadata_should_work() { #[test] fn set_collection_owner_attributes_should_work() { new_test_ext().execute_with(|| { + let balance_deposit = balance_deposit(); + Balances::make_free_balance_be(&account(1), 100); assert_ok!(Nfts::force_create( @@ -1072,7 +1132,7 @@ fn set_collection_owner_attributes_should_work() { (Some(0), AttributeNamespace::CollectionOwner, bvec![1], bvec![0]), ] ); - assert_eq!(Balances::reserved_balance(account(1)), 10); + assert_eq!(Balances::reserved_balance(account(1)), 10 + balance_deposit); assert_eq!(Collection::::get(0).unwrap().owner_deposit, 9); assert_ok!(Nfts::set_attribute( @@ -1091,7 +1151,7 @@ fn set_collection_owner_attributes_should_work() { (Some(0), AttributeNamespace::CollectionOwner, bvec![1], bvec![0]), ] ); - assert_eq!(Balances::reserved_balance(account(1)), 19); + assert_eq!(Balances::reserved_balance(account(1)), 19 + balance_deposit); assert_eq!(Collection::::get(0).unwrap().owner_deposit, 18); assert_ok!(Nfts::clear_attribute( @@ -1108,7 +1168,7 @@ fn set_collection_owner_attributes_should_work() { (Some(0), AttributeNamespace::CollectionOwner, bvec![0], bvec![0]), ] ); - assert_eq!(Balances::reserved_balance(account(1)), 16); + assert_eq!(Balances::reserved_balance(account(1)), 16 + balance_deposit); assert_ok!(Nfts::burn(RuntimeOrigin::root(), 0, 0)); let w = Nfts::get_destroy_witness(&0).unwrap(); @@ -1352,7 +1412,7 @@ fn set_item_owner_attributes_should_work() { Attribute::::get((0, Some(0), AttributeNamespace::ItemOwner, &key)).unwrap(); assert_eq!(deposit.account, Some(account(3))); assert_eq!(deposit.amount, 13); - assert_eq!(Balances::reserved_balance(account(2)), 3); + assert_eq!(Balances::reserved_balance(account(2)), 3 + balance_deposit()); assert_eq!(Balances::reserved_balance(account(3)), 13); // validate attributes on item deletion @@ -1602,7 +1662,7 @@ fn set_attribute_should_respect_lock() { (Some(1), AttributeNamespace::CollectionOwner, bvec![0], bvec![0]), ] ); - assert_eq!(Balances::reserved_balance(account(1)), 11); + assert_eq!(Balances::reserved_balance(account(1)), 11 + balance_deposit()); assert_ok!(Nfts::set_collection_metadata(RuntimeOrigin::signed(account(1)), 0, bvec![])); assert_ok!(Nfts::lock_collection( @@ -1721,6 +1781,8 @@ fn preserve_config_for_frozen_items() { #[test] fn force_update_collection_should_work() { new_test_ext().execute_with(|| { + let balance_deposit = balance_deposit(); + Balances::make_free_balance_be(&account(1), 100); assert_ok!(Nfts::force_create( @@ -1743,7 +1805,7 @@ fn force_update_collection_should_work() { )); assert_ok!(Nfts::set_metadata(RuntimeOrigin::signed(account(1)), 0, 42, bvec![0; 20])); assert_ok!(Nfts::set_metadata(RuntimeOrigin::signed(account(1)), 0, 69, bvec![0; 20])); - assert_eq!(Balances::reserved_balance(account(1)), 65); + assert_eq!(Balances::reserved_balance(account(1)), 65 + 2 * balance_deposit); // force item status to be free holding assert_ok!(Nfts::force_collection_config( @@ -1772,7 +1834,7 @@ fn force_update_collection_should_work() { Some(account(4)), )); assert_eq!(collections(), vec![(account(5), 0)]); - assert_eq!(Balances::reserved_balance(account(1)), 2); + assert_eq!(Balances::reserved_balance(account(1)), 2 + 2 * balance_deposit); assert_eq!(Balances::reserved_balance(account(5)), 63); assert_ok!(Nfts::redeposit( @@ -1780,7 +1842,7 @@ fn force_update_collection_should_work() { 0, bvec![0, 42, 50, 69, 100] )); - assert_eq!(Balances::reserved_balance(account(1)), 0); + assert_eq!(Balances::reserved_balance(account(1)), 2 * balance_deposit); assert_ok!(Nfts::set_metadata(RuntimeOrigin::signed(account(5)), 0, 42, bvec![0; 20])); assert_eq!(Balances::reserved_balance(account(5)), 42); @@ -1838,6 +1900,8 @@ fn force_update_collection_should_work() { #[test] fn burn_works() { new_test_ext().execute_with(|| { + let balance_deposit = balance_deposit(); + Balances::make_free_balance_be(&account(1), 100); assert_ok!(Nfts::force_create( RuntimeOrigin::root(), @@ -1871,7 +1935,7 @@ fn burn_works() { account(5), default_item_config() )); - assert_eq!(Balances::reserved_balance(account(1)), 2); + assert_eq!(Balances::reserved_balance(account(1)), 2 + balance_deposit); assert_noop!( Nfts::burn(RuntimeOrigin::signed(account(0)), 0, 42), @@ -1912,10 +1976,15 @@ fn burn_should_update_account_balance_works() { )); assert_ok!(Nfts::burn(RuntimeOrigin::signed(owner.clone()), collection_id, 42)); - assert_eq!(AccountBalance::get(collection_id, &owner), 1); + assert_eq!( + AccountBalance::get(collection_id, &owner), + Some((1, (owner.clone(), balance_deposit()))) + ); + assert_eq!(Balances::reserved_balance(&owner), item_deposit() + balance_deposit()); assert_ok!(Nfts::burn(RuntimeOrigin::signed(owner.clone()), collection_id, 43)); assert!(!AccountBalance::contains_key(collection_id, &owner)); + assert_eq!(Balances::reserved_balance(&owner), 0); }); } @@ -2947,43 +3016,45 @@ fn buy_item_should_update_account_balance_works() { let user_1 = account(1); let user_2 = account(2); let collection_id = 0; - let item_1 = 1; - let price_1 = 20; - let initial_balance = 100; - - Balances::make_free_balance_be(&user_1, initial_balance); - Balances::make_free_balance_be(&user_2, initial_balance); + let item = 1; + let price = 20; + Balances::make_free_balance_be(&user_1, 100); + Balances::make_free_balance_be( + &user_2, + Balances::minimum_balance() + price + balance_deposit(), + ); assert_ok!(Nfts::force_create( RuntimeOrigin::root(), user_1.clone(), - default_collection_config() + collection_config_with_all_settings_enabled() )); - assert_ok!(Nfts::mint( RuntimeOrigin::signed(user_1.clone()), collection_id, - item_1, + item, user_1.clone(), None )); - assert_ok!(Nfts::set_price( RuntimeOrigin::signed(user_1.clone()), collection_id, - item_1, - Some(price_1), + item, + Some(price), None, )); - assert_ok!(Nfts::buy_item( RuntimeOrigin::signed(user_2.clone()), collection_id, - item_1, - price_1 + 1, + item, + price, )); - assert_eq!(AccountBalance::get(collection_id, &user_1), 0); - assert_eq!(AccountBalance::get(collection_id, &user_2), 1); + assert!(!AccountBalance::contains_key(collection_id, &user_1)); + assert_eq!( + AccountBalance::get(collection_id, &user_2), + Some((1, (user_2.clone(), balance_deposit()))) + ); + assert_eq!(Balances::reserved_balance(&user_2), balance_deposit()); }); } @@ -3419,14 +3490,15 @@ fn claim_swap_should_update_account_balance_works() { PriceWithDirection { amount: price, direction: PriceDirection::Receive.clone() }; Balances::make_free_balance_be(&user_1, 1000); - Balances::make_free_balance_be(&user_2, 1000); - + Balances::make_free_balance_be( + &user_2, + Balances::minimum_balance() + balance_deposit() + price, + ); assert_ok!(Nfts::force_create( RuntimeOrigin::root(), user_1.clone(), - default_collection_config() + collection_config_with_all_settings_enabled() )); - assert_ok!(Nfts::mint( RuntimeOrigin::signed(user_1.clone()), collection_id, @@ -3434,13 +3506,17 @@ fn claim_swap_should_update_account_balance_works() { user_1.clone(), None, )); - assert_ok!(Nfts::force_mint( + assert_ok!(Nfts::mint( RuntimeOrigin::signed(user_1.clone()), collection_id, item_2, user_2.clone(), - default_item_config(), + None, )); + assert_eq!( + Balances::reserved_balance(&user_1), + (2 * item_deposit()) + (2 * balance_deposit()) + ); assert_ok!(Nfts::create_swap( RuntimeOrigin::signed(user_1.clone()), collection_id, @@ -3450,7 +3526,6 @@ fn claim_swap_should_update_account_balance_works() { Some(price_with_direction.clone()), 2 )); - assert_ok!(Nfts::claim_swap( RuntimeOrigin::signed(user_2.clone()), collection_id, @@ -3459,8 +3534,18 @@ fn claim_swap_should_update_account_balance_works() { item_1, Some(price_with_direction), )); - assert_eq!(AccountBalance::get(collection_id, &user_1), 1); - assert_eq!(AccountBalance::get(collection_id, &user_2), 1); + assert_eq!( + AccountBalance::get(collection_id, &user_1), + Some((1, (user_1.clone(), balance_deposit()))) + ); + assert_eq!( + AccountBalance::get(collection_id, &user_2), + Some((1, (user_2.clone(), balance_deposit()))) + ); + assert_eq!(Balances::reserved_balance(&user_1), (2 * item_deposit()) + balance_deposit()); + // User pays for its own deposit (previously paid by the account who signed the mint + // transaction). + assert_eq!(Balances::reserved_balance(&user_2), balance_deposit()); }); } @@ -3804,7 +3889,7 @@ fn pre_signed_mints_should_work() { assert_eq!(deposit.amount, 3); assert_eq!(Balances::free_balance(&user_0), 100 - 2 + 10); // 2 - collection deposit, 10 - mint price - assert_eq!(Balances::free_balance(&user_2), 100 - 1 - 3 - 6 - 10); // 1 - item deposit, 3 - metadata, 6 - attributes, 10 - mint price + assert_eq!(Balances::free_balance(&user_2), 100 - balance_deposit() - 1 - 3 - 6 - 10); // 1 - item deposit, 3 - metadata, 6 - attributes, 10 - mint price assert_noop!( Nfts::mint_pre_signed( @@ -3979,7 +4064,7 @@ fn pre_signed_attributes_should_work() { assert_eq!(deposit.account, Some(user_2.clone())); assert_eq!(deposit.amount, 3); - assert_eq!(Balances::free_balance(&user_1), 100 - 2 - 1); // 2 - collection deposit, 1 - item deposit + assert_eq!(Balances::free_balance(&user_1), 100 - 2 - 1 - balance_deposit()); // 2 - collection deposit, 1 - item deposit assert_eq!(Balances::free_balance(&user_2), 100 - 6); // 6 - attributes // validate the deposit gets returned on attribute update from collection's owner @@ -4340,7 +4425,7 @@ fn clear_collection_approvals_works() { let item_owner = account(1); let delegates = 10..20; - for origin in [root(), none()] { + for origin in [RuntimeOrigin::root(), none()] { assert_noop!( Nfts::clear_collection_approvals(origin, collection_id, 0), BadOrigin.with_weight(WeightOf::clear_collection_approvals(0)) @@ -4435,7 +4520,12 @@ fn clear_collection_approvals_works() { // Remove collection approvals while there are none. assert_eq!( - Nfts::force_clear_collection_approvals(root(), item_owner.clone(), collection_id, 10), + Nfts::force_clear_collection_approvals( + RuntimeOrigin::root(), + item_owner.clone(), + collection_id, + 10 + ), Ok(Some(WeightOf::clear_collection_approvals(0)).into()) ); assert_eq!(Balances::free_balance(&item_owner), balance); @@ -4507,7 +4597,12 @@ fn force_clear_collection_approvals_works() { // Remove zero collection approvals. assert_eq!( - Nfts::force_clear_collection_approvals(root(), item_owner.clone(), collection_id, 0), + Nfts::force_clear_collection_approvals( + RuntimeOrigin::root(), + item_owner.clone(), + collection_id, + 0 + ), Ok(Some(WeightOf::clear_collection_approvals(0)).into()) ); assert_eq!(Balances::free_balance(&item_owner), balance - approvals as u64); @@ -4525,7 +4620,7 @@ fn force_clear_collection_approvals_works() { let limit = 1; assert_eq!( Nfts::force_clear_collection_approvals( - root(), + RuntimeOrigin::root(), item_owner.clone(), collection_id, limit @@ -4547,7 +4642,12 @@ fn force_clear_collection_approvals_works() { // Successfully remove all collection approvals. Only charges post-dispatch weight for // the removed approvals. assert_eq!( - Nfts::force_clear_collection_approvals(root(), item_owner.clone(), collection_id, 10), + Nfts::force_clear_collection_approvals( + RuntimeOrigin::root(), + item_owner.clone(), + collection_id, + 10 + ), Ok(Some(WeightOf::clear_collection_approvals(approvals)).into()) ); assert_eq!(Balances::free_balance(&item_owner), balance); @@ -4562,7 +4662,12 @@ fn force_clear_collection_approvals_works() { // Remove collection approvals while there are none. assert_eq!( - Nfts::force_clear_collection_approvals(root(), item_owner.clone(), collection_id, 10), + Nfts::force_clear_collection_approvals( + RuntimeOrigin::root(), + item_owner.clone(), + collection_id, + 10 + ), Ok(Some(WeightOf::clear_collection_approvals(0)).into()) ); assert_eq!(Balances::free_balance(&item_owner), balance); @@ -4598,7 +4703,7 @@ fn approve_collection_transfer_works() { let item_id = 42; let item_owner = account(2); - for origin in [root(), none()] { + for origin in [RuntimeOrigin::root(), none()] { assert_noop!( Nfts::approve_collection_transfer(origin, collection_id, delegate.clone(), None), BadOrigin @@ -4615,7 +4720,7 @@ fn approve_collection_transfer_works() { Error::::NoItemOwned ); assert_ok!(Nfts::force_create( - root(), + RuntimeOrigin::root(), collection_owner.clone(), default_collection_config() )); @@ -4729,7 +4834,7 @@ fn force_approve_collection_transfer_works() { // Approve unknown collection. assert_noop!( Nfts::force_approve_collection_transfer( - root(), + RuntimeOrigin::root(), item_owner.clone(), collection_id, delegate.clone(), @@ -4745,7 +4850,7 @@ fn force_approve_collection_transfer_works() { // Approve collection without items. assert_noop!( Nfts::force_approve_collection_transfer( - root(), + RuntimeOrigin::root(), item_owner.clone(), collection_id, delegate.clone(), @@ -4763,7 +4868,7 @@ fn force_approve_collection_transfer_works() { // Approve collection without balance. assert_noop!( Nfts::force_approve_collection_transfer( - root(), + RuntimeOrigin::root(), item_owner.clone(), collection_id, delegate.clone(), @@ -4787,7 +4892,7 @@ fn force_approve_collection_transfer_works() { [None, None, Some(deadline), Some(deadline), Some(deadline * 2), Some(deadline), None] { assert_ok!(Nfts::force_approve_collection_transfer( - root(), + RuntimeOrigin::root(), item_owner.clone(), collection_id, delegate.clone(), @@ -4819,7 +4924,7 @@ fn force_approve_collection_transfer_works() { )); assert_noop!( Nfts::force_approve_collection_transfer( - root(), + RuntimeOrigin::root(), item_owner, collection_id, delegate, @@ -4839,7 +4944,7 @@ fn cancel_collection_approval_works() { let item_id = 42; let item_owner = account(2); - for origin in [root(), none()] { + for origin in [RuntimeOrigin::root(), none()] { assert_noop!( Nfts::cancel_collection_approval(origin, collection_id, delegate.clone()), BadOrigin @@ -4938,7 +5043,7 @@ fn force_cancel_collection_approval_works() { // Cancel an approval for a non existing collection. assert_noop!( Nfts::force_cancel_collection_approval( - root(), + RuntimeOrigin::root(), item_owner.clone(), collection_id, delegate.clone() @@ -4954,7 +5059,7 @@ fn force_cancel_collection_approval_works() { // Cancel an unapproved delegate. assert_noop!( Nfts::force_cancel_collection_approval( - root(), + RuntimeOrigin::root(), item_owner.clone(), collection_id, account(69) @@ -4963,7 +5068,7 @@ fn force_cancel_collection_approval_works() { ); // Successfully cancel a collection approval. assert_ok!(Nfts::force_cancel_collection_approval( - root(), + RuntimeOrigin::root(), item_owner.clone(), collection_id, delegate.clone() diff --git a/pallets/nfts/src/types.rs b/pallets/nfts/src/types.rs index f08f1d09..135702b0 100644 --- a/pallets/nfts/src/types.rs +++ b/pallets/nfts/src/types.rs @@ -89,6 +89,9 @@ pub(super) type PreSignedAttributesOf = PreSignedAttributes< ::AccountId, BlockNumberFor, >; +/// A type alias for the depositor account and its associated deposited amount. +pub(super) type AccountDepositOf = + (::AccountId, DepositBalanceOf); /// Information about a collection. #[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo, MaxEncodedLen)] diff --git a/pallets/nfts/src/weights.rs b/pallets/nfts/src/weights.rs index 6e291bfc..974b1f8f 100644 --- a/pallets/nfts/src/weights.rs +++ b/pallets/nfts/src/weights.rs @@ -2,13 +2,13 @@ //! Autogenerated weights for `pallet_nfts` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 40.0.0 -//! DATE: 2024-12-12, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-12-22, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `R0GUE`, CPU: `` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: -// ./target/release/pop-node +// ./target/production/pop-node // benchmark // pallet // --chain=dev @@ -60,14 +60,8 @@ pub trait WeightInfo { fn set_collection_metadata() -> Weight; fn clear_collection_metadata() -> Weight; fn approve_transfer() -> Weight; - fn approve_collection_transfer() -> Weight; - fn force_approve_collection_transfer() -> Weight; fn cancel_approval() -> Weight; - fn cancel_collection_approval() -> Weight; - fn force_cancel_collection_approval() -> Weight; fn clear_all_transfer_approvals() -> Weight; - fn clear_collection_approvals(n: u32, ) -> Weight; - fn force_clear_collection_approvals(n: u32, ) -> Weight; fn set_accept_ownership() -> Weight; fn set_collection_max_supply() -> Weight; fn update_mint_settings() -> Weight; @@ -79,6 +73,12 @@ pub trait WeightInfo { fn claim_swap() -> Weight; fn mint_pre_signed(n: u32, ) -> Weight; fn set_attributes_pre_signed(n: u32, ) -> Weight; + fn approve_collection_transfer() -> Weight; + fn force_approve_collection_transfer() -> Weight; + fn cancel_collection_approval() -> Weight; + fn force_cancel_collection_approval() -> Weight; + fn clear_collection_approvals(n: u32, ) -> Weight; + fn force_clear_collection_approvals(n: u32, ) -> Weight; } /// Weights for `pallet_nfts` using the Substrate node and recommended hardware. @@ -98,8 +98,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `105` // Estimated: `3549` - // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(37_000_000, 3549) + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(21_000_000, 3549) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -117,8 +117,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `3` // Estimated: `3549` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(15_000_000, 3549) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(11_000_000, 3549) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -143,14 +143,18 @@ impl WeightInfo for SubstrateWeight { /// 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(_m: u32, _c: u32, a: u32, ) -> Weight { + fn destroy(m: u32, c: u32, a: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `32137 + a * (366 ±0)` // Estimated: `2523990 + a * (2954 ±0)` - // Minimum execution time: 1_005_000_000 picoseconds. - Weight::from_parts(2_234_507_890, 2523990) - // Standard Error: 87_675 - .saturating_add(Weight::from_parts(5_794_302, 0).saturating_mul(a.into())) + // Minimum execution time: 893_000_000 picoseconds. + Weight::from_parts(814_084_483, 2523990) + // Standard Error: 18_466 + .saturating_add(Weight::from_parts(26_897, 0).saturating_mul(m.into())) + // Standard Error: 18_466 + .saturating_add(Weight::from_parts(87_809, 0).saturating_mul(c.into())) + // Standard Error: 18_466 + .saturating_add(Weight::from_parts(4_861_675, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(1005_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1005_u64)) @@ -166,7 +170,7 @@ impl WeightInfo for SubstrateWeight { /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) /// Storage: `Nfts::AccountBalance` (r:1 w:1) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, mode: `MaxEncodedLen`) /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `Nfts::Account` (r:0 w:1) @@ -175,8 +179,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `382` // Estimated: `4326` - // Minimum execution time: 40_000_000 picoseconds. - Weight::from_parts(43_000_000, 4326) + // Minimum execution time: 37_000_000 picoseconds. + Weight::from_parts(38_000_000, 4326) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -189,7 +193,7 @@ impl WeightInfo for SubstrateWeight { /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) /// Storage: `Nfts::AccountBalance` (r:1 w:1) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, mode: `MaxEncodedLen`) /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `Nfts::Account` (r:0 w:1) @@ -198,8 +202,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `382` // Estimated: `4326` - // Minimum execution time: 38_000_000 picoseconds. - Weight::from_parts(40_000_000, 4326) + // Minimum execution time: 36_000_000 picoseconds. + Weight::from_parts(39_000_000, 4326) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -214,7 +218,7 @@ impl WeightInfo for SubstrateWeight { /// Storage: `Nfts::ItemMetadataOf` (r:1 w:0) /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(347), added: 2822, mode: `MaxEncodedLen`) /// Storage: `Nfts::AccountBalance` (r:1 w:1) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, mode: `MaxEncodedLen`) /// Storage: `Nfts::Account` (r:0 w:1) /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`) /// Storage: `Nfts::ItemPriceOf` (r:0 w:1) @@ -225,10 +229,10 @@ 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: `584` + // Measured: `634` // Estimated: `4326` - // Minimum execution time: 46_000_000 picoseconds. - Weight::from_parts(47_000_000, 4326) + // Minimum execution time: 42_000_000 picoseconds. + Weight::from_parts(43_000_000, 4326) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -243,7 +247,9 @@ 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::AccountBalance` (r:2 w:2) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, 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) @@ -252,12 +258,12 @@ 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: `613` - // Estimated: `6084` - // Minimum execution time: 39_000_000 picoseconds. - Weight::from_parts(45_000_000, 6084) - .saturating_add(T::DbWeight::get().reads(7_u64)) - .saturating_add(T::DbWeight::get().writes(7_u64)) + // Measured: `765` + // Estimated: `6180` + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(50_000_000, 6180) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) } /// Storage: `Nfts::Collection` (r:1 w:0) /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) @@ -270,10 +276,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `690 + i * (108 ±0)` // Estimated: `3549 + i * (3336 ±0)` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(11_000_000, 3549) - // Standard Error: 33_010 - .saturating_add(Weight::from_parts(17_115_197, 0).saturating_mul(i.into())) + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 3549) + // Standard Error: 41_268 + .saturating_add(Weight::from_parts(12_689_751, 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()))) @@ -287,8 +293,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `395` // Estimated: `3534` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(15_000_000, 3534) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(11_000_000, 3534) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -300,8 +306,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `395` // Estimated: `3534` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(15_000_000, 3534) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(11_000_000, 3534) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -313,8 +319,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `267` // Estimated: `3549` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 3549) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(10_000_000, 3549) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -330,8 +336,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `417` // Estimated: `3593` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(21_000_000, 3593) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(15_000_000, 3593) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -343,8 +349,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `296` // Estimated: `6078` - // Minimum execution time: 30_000_000 picoseconds. - Weight::from_parts(31_000_000, 6078) + // Minimum execution time: 24_000_000 picoseconds. + Weight::from_parts(25_000_000, 6078) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -356,8 +362,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `238` // Estimated: `3549` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 3549) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(9_000_000, 3549) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -369,8 +375,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `203` // Estimated: `3549` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(10_000_000, 3549) + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(7_000_000, 3549) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -382,8 +388,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `395` // Estimated: `3534` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 3534) + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(11_000_000, 3534) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -401,8 +407,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `499` // Estimated: `3944` - // Minimum execution time: 38_000_000 picoseconds. - Weight::from_parts(39_000_000, 3944) + // Minimum execution time: 28_000_000 picoseconds. + Weight::from_parts(28_000_000, 3944) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -414,8 +420,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `271` // Estimated: `3944` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(20_000_000, 3944) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(14_000_000, 3944) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -431,8 +437,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `943` // Estimated: `3944` - // Minimum execution time: 35_000_000 picoseconds. - Weight::from_parts(36_000_000, 3944) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(27_000_000, 3944) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -444,8 +450,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `308` // Estimated: `4466` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 4466) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(9_000_000, 4466) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -462,10 +468,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `686 + n * (398 ±0)` // Estimated: `4466 + n * (2954 ±0)` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(20_000_000, 4466) - // Standard Error: 11_913 - .saturating_add(Weight::from_parts(5_265_987, 0).saturating_mul(n.into())) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(14_000_000, 4466) + // Standard Error: 11_599 + .saturating_add(Weight::from_parts(4_782_076, 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)) @@ -486,8 +492,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `499` // Estimated: `3812` - // Minimum execution time: 32_000_000 picoseconds. - Weight::from_parts(38_000_000, 3812) + // Minimum execution time: 23_000_000 picoseconds. + Weight::from_parts(24_000_000, 3812) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -503,8 +509,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `809` // Estimated: `3812` - // Minimum execution time: 30_000_000 picoseconds. - Weight::from_parts(33_000_000, 3812) + // Minimum execution time: 22_000_000 picoseconds. + Weight::from_parts(23_000_000, 3812) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -520,8 +526,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `325` // Estimated: `3759` - // Minimum execution time: 28_000_000 picoseconds. - Weight::from_parts(30_000_000, 3759) + // Minimum execution time: 21_000_000 picoseconds. + Weight::from_parts(22_000_000, 3759) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -537,8 +543,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `643` // Estimated: `3759` - // Minimum execution time: 28_000_000 picoseconds. - Weight::from_parts(30_000_000, 3759) + // Minimum execution time: 22_000_000 picoseconds. + Weight::from_parts(23_000_000, 3759) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -555,36 +561,6 @@ impl WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: `Nfts::AccountBalance` (r:1 w:0) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, 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::CollectionApprovals` (r:1 w:1) - /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) - fn approve_collection_transfer() -> Weight { - // Proof Size summary in bytes: - // Measured: `450` - // Estimated: `3602` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_000_000, 3602) - .saturating_add(T::DbWeight::get().reads(3_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - /// Storage: `Nfts::AccountBalance` (r:1 w:0) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, 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::CollectionApprovals` (r:1 w:1) - /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) - fn force_approve_collection_transfer() -> Weight { - // Proof Size summary in bytes: - // Measured: `450` - // Estimated: `3602` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_000_000, 3602) - .saturating_add(T::DbWeight::get().reads(3_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::CollectionApprovals` (r:1 w:0) @@ -593,33 +569,11 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `345` // Estimated: `4326` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 4326) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_000_000, 4326) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: `Nfts::CollectionApprovals` (r:1 w:1) - /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) - fn cancel_collection_approval() -> Weight { - // Proof Size summary in bytes: - // Measured: `359` - // Estimated: `3602` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 3602) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - /// Storage: `Nfts::CollectionApprovals` (r:1 w:1) - /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) - fn force_cancel_collection_approval() -> Weight { - // Proof Size summary in bytes: - // Measured: `359` - // Estimated: `3602` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(17_000_000, 3602) - .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::CollectionApprovals` (r:1 w:0) @@ -629,50 +583,18 @@ impl WeightInfo for SubstrateWeight { // Measured: `345` // Estimated: `4326` // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 4326) + Weight::from_parts(14_000_000, 4326) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: `Nfts::CollectionApprovals` (r:1000 w:999) - /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) - /// The range of component `n` is `[1, 1000]`. - fn clear_collection_approvals(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `327 + n * (75 ±0)` - // Estimated: `3602 + n * (2612 ±0)` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(18_000_000, 3602) - // Standard Error: 7_954 - .saturating_add(Weight::from_parts(3_625_558, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) - .saturating_add(Weight::from_parts(0, 2612).saturating_mul(n.into())) - } - /// Storage: `Nfts::CollectionApprovals` (r:1000 w:999) - /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) - /// The range of component `n` is `[1, 1000]`. - fn force_clear_collection_approvals(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `327 + n * (75 ±0)` - // Estimated: `3602 + n * (2612 ±0)` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(18_000_000, 3602) - // Standard Error: 5_861 - .saturating_add(Weight::from_parts(3_576_220, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) - .saturating_add(Weight::from_parts(0, 2612).saturating_mul(n.into())) - } /// Storage: `Nfts::OwnershipAcceptance` (r:1 w:1) /// Proof: `Nfts::OwnershipAcceptance` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) fn set_accept_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `3` // Estimated: `3517` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(10_000_000, 3517) + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(8_000_000, 3517) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -684,8 +606,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `267` // Estimated: `3549` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(13_000_000, 3549) + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(10_000_000, 3549) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -697,8 +619,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `250` // Estimated: `3538` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 3538) + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(11_000_000, 3538) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -714,8 +636,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `478` // Estimated: `4326` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(18_000_000, 4326) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_000_000, 4326) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -732,19 +654,21 @@ impl WeightInfo for SubstrateWeight { /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `Nfts::AccountBalance` (r:2 w:2) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, 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: `725` - // Estimated: `6084` - // Minimum execution time: 46_000_000 picoseconds. - Weight::from_parts(48_000_000, 6084) - .saturating_add(T::DbWeight::get().reads(8_u64)) - .saturating_add(T::DbWeight::get().writes(7_u64)) + // Measured: `877` + // Estimated: `6180` + // Minimum execution time: 53_000_000 picoseconds. + Weight::from_parts(55_000_000, 6180) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) } /// The range of component `n` is `[0, 10]`. fn pay_tips(n: u32, ) -> Weight { @@ -752,9 +676,9 @@ impl WeightInfo for SubstrateWeight { // Measured: `0` // Estimated: `0` // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_971_321, 0) - // Standard Error: 11_267 - .saturating_add(Weight::from_parts(1_831_565, 0).saturating_mul(n.into())) + Weight::from_parts(1_497_803, 0) + // Standard Error: 5_639 + .saturating_add(Weight::from_parts(1_502_698, 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`) @@ -764,8 +688,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `421` // Estimated: `7662` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(15_000_000, 7662) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(11_000_000, 7662) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -777,8 +701,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `440` // Estimated: `4326` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(14_000_000, 4326) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(12_000_000, 4326) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -795,19 +719,21 @@ impl WeightInfo for SubstrateWeight { /// Storage: `Nfts::ItemConfigOf` (r:2 w:0) /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `Nfts::AccountBalance` (r:2 w:2) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, 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: `916` + // Measured: `1118` // Estimated: `7662` - // Minimum execution time: 81_000_000 picoseconds. - Weight::from_parts(87_000_000, 7662) - .saturating_add(T::DbWeight::get().reads(11_u64)) - .saturating_add(T::DbWeight::get().writes(12_u64)) + // Minimum execution time: 79_000_000 picoseconds. + Weight::from_parts(82_000_000, 7662) + .saturating_add(T::DbWeight::get().reads(12_u64)) + .saturating_add(T::DbWeight::get().writes(13_u64)) } /// Storage: `Nfts::CollectionRoleOf` (r:2 w:0) /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) @@ -818,11 +744,11 @@ impl WeightInfo for SubstrateWeight { /// Storage: `Nfts::Collection` (r:1 w:1) /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) /// Storage: `Nfts::AccountBalance` (r:1 w:1) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) - /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) - /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, 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::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `Nfts::Attribute` (r:10 w:10) /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(479), added: 2954, mode: `MaxEncodedLen`) /// Storage: `Nfts::ItemMetadataOf` (r:1 w:1) @@ -834,10 +760,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `485` // Estimated: `6078 + n * (2954 ±0)` - // Minimum execution time: 102_000_000 picoseconds. - Weight::from_parts(115_875_572, 6078) - // Standard Error: 214_394 - .saturating_add(Weight::from_parts(29_706_731, 0).saturating_mul(n.into())) + // Minimum execution time: 91_000_000 picoseconds. + Weight::from_parts(95_221_709, 6078) + // Standard Error: 128_983 + .saturating_add(Weight::from_parts(22_458_028, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(7_u64)) @@ -861,16 +787,100 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `514` // Estimated: `4466 + n * (2954 ±0)` - // Minimum execution time: 51_000_000 picoseconds. - Weight::from_parts(66_554_620, 4466) - // Standard Error: 115_497 - .saturating_add(Weight::from_parts(27_385_703, 0).saturating_mul(n.into())) + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(54_326_784, 4466) + // Standard Error: 99_430 + .saturating_add(Weight::from_parts(20_625_932, 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, 2954).saturating_mul(n.into())) } + /// Storage: `Nfts::AccountBalance` (r:1 w:0) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, 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::CollectionApprovals` (r:1 w:1) + /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) + fn approve_collection_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `500` + // Estimated: `3602` + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(24_000_000, 3602) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::AccountBalance` (r:1 w:0) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, 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::CollectionApprovals` (r:1 w:1) + /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) + fn force_approve_collection_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `500` + // Estimated: `3602` + // Minimum execution time: 21_000_000 picoseconds. + Weight::from_parts(24_000_000, 3602) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionApprovals` (r:1 w:1) + /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) + fn cancel_collection_approval() -> Weight { + // Proof Size summary in bytes: + // Measured: `359` + // Estimated: `3602` + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(17_000_000, 3602) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionApprovals` (r:1 w:1) + /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) + fn force_cancel_collection_approval() -> Weight { + // Proof Size summary in bytes: + // Measured: `359` + // Estimated: `3602` + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(17_000_000, 3602) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionApprovals` (r:1000 w:999) + /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 1000]`. + fn clear_collection_approvals(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `327 + n * (75 ±0)` + // Estimated: `3602 + n * (2612 ±0)` + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(22_000_000, 3602) + // Standard Error: 8_973 + .saturating_add(Weight::from_parts(3_888_488, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2612).saturating_mul(n.into())) + } + /// Storage: `Nfts::CollectionApprovals` (r:1000 w:999) + /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 1000]`. + fn force_clear_collection_approvals(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `327 + n * (75 ±0)` + // Estimated: `3602 + n * (2612 ±0)` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(33_601_852, 3602) + // Standard Error: 7_525 + .saturating_add(Weight::from_parts(3_464_828, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2612).saturating_mul(n.into())) + } } // For backwards compatibility and tests. @@ -889,8 +899,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `105` // Estimated: `3549` - // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(37_000_000, 3549) + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(21_000_000, 3549) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -908,8 +918,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `3` // Estimated: `3549` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(15_000_000, 3549) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(11_000_000, 3549) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -934,14 +944,18 @@ impl WeightInfo for () { /// 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(_m: u32, _c: u32, a: u32, ) -> Weight { + fn destroy(m: u32, c: u32, a: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `32137 + a * (366 ±0)` // Estimated: `2523990 + a * (2954 ±0)` - // Minimum execution time: 1_005_000_000 picoseconds. - Weight::from_parts(2_234_507_890, 2523990) - // Standard Error: 87_675 - .saturating_add(Weight::from_parts(5_794_302, 0).saturating_mul(a.into())) + // Minimum execution time: 893_000_000 picoseconds. + Weight::from_parts(814_084_483, 2523990) + // Standard Error: 18_466 + .saturating_add(Weight::from_parts(26_897, 0).saturating_mul(m.into())) + // Standard Error: 18_466 + .saturating_add(Weight::from_parts(87_809, 0).saturating_mul(c.into())) + // Standard Error: 18_466 + .saturating_add(Weight::from_parts(4_861_675, 0).saturating_mul(a.into())) .saturating_add(RocksDbWeight::get().reads(1005_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(RocksDbWeight::get().writes(1005_u64)) @@ -957,7 +971,7 @@ impl WeightInfo for () { /// Storage: `Nfts::CollectionRoleOf` (r:1 w:0) /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) /// Storage: `Nfts::AccountBalance` (r:1 w:1) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, mode: `MaxEncodedLen`) /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `Nfts::Account` (r:0 w:1) @@ -966,8 +980,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `382` // Estimated: `4326` - // Minimum execution time: 40_000_000 picoseconds. - Weight::from_parts(43_000_000, 4326) + // Minimum execution time: 37_000_000 picoseconds. + Weight::from_parts(38_000_000, 4326) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -980,7 +994,7 @@ impl WeightInfo for () { /// Storage: `Nfts::CollectionConfigOf` (r:1 w:0) /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) /// Storage: `Nfts::AccountBalance` (r:1 w:1) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, mode: `MaxEncodedLen`) /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `Nfts::Account` (r:0 w:1) @@ -989,8 +1003,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `382` // Estimated: `4326` - // Minimum execution time: 38_000_000 picoseconds. - Weight::from_parts(40_000_000, 4326) + // Minimum execution time: 36_000_000 picoseconds. + Weight::from_parts(39_000_000, 4326) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1005,7 +1019,7 @@ impl WeightInfo for () { /// Storage: `Nfts::ItemMetadataOf` (r:1 w:0) /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(347), added: 2822, mode: `MaxEncodedLen`) /// Storage: `Nfts::AccountBalance` (r:1 w:1) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, mode: `MaxEncodedLen`) /// Storage: `Nfts::Account` (r:0 w:1) /// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`) /// Storage: `Nfts::ItemPriceOf` (r:0 w:1) @@ -1016,10 +1030,10 @@ 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: `584` + // Measured: `634` // Estimated: `4326` - // Minimum execution time: 46_000_000 picoseconds. - Weight::from_parts(47_000_000, 4326) + // Minimum execution time: 42_000_000 picoseconds. + Weight::from_parts(43_000_000, 4326) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } @@ -1034,7 +1048,9 @@ 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::AccountBalance` (r:2 w:2) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, 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) @@ -1043,12 +1059,12 @@ 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: `613` - // Estimated: `6084` - // Minimum execution time: 39_000_000 picoseconds. - Weight::from_parts(45_000_000, 6084) - .saturating_add(RocksDbWeight::get().reads(7_u64)) - .saturating_add(RocksDbWeight::get().writes(7_u64)) + // Measured: `765` + // Estimated: `6180` + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(50_000_000, 6180) + .saturating_add(RocksDbWeight::get().reads(8_u64)) + .saturating_add(RocksDbWeight::get().writes(8_u64)) } /// Storage: `Nfts::Collection` (r:1 w:0) /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) @@ -1061,10 +1077,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `690 + i * (108 ±0)` // Estimated: `3549 + i * (3336 ±0)` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(11_000_000, 3549) - // Standard Error: 33_010 - .saturating_add(Weight::from_parts(17_115_197, 0).saturating_mul(i.into())) + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 3549) + // Standard Error: 41_268 + .saturating_add(Weight::from_parts(12_689_751, 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()))) @@ -1078,8 +1094,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `395` // Estimated: `3534` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(15_000_000, 3534) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(11_000_000, 3534) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1091,8 +1107,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `395` // Estimated: `3534` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(15_000_000, 3534) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(11_000_000, 3534) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1104,8 +1120,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `267` // Estimated: `3549` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 3549) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(10_000_000, 3549) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1121,8 +1137,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `417` // Estimated: `3593` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(21_000_000, 3593) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(15_000_000, 3593) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1134,8 +1150,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `296` // Estimated: `6078` - // Minimum execution time: 30_000_000 picoseconds. - Weight::from_parts(31_000_000, 6078) + // Minimum execution time: 24_000_000 picoseconds. + Weight::from_parts(25_000_000, 6078) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1147,8 +1163,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `238` // Estimated: `3549` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 3549) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(9_000_000, 3549) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1160,8 +1176,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `203` // Estimated: `3549` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(10_000_000, 3549) + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(7_000_000, 3549) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1173,8 +1189,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `395` // Estimated: `3534` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 3534) + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(11_000_000, 3534) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1192,8 +1208,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `499` // Estimated: `3944` - // Minimum execution time: 38_000_000 picoseconds. - Weight::from_parts(39_000_000, 3944) + // Minimum execution time: 28_000_000 picoseconds. + Weight::from_parts(28_000_000, 3944) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1205,8 +1221,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `271` // Estimated: `3944` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(20_000_000, 3944) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(14_000_000, 3944) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1222,8 +1238,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `943` // Estimated: `3944` - // Minimum execution time: 35_000_000 picoseconds. - Weight::from_parts(36_000_000, 3944) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(27_000_000, 3944) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1235,8 +1251,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `308` // Estimated: `4466` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 4466) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(9_000_000, 4466) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1253,10 +1269,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `686 + n * (398 ±0)` // Estimated: `4466 + n * (2954 ±0)` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(20_000_000, 4466) - // Standard Error: 11_913 - .saturating_add(Weight::from_parts(5_265_987, 0).saturating_mul(n.into())) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(14_000_000, 4466) + // Standard Error: 11_599 + .saturating_add(Weight::from_parts(4_782_076, 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)) @@ -1277,8 +1293,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `499` // Estimated: `3812` - // Minimum execution time: 32_000_000 picoseconds. - Weight::from_parts(38_000_000, 3812) + // Minimum execution time: 23_000_000 picoseconds. + Weight::from_parts(24_000_000, 3812) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1294,8 +1310,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `809` // Estimated: `3812` - // Minimum execution time: 30_000_000 picoseconds. - Weight::from_parts(33_000_000, 3812) + // Minimum execution time: 22_000_000 picoseconds. + Weight::from_parts(23_000_000, 3812) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1311,8 +1327,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `325` // Estimated: `3759` - // Minimum execution time: 28_000_000 picoseconds. - Weight::from_parts(30_000_000, 3759) + // Minimum execution time: 21_000_000 picoseconds. + Weight::from_parts(22_000_000, 3759) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1328,8 +1344,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `643` // Estimated: `3759` - // Minimum execution time: 28_000_000 picoseconds. - Weight::from_parts(30_000_000, 3759) + // Minimum execution time: 22_000_000 picoseconds. + Weight::from_parts(23_000_000, 3759) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1346,36 +1362,6 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } - /// Storage: `Nfts::AccountBalance` (r:1 w:0) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, 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::CollectionApprovals` (r:1 w:1) - /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) - fn approve_collection_transfer() -> Weight { - // Proof Size summary in bytes: - // Measured: `450` - // Estimated: `3602` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_000_000, 3602) - .saturating_add(RocksDbWeight::get().reads(3_u64)) - .saturating_add(RocksDbWeight::get().writes(1_u64)) - } - /// Storage: `Nfts::AccountBalance` (r:1 w:0) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, 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::CollectionApprovals` (r:1 w:1) - /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) - fn force_approve_collection_transfer() -> Weight { - // Proof Size summary in bytes: - // Measured: `450` - // Estimated: `3602` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_000_000, 3602) - .saturating_add(RocksDbWeight::get().reads(3_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::CollectionApprovals` (r:1 w:0) @@ -1384,33 +1370,11 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `345` // Estimated: `4326` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 4326) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_000_000, 4326) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } - /// Storage: `Nfts::CollectionApprovals` (r:1 w:1) - /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) - fn cancel_collection_approval() -> Weight { - // Proof Size summary in bytes: - // Measured: `359` - // Estimated: `3602` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 3602) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - .saturating_add(RocksDbWeight::get().writes(1_u64)) - } - /// Storage: `Nfts::CollectionApprovals` (r:1 w:1) - /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) - fn force_cancel_collection_approval() -> Weight { - // Proof Size summary in bytes: - // Measured: `359` - // Estimated: `3602` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(17_000_000, 3602) - .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::CollectionApprovals` (r:1 w:0) @@ -1420,50 +1384,18 @@ impl WeightInfo for () { // Measured: `345` // Estimated: `4326` // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 4326) + Weight::from_parts(14_000_000, 4326) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } - /// Storage: `Nfts::CollectionApprovals` (r:1000 w:999) - /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) - /// The range of component `n` is `[1, 1000]`. - fn clear_collection_approvals(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `327 + n * (75 ±0)` - // Estimated: `3602 + n * (2612 ±0)` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(18_000_000, 3602) - // Standard Error: 7_954 - .saturating_add(Weight::from_parts(3_625_558, 0).saturating_mul(n.into())) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) - .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into()))) - .saturating_add(Weight::from_parts(0, 2612).saturating_mul(n.into())) - } - /// Storage: `Nfts::CollectionApprovals` (r:1000 w:999) - /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) - /// The range of component `n` is `[1, 1000]`. - fn force_clear_collection_approvals(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `327 + n * (75 ±0)` - // Estimated: `3602 + n * (2612 ±0)` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(18_000_000, 3602) - // Standard Error: 5_861 - .saturating_add(Weight::from_parts(3_576_220, 0).saturating_mul(n.into())) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) - .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into()))) - .saturating_add(Weight::from_parts(0, 2612).saturating_mul(n.into())) - } /// Storage: `Nfts::OwnershipAcceptance` (r:1 w:1) /// Proof: `Nfts::OwnershipAcceptance` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) fn set_accept_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `3` // Estimated: `3517` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(10_000_000, 3517) + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(8_000_000, 3517) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1475,8 +1407,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `267` // Estimated: `3549` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(13_000_000, 3549) + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(10_000_000, 3549) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1488,8 +1420,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `250` // Estimated: `3538` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 3538) + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(11_000_000, 3538) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1505,8 +1437,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `478` // Estimated: `4326` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(18_000_000, 4326) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_000_000, 4326) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1523,19 +1455,21 @@ impl WeightInfo for () { /// Storage: `Nfts::ItemConfigOf` (r:1 w:0) /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `Nfts::AccountBalance` (r:2 w:2) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, 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: `725` - // Estimated: `6084` - // Minimum execution time: 46_000_000 picoseconds. - Weight::from_parts(48_000_000, 6084) - .saturating_add(RocksDbWeight::get().reads(8_u64)) - .saturating_add(RocksDbWeight::get().writes(7_u64)) + // Measured: `877` + // Estimated: `6180` + // Minimum execution time: 53_000_000 picoseconds. + Weight::from_parts(55_000_000, 6180) + .saturating_add(RocksDbWeight::get().reads(9_u64)) + .saturating_add(RocksDbWeight::get().writes(8_u64)) } /// The range of component `n` is `[0, 10]`. fn pay_tips(n: u32, ) -> Weight { @@ -1543,9 +1477,9 @@ impl WeightInfo for () { // Measured: `0` // Estimated: `0` // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_971_321, 0) - // Standard Error: 11_267 - .saturating_add(Weight::from_parts(1_831_565, 0).saturating_mul(n.into())) + Weight::from_parts(1_497_803, 0) + // Standard Error: 5_639 + .saturating_add(Weight::from_parts(1_502_698, 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`) @@ -1555,8 +1489,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `421` // Estimated: `7662` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(15_000_000, 7662) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(11_000_000, 7662) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1568,8 +1502,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `440` // Estimated: `4326` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(14_000_000, 4326) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(12_000_000, 4326) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1586,19 +1520,21 @@ impl WeightInfo for () { /// Storage: `Nfts::ItemConfigOf` (r:2 w:0) /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `Nfts::AccountBalance` (r:2 w:2) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, 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: `916` + // Measured: `1118` // Estimated: `7662` - // Minimum execution time: 81_000_000 picoseconds. - Weight::from_parts(87_000_000, 7662) - .saturating_add(RocksDbWeight::get().reads(11_u64)) - .saturating_add(RocksDbWeight::get().writes(12_u64)) + // Minimum execution time: 79_000_000 picoseconds. + Weight::from_parts(82_000_000, 7662) + .saturating_add(RocksDbWeight::get().reads(12_u64)) + .saturating_add(RocksDbWeight::get().writes(13_u64)) } /// Storage: `Nfts::CollectionRoleOf` (r:2 w:0) /// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) @@ -1609,11 +1545,11 @@ impl WeightInfo for () { /// Storage: `Nfts::Collection` (r:1 w:1) /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) /// Storage: `Nfts::AccountBalance` (r:1 w:1) - /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) - /// Storage: `Nfts::ItemConfigOf` (r:1 w:1) - /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, 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::ItemConfigOf` (r:1 w:1) + /// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `Nfts::Attribute` (r:10 w:10) /// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(479), added: 2954, mode: `MaxEncodedLen`) /// Storage: `Nfts::ItemMetadataOf` (r:1 w:1) @@ -1625,10 +1561,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `485` // Estimated: `6078 + n * (2954 ±0)` - // Minimum execution time: 102_000_000 picoseconds. - Weight::from_parts(115_875_572, 6078) - // Standard Error: 214_394 - .saturating_add(Weight::from_parts(29_706_731, 0).saturating_mul(n.into())) + // Minimum execution time: 91_000_000 picoseconds. + Weight::from_parts(95_221_709, 6078) + // Standard Error: 128_983 + .saturating_add(Weight::from_parts(22_458_028, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(7_u64)) @@ -1652,14 +1588,98 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `514` // Estimated: `4466 + n * (2954 ±0)` - // Minimum execution time: 51_000_000 picoseconds. - Weight::from_parts(66_554_620, 4466) - // Standard Error: 115_497 - .saturating_add(Weight::from_parts(27_385_703, 0).saturating_mul(n.into())) + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(54_326_784, 4466) + // Standard Error: 99_430 + .saturating_add(Weight::from_parts(20_625_932, 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, 2954).saturating_mul(n.into())) } + /// Storage: `Nfts::AccountBalance` (r:1 w:0) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, 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::CollectionApprovals` (r:1 w:1) + /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) + fn approve_collection_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `500` + // Estimated: `3602` + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(24_000_000, 3602) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::AccountBalance` (r:1 w:0) + /// Proof: `Nfts::AccountBalance` (`max_values`: None, `max_size`: Some(120), added: 2595, 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::CollectionApprovals` (r:1 w:1) + /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) + fn force_approve_collection_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `500` + // Estimated: `3602` + // Minimum execution time: 21_000_000 picoseconds. + Weight::from_parts(24_000_000, 3602) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionApprovals` (r:1 w:1) + /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) + fn cancel_collection_approval() -> Weight { + // Proof Size summary in bytes: + // Measured: `359` + // Estimated: `3602` + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(17_000_000, 3602) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionApprovals` (r:1 w:1) + /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) + fn force_cancel_collection_approval() -> Weight { + // Proof Size summary in bytes: + // Measured: `359` + // Estimated: `3602` + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(17_000_000, 3602) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + /// Storage: `Nfts::CollectionApprovals` (r:1000 w:999) + /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 1000]`. + fn clear_collection_approvals(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `327 + n * (75 ±0)` + // Estimated: `3602 + n * (2612 ±0)` + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(22_000_000, 3602) + // Standard Error: 8_973 + .saturating_add(Weight::from_parts(3_888_488, 0).saturating_mul(n.into())) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2612).saturating_mul(n.into())) + } + /// Storage: `Nfts::CollectionApprovals` (r:1000 w:999) + /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 1000]`. + fn force_clear_collection_approvals(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `327 + n * (75 ±0)` + // Estimated: `3602 + n * (2612 ±0)` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(33_601_852, 3602) + // Standard Error: 7_525 + .saturating_add(Weight::from_parts(3_464_828, 0).saturating_mul(n.into())) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2612).saturating_mul(n.into())) + } } diff --git a/runtime/devnet/src/config/assets.rs b/runtime/devnet/src/config/assets.rs index e46d7dbc..6a54f368 100644 --- a/runtime/devnet/src/config/assets.rs +++ b/runtime/devnet/src/config/assets.rs @@ -29,6 +29,8 @@ parameter_types! { parameter_types! { pub NftsPalletFeatures: PalletFeatures = PalletFeatures::all_enabled(); + // Key = 68 bytes (4+16+32+16), Value = 52 bytes (4+32+16) + pub const NftsCollectionBalanceDeposit: Balance = deposit(1, 120); pub const NftsCollectionDeposit: Balance = 10 * UNIT; // Key = 116 bytes (4+16+32+16+32+16), Value = 21 bytes (1+4+16) pub const NftsCollectionApprovalDeposit: Balance = deposit(1, 137); @@ -44,6 +46,7 @@ impl pallet_nfts::Config for Runtime { type ApprovalsLimit = ConstU32<20>; type AttributeDepositBase = NftsAttributeDepositBase; type CollectionApprovalDeposit = NftsCollectionApprovalDeposit; + type CollectionBalanceDeposit = NftsCollectionBalanceDeposit; type CollectionDeposit = NftsCollectionDeposit; // TODO: source from primitives type CollectionId = CollectionId; @@ -130,6 +133,15 @@ mod tests { use super::*; + #[test] + fn ensure_account_balance_deposit() { + let max_size = pallet_nfts::AccountBalance::::storage_info() + .first() + .and_then(|info| info.max_size) + .unwrap_or_default(); + assert_eq!(deposit(1, max_size), NftsCollectionBalanceDeposit::get()); + } + #[test] fn ensure_collection_approval_deposit() { let max_size = pallet_nfts::CollectionApprovals::::storage_info() diff --git a/runtime/testnet/src/config/assets.rs b/runtime/testnet/src/config/assets.rs index e46d7dbc..6a54f368 100644 --- a/runtime/testnet/src/config/assets.rs +++ b/runtime/testnet/src/config/assets.rs @@ -29,6 +29,8 @@ parameter_types! { parameter_types! { pub NftsPalletFeatures: PalletFeatures = PalletFeatures::all_enabled(); + // Key = 68 bytes (4+16+32+16), Value = 52 bytes (4+32+16) + pub const NftsCollectionBalanceDeposit: Balance = deposit(1, 120); pub const NftsCollectionDeposit: Balance = 10 * UNIT; // Key = 116 bytes (4+16+32+16+32+16), Value = 21 bytes (1+4+16) pub const NftsCollectionApprovalDeposit: Balance = deposit(1, 137); @@ -44,6 +46,7 @@ impl pallet_nfts::Config for Runtime { type ApprovalsLimit = ConstU32<20>; type AttributeDepositBase = NftsAttributeDepositBase; type CollectionApprovalDeposit = NftsCollectionApprovalDeposit; + type CollectionBalanceDeposit = NftsCollectionBalanceDeposit; type CollectionDeposit = NftsCollectionDeposit; // TODO: source from primitives type CollectionId = CollectionId; @@ -130,6 +133,15 @@ mod tests { use super::*; + #[test] + fn ensure_account_balance_deposit() { + let max_size = pallet_nfts::AccountBalance::::storage_info() + .first() + .and_then(|info| info.max_size) + .unwrap_or_default(); + assert_eq!(deposit(1, max_size), NftsCollectionBalanceDeposit::get()); + } + #[test] fn ensure_collection_approval_deposit() { let max_size = pallet_nfts::CollectionApprovals::::storage_info()