git.delta.rocks / unique-network / refs/commits / 2eecdab55d8c

difftreelog

Merge pull request #907 from UniqueNetwork/feature/nft-transfer-correct-weight

Yaroslav Bolyukin2023-04-19parents: #6e3cf5e #ff11326.patch.diff
in: master
feat(weight): added benchs for decompose weight

23 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6262,7 +6262,7 @@
 
 [[package]]
 name = "pallet-common"
-version = "0.1.13"
+version = "0.1.14"
 dependencies = [
  "ethereum",
  "evm-coder",
@@ -6558,7 +6558,7 @@
 
 [[package]]
 name = "pallet-fungible"
-version = "0.1.10"
+version = "0.1.11"
 dependencies = [
  "evm-coder",
  "frame-benchmarking",
@@ -6814,7 +6814,7 @@
 
 [[package]]
 name = "pallet-nonfungible"
-version = "0.1.13"
+version = "0.1.14"
 dependencies = [
  "evm-coder",
  "frame-benchmarking",
modifiedpallets/app-promotion/src/lib.rsdiffbeforeafterboth
--- a/pallets/app-promotion/src/lib.rs
+++ b/pallets/app-promotion/src/lib.rs
@@ -845,7 +845,6 @@
 	/// - `staker`: staker account.
 	pub fn total_staked_by_id(staker: impl EncodeLike<T::AccountId>) -> Option<BalanceOf<T>> {
 		let staked = Staked::<T>::iter_prefix((staker,))
-			.into_iter()
 			.fold(<BalanceOf<T>>::default(), |acc, (_, (amount, _))| {
 				acc + amount
 			});
@@ -864,7 +863,6 @@
 		staker: impl EncodeLike<T::AccountId>,
 	) -> Option<Vec<(T::BlockNumber, BalanceOf<T>)>> {
 		let mut staked = Staked::<T>::iter_prefix((staker,))
-			.into_iter()
 			.map(|(block, (amount, _))| (block, amount))
 			.collect::<Vec<_>>();
 		staked.sort_by_key(|(block, _)| *block);
@@ -883,12 +881,6 @@
 			Self::total_staked_by_id(s.as_sub())
 		})
 	}
-
-	// pub fn cross_id_locked_balance(staker: T::CrossAccountId) -> BalanceOf<T> {
-	// 	Self::get_locked_balance(staker.as_sub())
-	// 		.map(|l| l.amount)
-	// 		.unwrap_or_default()
-	// }
 
 	/// Returns all relay block numbers when stake was made,
 	/// the amount of the stake.
modifiedpallets/common/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/common/CHANGELOG.md
+++ b/pallets/common/CHANGELOG.md
@@ -4,6 +4,12 @@
 
 <!-- bureaucrate goes here -->
 
+## [0.1.14] - 2023-03-28
+
+### Added
+
+- Added benchmark to check if user is contained in AllowList (`check_accesslist()`).
+
 ## [0.1.13] - 2023-01-20
 
 ### Changed
modifiedpallets/common/Cargo.tomldiffbeforeafterboth
--- a/pallets/common/Cargo.toml
+++ b/pallets/common/Cargo.toml
@@ -2,7 +2,7 @@
 edition = "2021"
 license = "GPLv3"
 name = "pallet-common"
-version = "0.1.13"
+version = "0.1.14"
 
 [dependencies]
 # Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.
modifiedpallets/common/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/common/src/benchmarking.rs
+++ b/pallets/common/src/benchmarking.rs
@@ -22,8 +22,9 @@
 use frame_benchmarking::{benchmarks, account};
 use up_data_structs::{
 	CollectionMode, CollectionFlags, CreateCollectionData, CollectionId, Property, PropertyKey,
-	PropertyValue, CollectionPermissions, NestingPermissions, MAX_COLLECTION_NAME_LENGTH,
-	MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH, MAX_PROPERTIES_PER_ITEM,
+	PropertyValue, CollectionPermissions, NestingPermissions, AccessMode,
+	MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
+	MAX_PROPERTIES_PER_ITEM,
 };
 use frame_support::{
 	traits::{Currency, Get},
@@ -193,4 +194,28 @@
 		<Pallet<T>>::set_collection_properties(&collection, &owner, props.into_iter())?;
 		let to_delete = (0..b).map(|p| property_key(p as usize)).collect::<Vec<_>>();
 	}: {<Pallet<T>>::delete_collection_properties(&collection, &owner, to_delete.into_iter())?}
+
+	check_accesslist{
+		bench_init!{
+			owner: sub; collection: collection(owner);
+			sender: cross_from_sub(owner);
+		};
+
+		let mut collection_handle = <CollectionHandle<T>>::try_get(collection.id)?;
+			<Pallet<T>>::update_permissions(
+				&sender,
+				&mut collection_handle,
+				CollectionPermissions { access: Some(AccessMode::AllowList), ..Default::default() }
+			)?;
+
+		<Pallet<T>>::toggle_allowlist(
+				&collection,
+				&sender,
+				&sender,
+				true,
+			)?;
+
+		assert_eq!(collection_handle.permissions.access(), AccessMode::AllowList);
+
+	}: {collection_handle.check_allowlist(&sender)?;}
 }
addedpallets/common/src/helpers.rsdiffbeforeafterboth
--- /dev/null
+++ b/pallets/common/src/helpers.rs
@@ -0,0 +1,30 @@
+//! # Helpers module
+//!
+//! The module contains helpers.
+//!
+use frame_support::{
+	pallet_prelude::DispatchResultWithPostInfo,
+	weights::Weight,
+	dispatch::{DispatchErrorWithPostInfo, PostDispatchInfo},
+};
+
+/// Add weight for a `DispatchResultWithPostInfo`
+///
+/// - `target`: DispatchResultWithPostInfo to which weight will be added
+/// - `additional_weight`: Weight to be added
+pub fn add_weight_to_post_info(target: &mut DispatchResultWithPostInfo, additional_weight: Weight) {
+	match target {
+		Ok(PostDispatchInfo {
+			actual_weight: Some(weight),
+			..
+		})
+		| Err(DispatchErrorWithPostInfo {
+			post_info: PostDispatchInfo {
+				actual_weight: Some(weight),
+				..
+			},
+			..
+		}) => *weight += additional_weight,
+		_ => {}
+	}
+}
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -92,9 +92,9 @@
 pub mod dispatch;
 pub mod erc;
 pub mod eth;
+pub mod helpers;
 #[allow(missing_docs)]
 pub mod weights;
-
 /// Weight info.
 pub type SelfWeightOf<T> = <T as Config>::WeightInfo;
 
modifiedpallets/common/src/weights.rsdiffbeforeafterboth
--- a/pallets/common/src/weights.rs
+++ b/pallets/common/src/weights.rs
@@ -36,6 +36,7 @@
 pub trait WeightInfo {
 	fn set_collection_properties(b: u32, ) -> Weight;
 	fn delete_collection_properties(b: u32, ) -> Weight;
+	fn check_accesslist() -> Weight;
 }
 
 /// Weights for pallet_common using the Substrate node and recommended hardware.
@@ -69,6 +70,16 @@
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
+	/// Storage: Common Allowlist (r:1 w:0)
+	/// Proof: Common Allowlist (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)
+	fn check_accesslist() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `340`
+		//  Estimated: `2545`
+		// Minimum execution time: 2_887_000 picoseconds.
+		Weight::from_parts(3_072_000, 2545)
+			.saturating_add(T::DbWeight::get().reads(1_u64))
+	}
 }
 
 // For backwards compatibility and tests
@@ -101,5 +112,15 @@
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
+	/// Storage: Common Allowlist (r:1 w:0)
+	/// Proof: Common Allowlist (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)
+	fn check_accesslist() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `340`
+		//  Estimated: `2545`
+		// Minimum execution time: 2_887_000 picoseconds.
+		Weight::from_parts(3_072_000, 2545)
+			.saturating_add(RocksDbWeight::get().reads(1_u64))
+	}
 }
 
modifiedpallets/foreign-assets/src/impl_fungibles.rsdiffbeforeafterboth
--- a/pallets/foreign-assets/src/impl_fungibles.rs
+++ b/pallets/foreign-assets/src/impl_fungibles.rs
@@ -452,7 +452,8 @@
 					&T::CrossAccountId::from_sub(dest.clone()),
 					amount.into(),
 					&Value::new(0),
-				)?;
+				)
+				.map_err(|e| e.error)?;
 
 				Ok(amount)
 			}
modifiedpallets/fungible/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/fungible/CHANGELOG.md
+++ b/pallets/fungible/CHANGELOG.md
@@ -4,6 +4,12 @@
 
 <!-- bureaucrate goes here -->
 
+## [0.1.11] - 2023-03-28
+
+### Fixed
+
+- The weight of `transfer` and `transfer_from`.
+
 ## [0.1.10] - 2023-02-01
 
 ### Added
modifiedpallets/fungible/Cargo.tomldiffbeforeafterboth
--- a/pallets/fungible/Cargo.toml
+++ b/pallets/fungible/Cargo.toml
@@ -2,7 +2,7 @@
 edition = "2021"
 license = "GPLv3"
 name = "pallet-fungible"
-version = "0.1.10"
+version = "0.1.11"
 
 [dependencies]
 # Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.
modifiedpallets/fungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/fungible/src/benchmarking.rs
+++ b/pallets/fungible/src/benchmarking.rs
@@ -66,7 +66,7 @@
 		<Pallet<T>>::create_item(&collection, &owner, (burner.clone(), 200), &Unlimited)?;
 	}: {<Pallet<T>>::burn(&collection, &burner, 100)?}
 
-	transfer {
+	transfer_raw {
 		bench_init!{
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; to: cross_sub;
@@ -92,14 +92,22 @@
 		<Pallet<T>>::create_item(&collection, &owner, (owner_eth.clone(), 200), &Unlimited)?;
 	}: {<Pallet<T>>::set_allowance_from(&collection, &sender, &owner_eth, &spender, 100)?}
 
-	transfer_from {
+	check_allowed_raw {
 		bench_init!{
 			owner: sub; collection: collection(owner);
-			owner: cross_from_sub; sender: cross_sub; spender: cross_sub; receiver: cross_sub;
+			owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
 		};
 		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
 		<Pallet<T>>::set_allowance(&collection, &sender, &spender, 200)?;
-	}: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, 100, &Unlimited)?}
+	}: {<Pallet<T>>::check_allowed(&collection, &spender, &sender, 200, &Unlimited)?;}
+
+	set_allowance_unchecked_raw {
+		bench_init!{
+			owner: sub; collection: collection(owner);
+			owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
+		};
+		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
+	}: {<Pallet<T>>::set_allowance_unchecked(&collection, &sender, &spender, 200);}
 
 	burn_from {
 		bench_init!{
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
before · pallets/fungible/src/common.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use core::marker::PhantomData;1819use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, traits::Get};20use up_data_structs::{21	TokenId, CollectionId, CreateItemExData, budget::Budget, CreateItemData, TokenOwnerError,22};23use pallet_common::{24	CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,25	weights::WeightInfo as _,26};27use pallet_structure::Error as StructureError;28use sp_runtime::ArithmeticError;29use sp_std::{vec::Vec, vec};30use up_data_structs::{Property, PropertyKey, PropertyValue, PropertyKeyPermission};3132use crate::{33	Allowance, TotalSupply, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf,34	weights::WeightInfo,35};3637pub struct CommonWeights<T: Config>(PhantomData<T>);38impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {39	fn create_multiple_items(_data: &[CreateItemData]) -> Weight {40		// All items minted for the same user, so it works same as create_item41		<SelfWeightOf<T>>::create_item()42	}4344	fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {45		match data {46			CreateItemExData::Fungible(f) => {47				<SelfWeightOf<T>>::create_multiple_items_ex(f.len() as u32)48			}49			_ => Weight::zero(),50		}51	}5253	fn burn_item() -> Weight {54		<SelfWeightOf<T>>::burn_item()55	}5657	fn set_collection_properties(amount: u32) -> Weight {58		<pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)59	}6061	fn delete_collection_properties(amount: u32) -> Weight {62		<pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)63	}6465	fn set_token_properties(_amount: u32) -> Weight {66		// Error67		Weight::zero()68	}6970	fn delete_token_properties(_amount: u32) -> Weight {71		// Error72		Weight::zero()73	}7475	fn set_token_property_permissions(_amount: u32) -> Weight {76		// Error77		Weight::zero()78	}7980	fn transfer() -> Weight {81		<SelfWeightOf<T>>::transfer()82	}8384	fn approve() -> Weight {85		<SelfWeightOf<T>>::approve()86	}8788	fn approve_from() -> Weight {89		<SelfWeightOf<T>>::approve_from()90	}9192	fn transfer_from() -> Weight {93		<SelfWeightOf<T>>::transfer_from()94	}9596	fn burn_from() -> Weight {97		<SelfWeightOf<T>>::burn_from()98	}99100	fn burn_recursively_self_raw() -> Weight {101		// Read to get total balance102		Self::burn_item() + T::DbWeight::get().reads(1)103	}104105	fn burn_recursively_breadth_raw(_amount: u32) -> Weight {106		// Fungible tokens can't have children107		Weight::zero()108	}109110	fn token_owner() -> Weight {111		Weight::zero()112	}113114	fn set_allowance_for_all() -> Weight {115		Weight::zero()116	}117118	fn force_repair_item() -> Weight {119		Weight::zero()120	}121}122123/// Implementation of `CommonCollectionOperations` for `FungibleHandle`. It wraps FungibleHandle Pallete124/// methods and adds weight info.125impl<T: Config> CommonCollectionOperations<T> for FungibleHandle<T> {126	fn create_item(127		&self,128		sender: T::CrossAccountId,129		to: T::CrossAccountId,130		data: up_data_structs::CreateItemData,131		nesting_budget: &dyn Budget,132	) -> DispatchResultWithPostInfo {133		match &data {134			up_data_structs::CreateItemData::Fungible(fungible_data) => with_weight(135				<Pallet<T>>::create_item(self, &sender, (to, fungible_data.value), nesting_budget),136				<CommonWeights<T>>::create_item(&data),137			),138			_ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),139		}140	}141142	fn create_multiple_items(143		&self,144		sender: T::CrossAccountId,145		to: T::CrossAccountId,146		data: Vec<up_data_structs::CreateItemData>,147		nesting_budget: &dyn Budget,148	) -> DispatchResultWithPostInfo {149		let mut sum: u128 = 0;150		for data in &data {151			match &data {152				up_data_structs::CreateItemData::Fungible(data) => {153					sum = sum154						.checked_add(data.value)155						.ok_or(ArithmeticError::Overflow)?;156				}157				_ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),158			}159		}160161		with_weight(162			<Pallet<T>>::create_item(self, &sender, (to, sum), nesting_budget),163			<CommonWeights<T>>::create_multiple_items(&data),164		)165	}166167	fn create_multiple_items_ex(168		&self,169		sender: <T>::CrossAccountId,170		data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,171		nesting_budget: &dyn Budget,172	) -> DispatchResultWithPostInfo {173		let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);174		let data = match data {175			up_data_structs::CreateItemExData::Fungible(f) => f,176			_ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),177		};178179		with_weight(180			<Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),181			weight,182		)183	}184185	fn burn_item(186		&self,187		sender: T::CrossAccountId,188		token: TokenId,189		amount: u128,190	) -> DispatchResultWithPostInfo {191		ensure!(192			token == TokenId::default(),193			<Error<T>>::FungibleItemsHaveNoId194		);195196		with_weight(197			<Pallet<T>>::burn(self, &sender, amount),198			<CommonWeights<T>>::burn_item(),199		)200	}201202	fn burn_item_recursively(203		&self,204		sender: T::CrossAccountId,205		token: TokenId,206		self_budget: &dyn Budget,207		_breadth_budget: &dyn Budget,208	) -> DispatchResultWithPostInfo {209		// Should not happen?210		ensure!(211			token == TokenId::default(),212			<Error<T>>::FungibleItemsHaveNoId213		);214		ensure!(self_budget.consume(), <StructureError<T>>::DepthLimit,);215216		with_weight(217			<Pallet<T>>::burn(self, &sender, <Balance<T>>::get((self.id, &sender))),218			<CommonWeights<T>>::burn_recursively_self_raw(),219		)220	}221222	fn transfer(223		&self,224		from: T::CrossAccountId,225		to: T::CrossAccountId,226		token: TokenId,227		amount: u128,228		nesting_budget: &dyn Budget,229	) -> DispatchResultWithPostInfo {230		ensure!(231			token == TokenId::default(),232			<Error<T>>::FungibleItemsHaveNoId233		);234235		with_weight(236			<Pallet<T>>::transfer(self, &from, &to, amount, nesting_budget),237			<CommonWeights<T>>::transfer(),238		)239	}240241	fn approve(242		&self,243		sender: T::CrossAccountId,244		spender: T::CrossAccountId,245		token: TokenId,246		amount: u128,247	) -> DispatchResultWithPostInfo {248		ensure!(249			token == TokenId::default(),250			<Error<T>>::FungibleItemsHaveNoId251		);252253		with_weight(254			<Pallet<T>>::set_allowance(self, &sender, &spender, amount),255			<CommonWeights<T>>::approve(),256		)257	}258259	fn approve_from(260		&self,261		sender: T::CrossAccountId,262		from: T::CrossAccountId,263		to: T::CrossAccountId,264		token: TokenId,265		amount: u128,266	) -> DispatchResultWithPostInfo {267		ensure!(268			token == TokenId::default(),269			<Error<T>>::FungibleItemsHaveNoId270		);271272		with_weight(273			<Pallet<T>>::set_allowance_from(self, &sender, &from, &to, amount),274			<CommonWeights<T>>::approve_from(),275		)276	}277278	fn transfer_from(279		&self,280		sender: T::CrossAccountId,281		from: T::CrossAccountId,282		to: T::CrossAccountId,283		token: TokenId,284		amount: u128,285		nesting_budget: &dyn Budget,286	) -> DispatchResultWithPostInfo {287		ensure!(288			token == TokenId::default(),289			<Error<T>>::FungibleItemsHaveNoId290		);291292		with_weight(293			<Pallet<T>>::transfer_from(self, &sender, &from, &to, amount, nesting_budget),294			<CommonWeights<T>>::transfer_from(),295		)296	}297298	fn burn_from(299		&self,300		sender: T::CrossAccountId,301		from: T::CrossAccountId,302		token: TokenId,303		amount: u128,304		nesting_budget: &dyn Budget,305	) -> DispatchResultWithPostInfo {306		ensure!(307			token == TokenId::default(),308			<Error<T>>::FungibleItemsHaveNoId309		);310311		with_weight(312			<Pallet<T>>::burn_from(self, &sender, &from, amount, nesting_budget),313			<CommonWeights<T>>::burn_from(),314		)315	}316317	fn set_collection_properties(318		&self,319		sender: T::CrossAccountId,320		properties: Vec<Property>,321	) -> DispatchResultWithPostInfo {322		let weight = <CommonWeights<T>>::set_collection_properties(properties.len() as u32);323324		with_weight(325			<Pallet<T>>::set_collection_properties(self, &sender, properties),326			weight,327		)328	}329330	fn delete_collection_properties(331		&self,332		sender: &T::CrossAccountId,333		property_keys: Vec<PropertyKey>,334	) -> DispatchResultWithPostInfo {335		let weight = <CommonWeights<T>>::delete_collection_properties(property_keys.len() as u32);336337		with_weight(338			<Pallet<T>>::delete_collection_properties(self, sender, property_keys),339			weight,340		)341	}342343	fn set_token_properties(344		&self,345		_sender: T::CrossAccountId,346		_token_id: TokenId,347		_property: Vec<Property>,348		_nesting_budget: &dyn Budget,349	) -> DispatchResultWithPostInfo {350		fail!(<Error<T>>::SettingPropertiesNotAllowed)351	}352353	fn set_token_property_permissions(354		&self,355		_sender: &T::CrossAccountId,356		_property_permissions: Vec<PropertyKeyPermission>,357	) -> DispatchResultWithPostInfo {358		fail!(<Error<T>>::SettingPropertiesNotAllowed)359	}360361	fn delete_token_properties(362		&self,363		_sender: T::CrossAccountId,364		_token_id: TokenId,365		_property_keys: Vec<PropertyKey>,366		_nesting_budget: &dyn Budget,367	) -> DispatchResultWithPostInfo {368		fail!(<Error<T>>::SettingPropertiesNotAllowed)369	}370371	fn check_nesting(372		&self,373		_sender: <T>::CrossAccountId,374		_from: (CollectionId, TokenId),375		_under: TokenId,376		_nesting_budget: &dyn Budget,377	) -> sp_runtime::DispatchResult {378		fail!(<Error<T>>::FungibleDisallowsNesting)379	}380381	fn nest(&self, _under: TokenId, _to_nest: (CollectionId, TokenId)) {}382383	fn unnest(&self, _under: TokenId, _to_nest: (CollectionId, TokenId)) {}384385	fn collection_tokens(&self) -> Vec<TokenId> {386		vec![TokenId::default()]387	}388389	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {390		if <Balance<T>>::get((self.id, account)) != 0 {391			vec![TokenId::default()]392		} else {393			vec![]394		}395	}396397	fn token_exists(&self, token: TokenId) -> bool {398		token == TokenId::default()399	}400401	fn last_token_id(&self) -> TokenId {402		TokenId::default()403	}404405	fn token_owner(&self, _token: TokenId) -> Result<T::CrossAccountId, TokenOwnerError> {406		Err(TokenOwnerError::MultipleOwners)407	}408409	/// Returns 10 tokens owners in no particular order.410	fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {411		<Pallet<T>>::token_owners(self.id, token).unwrap_or_default()412	}413414	fn token_property(&self, _token_id: TokenId, _key: &PropertyKey) -> Option<PropertyValue> {415		None416	}417418	fn token_properties(419		&self,420		_token_id: TokenId,421		_keys: Option<Vec<PropertyKey>>,422	) -> Vec<Property> {423		Vec::new()424	}425426	fn total_supply(&self) -> u32 {427		1428	}429430	fn account_balance(&self, account: T::CrossAccountId) -> u32 {431		if <Balance<T>>::get((self.id, account)) != 0 {432			1433		} else {434			0435		}436	}437438	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {439		if token != TokenId::default() {440			return 0;441		}442		<Balance<T>>::get((self.id, account))443	}444445	fn allowance(446		&self,447		sender: T::CrossAccountId,448		spender: T::CrossAccountId,449		token: TokenId,450	) -> u128 {451		if token != TokenId::default() {452			return 0;453		}454		<Allowance<T>>::get((self.id, sender, spender))455	}456457	fn refungible_extensions(&self) -> Option<&dyn RefungibleExtensions<T>> {458		None459	}460461	fn total_pieces(&self, token: TokenId) -> Option<u128> {462		if token != TokenId::default() {463			return None;464		}465		<TotalSupply<T>>::try_get(self.id).ok()466	}467468	fn set_allowance_for_all(469		&self,470		_owner: T::CrossAccountId,471		_operator: T::CrossAccountId,472		_approve: bool,473	) -> DispatchResultWithPostInfo {474		fail!(<Error<T>>::SettingAllowanceForAllNotAllowed)475	}476477	fn allowance_for_all(&self, _owner: T::CrossAccountId, _operator: T::CrossAccountId) -> bool {478		false479	}480481	/// Repairs a possibly broken item.482	fn repair_item(&self, _token: TokenId) -> DispatchResultWithPostInfo {483		fail!(<Error<T>>::FungibleTokensAreAlwaysValid)484	}485}
after · pallets/fungible/src/common.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use core::marker::PhantomData;1819use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, traits::Get};20use up_data_structs::{21	TokenId, CollectionId, CreateItemExData, budget::Budget, CreateItemData, TokenOwnerError,22};23use pallet_common::{24	CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,25	weights::WeightInfo as _, SelfWeightOf as PalletCommonWeightOf,26};27use pallet_structure::Error as StructureError;28use sp_runtime::ArithmeticError;29use sp_std::{vec::Vec, vec};30use up_data_structs::{Property, PropertyKey, PropertyValue, PropertyKeyPermission};3132use crate::{33	Allowance, TotalSupply, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf,34	weights::WeightInfo,35};3637pub struct CommonWeights<T: Config>(PhantomData<T>);38impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {39	fn create_multiple_items(_data: &[CreateItemData]) -> Weight {40		// All items minted for the same user, so it works same as create_item41		<SelfWeightOf<T>>::create_item()42	}4344	fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {45		match data {46			CreateItemExData::Fungible(f) => {47				<SelfWeightOf<T>>::create_multiple_items_ex(f.len() as u32)48			}49			_ => Weight::zero(),50		}51	}5253	fn burn_item() -> Weight {54		<SelfWeightOf<T>>::burn_item()55	}5657	fn set_collection_properties(amount: u32) -> Weight {58		<pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)59	}6061	fn delete_collection_properties(amount: u32) -> Weight {62		<pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)63	}6465	fn set_token_properties(_amount: u32) -> Weight {66		// Error67		Weight::zero()68	}6970	fn delete_token_properties(_amount: u32) -> Weight {71		// Error72		Weight::zero()73	}7475	fn set_token_property_permissions(_amount: u32) -> Weight {76		// Error77		Weight::zero()78	}7980	fn transfer() -> Weight {81		<SelfWeightOf<T>>::transfer_raw() + <PalletCommonWeightOf<T>>::check_accesslist() * 282	}8384	fn approve() -> Weight {85		<SelfWeightOf<T>>::approve()86	}8788	fn approve_from() -> Weight {89		<SelfWeightOf<T>>::approve_from()90	}9192	fn transfer_from() -> Weight {93		Self::transfer()94			+ <SelfWeightOf<T>>::check_allowed_raw()95			+ <SelfWeightOf<T>>::set_allowance_unchecked_raw()96	}9798	fn burn_from() -> Weight {99		<SelfWeightOf<T>>::burn_from()100	}101102	fn burn_recursively_self_raw() -> Weight {103		// Read to get total balance104		Self::burn_item() + T::DbWeight::get().reads(1)105	}106107	fn burn_recursively_breadth_raw(_amount: u32) -> Weight {108		// Fungible tokens can't have children109		Weight::zero()110	}111112	fn token_owner() -> Weight {113		Weight::zero()114	}115116	fn set_allowance_for_all() -> Weight {117		Weight::zero()118	}119120	fn force_repair_item() -> Weight {121		Weight::zero()122	}123}124125/// Implementation of `CommonCollectionOperations` for `FungibleHandle`. It wraps FungibleHandle Pallete126/// methods and adds weight info.127impl<T: Config> CommonCollectionOperations<T> for FungibleHandle<T> {128	fn create_item(129		&self,130		sender: T::CrossAccountId,131		to: T::CrossAccountId,132		data: up_data_structs::CreateItemData,133		nesting_budget: &dyn Budget,134	) -> DispatchResultWithPostInfo {135		match &data {136			up_data_structs::CreateItemData::Fungible(fungible_data) => with_weight(137				<Pallet<T>>::create_item(self, &sender, (to, fungible_data.value), nesting_budget),138				<CommonWeights<T>>::create_item(&data),139			),140			_ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),141		}142	}143144	fn create_multiple_items(145		&self,146		sender: T::CrossAccountId,147		to: T::CrossAccountId,148		data: Vec<up_data_structs::CreateItemData>,149		nesting_budget: &dyn Budget,150	) -> DispatchResultWithPostInfo {151		let mut sum: u128 = 0;152		for data in &data {153			match &data {154				up_data_structs::CreateItemData::Fungible(data) => {155					sum = sum156						.checked_add(data.value)157						.ok_or(ArithmeticError::Overflow)?;158				}159				_ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),160			}161		}162163		with_weight(164			<Pallet<T>>::create_item(self, &sender, (to, sum), nesting_budget),165			<CommonWeights<T>>::create_multiple_items(&data),166		)167	}168169	fn create_multiple_items_ex(170		&self,171		sender: <T>::CrossAccountId,172		data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,173		nesting_budget: &dyn Budget,174	) -> DispatchResultWithPostInfo {175		let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);176		let data = match data {177			up_data_structs::CreateItemExData::Fungible(f) => f,178			_ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),179		};180181		with_weight(182			<Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),183			weight,184		)185	}186187	fn burn_item(188		&self,189		sender: T::CrossAccountId,190		token: TokenId,191		amount: u128,192	) -> DispatchResultWithPostInfo {193		ensure!(194			token == TokenId::default(),195			<Error<T>>::FungibleItemsHaveNoId196		);197198		with_weight(199			<Pallet<T>>::burn(self, &sender, amount),200			<CommonWeights<T>>::burn_item(),201		)202	}203204	fn burn_item_recursively(205		&self,206		sender: T::CrossAccountId,207		token: TokenId,208		self_budget: &dyn Budget,209		_breadth_budget: &dyn Budget,210	) -> DispatchResultWithPostInfo {211		// Should not happen?212		ensure!(213			token == TokenId::default(),214			<Error<T>>::FungibleItemsHaveNoId215		);216		ensure!(self_budget.consume(), <StructureError<T>>::DepthLimit,);217218		with_weight(219			<Pallet<T>>::burn(self, &sender, <Balance<T>>::get((self.id, &sender))),220			<CommonWeights<T>>::burn_recursively_self_raw(),221		)222	}223224	fn transfer(225		&self,226		from: T::CrossAccountId,227		to: T::CrossAccountId,228		token: TokenId,229		amount: u128,230		nesting_budget: &dyn Budget,231	) -> DispatchResultWithPostInfo {232		ensure!(233			token == TokenId::default(),234			<Error<T>>::FungibleItemsHaveNoId235		);236237		<Pallet<T>>::transfer(self, &from, &to, amount, nesting_budget)238	}239240	fn approve(241		&self,242		sender: T::CrossAccountId,243		spender: T::CrossAccountId,244		token: TokenId,245		amount: u128,246	) -> DispatchResultWithPostInfo {247		ensure!(248			token == TokenId::default(),249			<Error<T>>::FungibleItemsHaveNoId250		);251252		with_weight(253			<Pallet<T>>::set_allowance(self, &sender, &spender, amount),254			<CommonWeights<T>>::approve(),255		)256	}257258	fn approve_from(259		&self,260		sender: T::CrossAccountId,261		from: T::CrossAccountId,262		to: T::CrossAccountId,263		token: TokenId,264		amount: u128,265	) -> DispatchResultWithPostInfo {266		ensure!(267			token == TokenId::default(),268			<Error<T>>::FungibleItemsHaveNoId269		);270271		with_weight(272			<Pallet<T>>::set_allowance_from(self, &sender, &from, &to, amount),273			<CommonWeights<T>>::approve_from(),274		)275	}276277	fn transfer_from(278		&self,279		sender: T::CrossAccountId,280		from: T::CrossAccountId,281		to: T::CrossAccountId,282		token: TokenId,283		amount: u128,284		nesting_budget: &dyn Budget,285	) -> DispatchResultWithPostInfo {286		ensure!(287			token == TokenId::default(),288			<Error<T>>::FungibleItemsHaveNoId289		);290291		<Pallet<T>>::transfer_from(self, &sender, &from, &to, amount, nesting_budget)292	}293294	fn burn_from(295		&self,296		sender: T::CrossAccountId,297		from: T::CrossAccountId,298		token: TokenId,299		amount: u128,300		nesting_budget: &dyn Budget,301	) -> DispatchResultWithPostInfo {302		ensure!(303			token == TokenId::default(),304			<Error<T>>::FungibleItemsHaveNoId305		);306307		with_weight(308			<Pallet<T>>::burn_from(self, &sender, &from, amount, nesting_budget),309			<CommonWeights<T>>::burn_from(),310		)311	}312313	fn set_collection_properties(314		&self,315		sender: T::CrossAccountId,316		properties: Vec<Property>,317	) -> DispatchResultWithPostInfo {318		let weight = <CommonWeights<T>>::set_collection_properties(properties.len() as u32);319320		with_weight(321			<Pallet<T>>::set_collection_properties(self, &sender, properties),322			weight,323		)324	}325326	fn delete_collection_properties(327		&self,328		sender: &T::CrossAccountId,329		property_keys: Vec<PropertyKey>,330	) -> DispatchResultWithPostInfo {331		let weight = <CommonWeights<T>>::delete_collection_properties(property_keys.len() as u32);332333		with_weight(334			<Pallet<T>>::delete_collection_properties(self, sender, property_keys),335			weight,336		)337	}338339	fn set_token_properties(340		&self,341		_sender: T::CrossAccountId,342		_token_id: TokenId,343		_property: Vec<Property>,344		_nesting_budget: &dyn Budget,345	) -> DispatchResultWithPostInfo {346		fail!(<Error<T>>::SettingPropertiesNotAllowed)347	}348349	fn set_token_property_permissions(350		&self,351		_sender: &T::CrossAccountId,352		_property_permissions: Vec<PropertyKeyPermission>,353	) -> DispatchResultWithPostInfo {354		fail!(<Error<T>>::SettingPropertiesNotAllowed)355	}356357	fn delete_token_properties(358		&self,359		_sender: T::CrossAccountId,360		_token_id: TokenId,361		_property_keys: Vec<PropertyKey>,362		_nesting_budget: &dyn Budget,363	) -> DispatchResultWithPostInfo {364		fail!(<Error<T>>::SettingPropertiesNotAllowed)365	}366367	fn check_nesting(368		&self,369		_sender: <T>::CrossAccountId,370		_from: (CollectionId, TokenId),371		_under: TokenId,372		_nesting_budget: &dyn Budget,373	) -> sp_runtime::DispatchResult {374		fail!(<Error<T>>::FungibleDisallowsNesting)375	}376377	fn nest(&self, _under: TokenId, _to_nest: (CollectionId, TokenId)) {}378379	fn unnest(&self, _under: TokenId, _to_nest: (CollectionId, TokenId)) {}380381	fn collection_tokens(&self) -> Vec<TokenId> {382		vec![TokenId::default()]383	}384385	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {386		if <Balance<T>>::get((self.id, account)) != 0 {387			vec![TokenId::default()]388		} else {389			vec![]390		}391	}392393	fn token_exists(&self, token: TokenId) -> bool {394		token == TokenId::default()395	}396397	fn last_token_id(&self) -> TokenId {398		TokenId::default()399	}400401	fn token_owner(&self, _token: TokenId) -> Result<T::CrossAccountId, TokenOwnerError> {402		Err(TokenOwnerError::MultipleOwners)403	}404405	/// Returns 10 tokens owners in no particular order.406	fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {407		<Pallet<T>>::token_owners(self.id, token).unwrap_or_default()408	}409410	fn token_property(&self, _token_id: TokenId, _key: &PropertyKey) -> Option<PropertyValue> {411		None412	}413414	fn token_properties(415		&self,416		_token_id: TokenId,417		_keys: Option<Vec<PropertyKey>>,418	) -> Vec<Property> {419		Vec::new()420	}421422	fn total_supply(&self) -> u32 {423		1424	}425426	fn account_balance(&self, account: T::CrossAccountId) -> u32 {427		if <Balance<T>>::get((self.id, account)) != 0 {428			1429		} else {430			0431		}432	}433434	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {435		if token != TokenId::default() {436			return 0;437		}438		<Balance<T>>::get((self.id, account))439	}440441	fn allowance(442		&self,443		sender: T::CrossAccountId,444		spender: T::CrossAccountId,445		token: TokenId,446	) -> u128 {447		if token != TokenId::default() {448			return 0;449		}450		<Allowance<T>>::get((self.id, sender, spender))451	}452453	fn refungible_extensions(&self) -> Option<&dyn RefungibleExtensions<T>> {454		None455	}456457	fn total_pieces(&self, token: TokenId) -> Option<u128> {458		if token != TokenId::default() {459			return None;460		}461		<TotalSupply<T>>::try_get(self.id).ok()462	}463464	fn set_allowance_for_all(465		&self,466		_owner: T::CrossAccountId,467		_operator: T::CrossAccountId,468		_approve: bool,469	) -> DispatchResultWithPostInfo {470		fail!(<Error<T>>::SettingAllowanceForAllNotAllowed)471	}472473	fn allowance_for_all(&self, _owner: T::CrossAccountId, _operator: T::CrossAccountId) -> bool {474		false475	}476477	/// Repairs a possibly broken item.478	fn repair_item(&self, _token: TokenId) -> DispatchResultWithPostInfo {479		fail!(<Error<T>>::FungibleTokensAreAlwaysValid)480	}481}
modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -26,6 +26,7 @@
 	CollectionHandle,
 	erc::{CommonEvmHandler, PrecompileResult, CollectionCall},
 	eth::CrossAddress,
+	CommonWeightInfo as _,
 };
 use sp_std::vec::Vec;
 use pallet_evm::{account::CrossAccountId, PrecompileHandle};
@@ -39,7 +40,7 @@
 
 use crate::{
 	Allowance, Balance, Config, FungibleHandle, Pallet, TotalSupply, SelfWeightOf,
-	weights::WeightInfo,
+	weights::WeightInfo, common::CommonWeights,
 };
 
 frontier_contract! {
@@ -99,7 +100,7 @@
 		let balance = <Balance<T>>::get((self.id, owner));
 		Ok(balance.into())
 	}
-	#[weight(<SelfWeightOf<T>>::transfer())]
+	#[weight(<CommonWeights<T>>::transfer())]
 	fn transfer(&mut self, caller: Caller, to: Address, amount: U256) -> Result<bool> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = T::CrossAccountId::from_eth(to);
@@ -112,7 +113,7 @@
 		Ok(true)
 	}
 
-	#[weight(<SelfWeightOf<T>>::transfer_from())]
+	#[weight(<CommonWeights<T>>::transfer_from())]
 	fn transfer_from(
 		&mut self,
 		caller: Caller,
@@ -129,7 +130,7 @@
 			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		<Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+			.map_err(|e| dispatch_to_evm::<T>(e.error))?;
 		Ok(true)
 	}
 	#[weight(<SelfWeightOf<T>>::approve())]
@@ -201,7 +202,7 @@
 		let budget = self
 			.recorder
 			.weight_calls_budget(<StructureWeight<T>>::find_parent());
-		<Pallet<T>>::create_item(&self, &caller, (to, amount), &budget)
+		<Pallet<T>>::create_item(self, &caller, (to, amount), &budget)
 			.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
@@ -289,7 +290,7 @@
 		Ok(true)
 	}
 
-	#[weight(<SelfWeightOf<T>>::transfer())]
+	#[weight(<CommonWeights<T>>::transfer())]
 	fn transfer_cross(&mut self, caller: Caller, to: CrossAddress, amount: U256) -> Result<bool> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = to.into_sub_cross_account::<T>()?;
@@ -302,7 +303,7 @@
 		Ok(true)
 	}
 
-	#[weight(<SelfWeightOf<T>>::transfer_from())]
+	#[weight(<CommonWeights<T>>::transfer_from())]
 	fn transfer_from_cross(
 		&mut self,
 		caller: Caller,
@@ -319,7 +320,7 @@
 			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		<Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+			.map_err(|e| dispatch_to_evm::<T>(e.error))?;
 		Ok(true)
 	}
 
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -80,7 +80,11 @@
 
 use core::ops::Deref;
 use evm_coder::ToLog;
-use frame_support::ensure;
+use frame_support::{
+	ensure,
+	pallet_prelude::{DispatchResultWithPostInfo, Pays},
+	dispatch::PostDispatchInfo,
+};
 use pallet_evm::account::CrossAccountId;
 use up_data_structs::{
 	AccessMode, CollectionId, CollectionFlags, TokenId, CreateCollectionData,
@@ -88,7 +92,8 @@
 };
 use pallet_common::{
 	Error as CommonError, Event as CommonEvent, Pallet as PalletCommon,
-	eth::collection_id_to_address,
+	eth::collection_id_to_address, SelfWeightOf as PalletCommonWeightOf,
+	weights::WeightInfo as CommonWeightInfo, helpers::add_weight_to_post_info,
 };
 use pallet_evm::Pallet as PalletEvm;
 use pallet_structure::Pallet as PalletStructure;
@@ -96,7 +101,7 @@
 use sp_core::H160;
 use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};
 use sp_std::{collections::btree_map::BTreeMap, vec::Vec};
-
+use weights::WeightInfo;
 pub use pallet::*;
 
 use crate::erc::ERC20Events;
@@ -389,18 +394,20 @@
 		to: &T::CrossAccountId,
 		amount: u128,
 		nesting_budget: &dyn Budget,
-	) -> DispatchResult {
+	) -> DispatchResultWithPostInfo {
 		ensure!(
 			collection.limits.transfers_enabled(),
 			<CommonError<T>>::TransferNotAllowed,
 		);
 
+		let mut actual_weight = <SelfWeightOf<T>>::transfer_raw();
+
 		if collection.permissions.access() == AccessMode::AllowList {
 			collection.check_allowlist(from)?;
 			collection.check_allowlist(to)?;
+			actual_weight += <PalletCommonWeightOf<T>>::check_accesslist() * 2;
 		}
 		<PalletCommon<T>>::ensure_correct_receiver(to)?;
-
 		let balance_from = <Balance<T>>::get((collection.id, from))
 			.checked_sub(amount)
 			.ok_or(<CommonError<T>>::TokenValueTooLow)?;
@@ -451,7 +458,11 @@
 			to.clone(),
 			amount,
 		));
-		Ok(())
+
+		Ok(PostDispatchInfo {
+			actual_weight: Some(actual_weight),
+			pays_fee: Pays::Yes,
+		})
 	}
 
 	/// Minting tokens for multiple IDs.
@@ -464,8 +475,8 @@
 		nesting_budget: &dyn Budget,
 	) -> DispatchResult {
 		let total_supply = data
-			.iter()
-			.map(|(_, v)| *v)
+			.values()
+			.copied()
 			.try_fold(<TotalSupply<T>>::get(collection.id), |acc, v| {
 				acc.checked_add(v)
 			})
@@ -718,7 +729,6 @@
 	/// Same as the [`transfer`][`Pallet::transfer`] but spender doesn't needs to be an owner of the token pieces.
 	/// The owner should set allowance for the spender to transfer pieces.
 	///	See [`set_allowance`][`Pallet::set_allowance`] for more details.
-
 	pub fn transfer_from(
 		collection: &FungibleHandle<T>,
 		spender: &T::CrossAccountId,
@@ -726,16 +736,23 @@
 		to: &T::CrossAccountId,
 		amount: u128,
 		nesting_budget: &dyn Budget,
-	) -> DispatchResult {
+	) -> DispatchResultWithPostInfo {
 		let allowance = Self::check_allowed(collection, spender, from, amount, nesting_budget)?;
 
 		// =========
 
-		Self::transfer(collection, from, to, amount, nesting_budget)?;
+		let mut result = Self::transfer(collection, from, to, amount, nesting_budget);
+		add_weight_to_post_info(&mut result, <SelfWeightOf<T>>::check_allowed_raw());
+		result?;
+
 		if let Some(allowance) = allowance {
 			Self::set_allowance_unchecked(collection, from, spender, allowance);
+			add_weight_to_post_info(
+				&mut result,
+				<SelfWeightOf<T>>::set_allowance_unchecked_raw(),
+			)
 		}
-		Ok(())
+		result
 	}
 
 	/// Burn fungible tokens from the account.
modifiedpallets/fungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -37,10 +37,11 @@
 	fn create_item() -> Weight;
 	fn create_multiple_items_ex(b: u32, ) -> Weight;
 	fn burn_item() -> Weight;
-	fn transfer() -> Weight;
+	fn transfer_raw() -> Weight;
 	fn approve() -> Weight;
 	fn approve_from() -> Weight;
-	fn transfer_from() -> Weight;
+	fn check_allowed_raw() -> Weight;
+	fn set_allowance_unchecked_raw() -> Weight;
 	fn burn_from() -> Weight;
 }
 
@@ -94,12 +95,12 @@
 	}
 	/// Storage: Fungible Balance (r:2 w:2)
 	/// Proof: Fungible Balance (max_values: None, max_size: Some(77), added: 2552, mode: MaxEncodedLen)
-	fn transfer() -> Weight {
+	fn transfer_raw() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `182`
 		//  Estimated: `5104`
-		// Minimum execution time: 13_832_000 picoseconds.
-		Weight::from_parts(14_064_000, 5104)
+		// Minimum execution time: 6_678_000 picoseconds.
+		Weight::from_parts(7_151_000, 5104)
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 			.saturating_add(T::DbWeight::get().writes(2_u64))
 	}
@@ -129,19 +130,26 @@
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: Fungible Allowance (r:1 w:1)
+	/// Storage: Fungible Allowance (r:1 w:0)
 	/// Proof: Fungible Allowance (max_values: None, max_size: Some(93), added: 2568, mode: MaxEncodedLen)
-	/// Storage: Fungible Balance (r:2 w:2)
-	/// Proof: Fungible Balance (max_values: None, max_size: Some(77), added: 2552, mode: MaxEncodedLen)
-	fn transfer_from() -> Weight {
+	fn check_allowed_raw() -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `300`
-		//  Estimated: `7672`
-		// Minimum execution time: 21_667_000 picoseconds.
-		Weight::from_parts(22_166_000, 7672)
-			.saturating_add(T::DbWeight::get().reads(3_u64))
-			.saturating_add(T::DbWeight::get().writes(3_u64))
+		//  Measured:  `210`
+		//  Estimated: `2568`
+		// Minimum execution time: 2_842_000 picoseconds.
+		Weight::from_parts(3_077_000, 2568)
+			.saturating_add(T::DbWeight::get().reads(1_u64))
 	}
+	/// Storage: Fungible Allowance (r:0 w:1)
+	/// Proof: Fungible Allowance (max_values: None, max_size: Some(93), added: 2568, mode: MaxEncodedLen)
+	fn set_allowance_unchecked_raw() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `0`
+		//  Estimated: `0`
+		// Minimum execution time: 2_532_000 picoseconds.
+		Weight::from_parts(2_680_000, 0)
+			.saturating_add(T::DbWeight::get().writes(1_u64))
+	}
 	/// Storage: Fungible Allowance (r:1 w:1)
 	/// Proof: Fungible Allowance (max_values: None, max_size: Some(93), added: 2568, mode: MaxEncodedLen)
 	/// Storage: Fungible TotalSupply (r:1 w:1)
@@ -208,12 +216,12 @@
 	}
 	/// Storage: Fungible Balance (r:2 w:2)
 	/// Proof: Fungible Balance (max_values: None, max_size: Some(77), added: 2552, mode: MaxEncodedLen)
-	fn transfer() -> Weight {
+	fn transfer_raw() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `182`
 		//  Estimated: `5104`
-		// Minimum execution time: 13_832_000 picoseconds.
-		Weight::from_parts(14_064_000, 5104)
+		// Minimum execution time: 6_678_000 picoseconds.
+		Weight::from_parts(7_151_000, 5104)
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 			.saturating_add(RocksDbWeight::get().writes(2_u64))
 	}
@@ -243,18 +251,25 @@
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: Fungible Allowance (r:1 w:1)
+	/// Storage: Fungible Allowance (r:1 w:0)
 	/// Proof: Fungible Allowance (max_values: None, max_size: Some(93), added: 2568, mode: MaxEncodedLen)
-	/// Storage: Fungible Balance (r:2 w:2)
-	/// Proof: Fungible Balance (max_values: None, max_size: Some(77), added: 2552, mode: MaxEncodedLen)
-	fn transfer_from() -> Weight {
+	fn check_allowed_raw() -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `300`
-		//  Estimated: `7672`
-		// Minimum execution time: 21_667_000 picoseconds.
-		Weight::from_parts(22_166_000, 7672)
-			.saturating_add(RocksDbWeight::get().reads(3_u64))
-			.saturating_add(RocksDbWeight::get().writes(3_u64))
+		//  Measured:  `210`
+		//  Estimated: `2568`
+		// Minimum execution time: 2_842_000 picoseconds.
+		Weight::from_parts(3_077_000, 2568)
+			.saturating_add(RocksDbWeight::get().reads(1_u64))
+	}
+	/// Storage: Fungible Allowance (r:0 w:1)
+	/// Proof: Fungible Allowance (max_values: None, max_size: Some(93), added: 2568, mode: MaxEncodedLen)
+	fn set_allowance_unchecked_raw() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `0`
+		//  Estimated: `0`
+		// Minimum execution time: 2_532_000 picoseconds.
+		Weight::from_parts(2_680_000, 0)
+			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
 	/// Storage: Fungible Allowance (r:1 w:1)
 	/// Proof: Fungible Allowance (max_values: None, max_size: Some(93), added: 2568, mode: MaxEncodedLen)
modifiedpallets/nonfungible/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/nonfungible/CHANGELOG.md
+++ b/pallets/nonfungible/CHANGELOG.md
@@ -4,6 +4,12 @@
 
 <!-- bureaucrate goes here -->
 
+## [0.1.14] - 2023-03-28
+
+### Fixed
+
+- The weight of `transfer` and `transfer_from`.
+
 ## [0.1.13] - 2023-01-20
 
 ### Fixed
modifiedpallets/nonfungible/Cargo.tomldiffbeforeafterboth
--- a/pallets/nonfungible/Cargo.toml
+++ b/pallets/nonfungible/Cargo.toml
@@ -2,7 +2,7 @@
 edition = "2021"
 license = "GPLv3"
 name = "pallet-nonfungible"
-version = "0.1.13"
+version = "0.1.14"
 
 [dependencies]
 # Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.
modifiedpallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -121,7 +121,7 @@
 		}
 	}: {<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?}
 
-	transfer {
+	transfer_raw {
 		bench_init!{
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; receiver: cross_sub;
@@ -146,14 +146,14 @@
 		let item = create_max_item(&collection, &owner, owner_eth.clone())?;
 	}: {<Pallet<T>>::set_allowance_from(&collection, &sender, &owner_eth, item, Some(&spender))?}
 
-	transfer_from {
+	check_allowed_raw {
 		bench_init!{
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; spender: cross_sub; receiver: cross_sub;
 		};
 		let item = create_max_item(&collection, &owner, sender.clone())?;
 		<Pallet<T>>::set_allowance(&collection, &sender, item, Some(&spender))?;
-	}: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, item, &Unlimited)?}
+	}: {<Pallet<T>>::check_allowed(&collection, &spender, &sender, item, &Unlimited)?}
 
 	burn_from {
 		bench_init!{
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -23,7 +23,7 @@
 };
 use pallet_common::{
 	CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,
-	weights::WeightInfo as _,
+	weights::WeightInfo as _, SelfWeightOf as PalletCommonWeightOf,
 };
 use sp_runtime::DispatchError;
 use sp_std::{vec::Vec, vec};
@@ -91,7 +91,7 @@
 	}
 
 	fn transfer() -> Weight {
-		<SelfWeightOf<T>>::transfer()
+		<SelfWeightOf<T>>::transfer_raw() + <PalletCommonWeightOf<T>>::check_accesslist() * 2
 	}
 
 	fn approve() -> Weight {
@@ -103,7 +103,7 @@
 	}
 
 	fn transfer_from() -> Weight {
-		<SelfWeightOf<T>>::transfer_from()
+		Self::transfer() + <SelfWeightOf<T>>::check_allowed_raw()
 	}
 
 	fn burn_from() -> Weight {
@@ -325,10 +325,7 @@
 	) -> DispatchResultWithPostInfo {
 		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);
 		if amount == 1 {
-			with_weight(
-				<Pallet<T>>::transfer(self, &from, &to, token, nesting_budget),
-				<CommonWeights<T>>::transfer(),
-			)
+			<Pallet<T>>::transfer(self, &from, &to, token, nesting_budget)
 		} else {
 			<Pallet<T>>::check_token_immediate_ownership(self, token, &from)?;
 			Ok(().into())
@@ -386,10 +383,7 @@
 		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);
 
 		if amount == 1 {
-			with_weight(
-				<Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget),
-				<CommonWeights<T>>::transfer_from(),
-			)
+			<Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget)
 		} else {
 			<Pallet<T>>::check_allowed(self, &sender, &from, token, nesting_budget)?;
 
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -39,6 +39,7 @@
 	CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,
 	erc::{CommonEvmHandler, PrecompileResult, CollectionCall, static_property::key},
 	eth::{self, TokenUri},
+	CommonWeightInfo,
 };
 use pallet_evm::{account::CrossAccountId, PrecompileHandle};
 use pallet_evm_coder_substrate::call;
@@ -47,7 +48,7 @@
 
 use crate::{
 	AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, TokenData, TokensMinted,
-	TokenProperties, SelfWeightOf, weights::WeightInfo,
+	TokenProperties, SelfWeightOf, weights::WeightInfo, common::CommonWeights,
 };
 
 /// Nft events.
@@ -458,7 +459,7 @@
 	/// @param from The current owner of the NFT
 	/// @param to The new owner
 	/// @param tokenId The NFT to transfer
-	#[weight(<SelfWeightOf<T>>::transfer_from())]
+	#[weight(<CommonWeights<T>>::transfer_from())]
 	fn transfer_from(
 		&mut self,
 		caller: Caller,
@@ -475,7 +476,7 @@
 			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		<Pallet<T>>::transfer_from(self, &caller, &from, &to, token, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+			.map_err(|e| dispatch_to_evm::<T>(e.error))?;
 		Ok(())
 	}
 
@@ -824,7 +825,7 @@
 	///  is the zero address. Throws if `tokenId` is not a valid NFT.
 	/// @param to The new owner
 	/// @param tokenId The NFT to transfer
-	#[weight(<SelfWeightOf<T>>::transfer())]
+	#[weight(<CommonWeights<T>>::transfer())]
 	fn transfer(&mut self, caller: Caller, to: Address, token_id: U256) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = T::CrossAccountId::from_eth(to);
@@ -833,7 +834,8 @@
 			.recorder
 			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::transfer(self, &caller, &to, token, &budget).map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::transfer(self, &caller, &to, token, &budget)
+			.map_err(|e| dispatch_to_evm::<T>(e.error))?;
 		Ok(())
 	}
 
@@ -842,7 +844,7 @@
 	///  is the zero address. Throws if `tokenId` is not a valid NFT.
 	/// @param to The new owner
 	/// @param tokenId The NFT to transfer
-	#[weight(<SelfWeightOf<T>>::transfer())]
+	#[weight(<CommonWeights<T>>::transfer())]
 	fn transfer_cross(
 		&mut self,
 		caller: Caller,
@@ -856,7 +858,8 @@
 			.recorder
 			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::transfer(self, &caller, &to, token, &budget).map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::transfer(self, &caller, &to, token, &budget)
+			.map_err(|e| dispatch_to_evm::<T>(e.error))?;
 		Ok(())
 	}
 
@@ -866,7 +869,7 @@
 	/// @param from Cross acccount address of current owner
 	/// @param to Cross acccount address of new owner
 	/// @param tokenId The NFT to transfer
-	#[weight(<SelfWeightOf<T>>::transfer())]
+	#[weight(<CommonWeights<T>>::transfer_from())]
 	fn transfer_from_cross(
 		&mut self,
 		caller: Caller,
@@ -882,7 +885,7 @@
 			.recorder
 			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 		Pallet::<T>::transfer_from(self, &caller, &from, &to, token_id, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+			.map_err(|e| dispatch_to_evm::<T>(e.error))?;
 		Ok(())
 	}
 
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -108,7 +108,8 @@
 use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
 use pallet_common::{
 	Error as CommonError, Pallet as PalletCommon, Event as CommonEvent, CollectionHandle,
-	eth::collection_id_to_address,
+	eth::collection_id_to_address, SelfWeightOf as PalletCommonWeightOf,
+	weights::WeightInfo as CommonWeightInfo, helpers::add_weight_to_post_info,
 };
 use pallet_structure::{Pallet as PalletStructure, Error as StructureError};
 use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
@@ -802,12 +803,13 @@
 		to: &T::CrossAccountId,
 		token: TokenId,
 		nesting_budget: &dyn Budget,
-	) -> DispatchResult {
+	) -> DispatchResultWithPostInfo {
 		ensure!(
 			collection.limits.transfers_enabled(),
 			<CommonError<T>>::TransferNotAllowed
 		);
 
+		let mut actual_weight = <SelfWeightOf<T>>::transfer_raw();
 		let token_data =
 			<TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;
 		ensure!(&token_data.owner == from, <CommonError<T>>::NoPermission);
@@ -815,6 +817,7 @@
 		if collection.permissions.access() == AccessMode::AllowList {
 			collection.check_allowlist(from)?;
 			collection.check_allowlist(to)?;
+			actual_weight += <PalletCommonWeightOf<T>>::check_accesslist() * 2;
 		}
 		<PalletCommon<T>>::ensure_correct_receiver(to)?;
 
@@ -884,7 +887,11 @@
 			to.clone(),
 			1,
 		));
-		Ok(())
+
+		Ok(PostDispatchInfo {
+			actual_weight: Some(actual_weight),
+			pays_fee: Pays::Yes,
+		})
 	}
 
 	/// Batch operation to mint multiple NFT tokens.
@@ -1228,13 +1235,15 @@
 		to: &T::CrossAccountId,
 		token: TokenId,
 		nesting_budget: &dyn Budget,
-	) -> DispatchResult {
+	) -> DispatchResultWithPostInfo {
 		Self::check_allowed(collection, spender, from, token, nesting_budget)?;
 
 		// =========
 
 		// Allowance is reset in [`transfer`]
-		Self::transfer(collection, from, to, token, nesting_budget)
+		let mut result = Self::transfer(collection, from, to, token, nesting_budget);
+		add_weight_to_post_info(&mut result, <SelfWeightOf<T>>::check_allowed_raw());
+		result
 	}
 
 	/// Burn NFT token for `from` account.
modifiedpallets/nonfungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -40,10 +40,10 @@
 	fn burn_item() -> Weight;
 	fn burn_recursively_self_raw() -> Weight;
 	fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight;
-	fn transfer() -> Weight;
+	fn transfer_raw() -> Weight;
 	fn approve() -> Weight;
 	fn approve_from() -> Weight;
-	fn transfer_from() -> Weight;
+	fn check_allowed_raw() -> Weight;
 	fn burn_from() -> Weight;
 	fn set_token_property_permissions(b: u32, ) -> Weight;
 	fn set_token_properties(b: u32, ) -> Weight;
@@ -217,12 +217,12 @@
 	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
 	/// Storage: Nonfungible Owned (r:0 w:2)
 	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
-	fn transfer() -> Weight {
+	fn transfer_raw() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `412`
 		//  Estimated: `10144`
-		// Minimum execution time: 18_629_000 picoseconds.
-		Weight::from_parts(18_997_000, 10144)
+		// Minimum execution time: 9_307_000 picoseconds.
+		Weight::from_parts(10_108_000, 10144)
 			.saturating_add(T::DbWeight::get().reads(4_u64))
 			.saturating_add(T::DbWeight::get().writes(5_u64))
 	}
@@ -252,22 +252,15 @@
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: Nonfungible Allowance (r:1 w:1)
+	/// Storage: Nonfungible Allowance (r:1 w:0)
 	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenData (r:1 w:1)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible AccountBalance (r:2 w:2)
-	/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Owned (r:0 w:2)
-	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
-	fn transfer_from() -> Weight {
+	fn check_allowed_raw() -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `527`
-		//  Estimated: `10144`
-		// Minimum execution time: 24_919_000 picoseconds.
-		Weight::from_parts(25_333_000, 10144)
-			.saturating_add(T::DbWeight::get().reads(4_u64))
-			.saturating_add(T::DbWeight::get().writes(6_u64))
+		//  Measured:  `394`
+		//  Estimated: `2532`
+		// Minimum execution time: 2_668_000 picoseconds.
+		Weight::from_parts(2_877_000, 2532)
+			.saturating_add(T::DbWeight::get().reads(1_u64))
 	}
 	/// Storage: Nonfungible Allowance (r:1 w:1)
 	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
@@ -543,12 +536,12 @@
 	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
 	/// Storage: Nonfungible Owned (r:0 w:2)
 	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
-	fn transfer() -> Weight {
+	fn transfer_raw() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `412`
 		//  Estimated: `10144`
-		// Minimum execution time: 18_629_000 picoseconds.
-		Weight::from_parts(18_997_000, 10144)
+		// Minimum execution time: 9_307_000 picoseconds.
+		Weight::from_parts(10_108_000, 10144)
 			.saturating_add(RocksDbWeight::get().reads(4_u64))
 			.saturating_add(RocksDbWeight::get().writes(5_u64))
 	}
@@ -578,22 +571,15 @@
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: Nonfungible Allowance (r:1 w:1)
+	/// Storage: Nonfungible Allowance (r:1 w:0)
 	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenData (r:1 w:1)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible AccountBalance (r:2 w:2)
-	/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Owned (r:0 w:2)
-	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
-	fn transfer_from() -> Weight {
+	fn check_allowed_raw() -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `527`
-		//  Estimated: `10144`
-		// Minimum execution time: 24_919_000 picoseconds.
-		Weight::from_parts(25_333_000, 10144)
-			.saturating_add(RocksDbWeight::get().reads(4_u64))
-			.saturating_add(RocksDbWeight::get().writes(6_u64))
+		//  Measured:  `394`
+		//  Estimated: `2532`
+		// Minimum execution time: 2_668_000 picoseconds.
+		Weight::from_parts(2_877_000, 2532)
+			.saturating_add(RocksDbWeight::get().reads(1_u64))
 	}
 	/// Storage: Nonfungible Allowance (r:1 w:1)
 	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)