git.delta.rocks / unique-network / refs/commits / 71be677911ce

difftreelog

Merge pull request #1007 from UniqueNetwork/fix/token-properties-benchmarks

Yaroslav Bolyukin2023-10-13parents: #90ad566 #478ee33.patch.diff
in: master
Fix token properties and nesting weights

32 files changed

modifiedpallets/balances-adapter/src/common.rsdiffbeforeafterboth
--- a/pallets/balances-adapter/src/common.rs
+++ b/pallets/balances-adapter/src/common.rs
@@ -30,15 +30,7 @@
 		Weight::default()
 	}
 
-	fn delete_collection_properties(_amount: u32) -> Weight {
-		Weight::default()
-	}
-
 	fn set_token_properties(_amount: u32) -> Weight {
-		Weight::default()
-	}
-
-	fn delete_token_properties(_amount: u32) -> Weight {
 		Weight::default()
 	}
 
@@ -63,18 +55,6 @@
 	}
 
 	fn burn_from() -> Weight {
-		Weight::default()
-	}
-
-	fn burn_recursively_self_raw() -> Weight {
-		Weight::default()
-	}
-
-	fn burn_recursively_breadth_raw(_amount: u32) -> Weight {
-		Weight::default()
-	}
-
-	fn token_owner() -> Weight {
 		Weight::default()
 	}
 
@@ -124,16 +104,6 @@
 		_sender: <T>::CrossAccountId,
 		_token: TokenId,
 		_amount: u128,
-	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
-		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
-	}
-
-	fn burn_item_recursively(
-		&self,
-		_sender: <T>::CrossAccountId,
-		_token: TokenId,
-		_self_budget: &dyn up_data_structs::budget::Budget,
-		_breadth_budget: &dyn up_data_structs::budget::Budget,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
modifiedpallets/common/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/common/src/benchmarking.rs
+++ b/pallets/common/src/benchmarking.rs
@@ -29,12 +29,11 @@
 use sp_std::{vec, vec::Vec};
 use up_data_structs::{
 	AccessMode, CollectionId, CollectionMode, CollectionPermissions, CreateCollectionData,
-	NestingPermissions, PropertiesPermissionMap, Property, PropertyKey, PropertyValue,
-	MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_COLLECTION_NAME_LENGTH, MAX_PROPERTIES_PER_ITEM,
-	MAX_TOKEN_PREFIX_LENGTH,
+	NestingPermissions, Property, PropertyKey, PropertyValue, MAX_COLLECTION_DESCRIPTION_LENGTH,
+	MAX_COLLECTION_NAME_LENGTH, MAX_PROPERTIES_PER_ITEM, MAX_TOKEN_PREFIX_LENGTH,
 };
 
-use crate::{CollectionHandle, Config, Pallet};
+use crate::{BenchmarkPropertyWriter, CollectionHandle, Config, Pallet};
 
 const SEED: u32 = 1;
 
@@ -126,16 +125,6 @@
 	)
 }
 
-pub fn load_is_admin_and_property_permissions<T: Config>(
-	collection: &CollectionHandle<T>,
-	sender: &T::CrossAccountId,
-) -> (bool, PropertiesPermissionMap) {
-	(
-		collection.is_owner_or_admin(sender),
-		<Pallet<T>>::property_permissions(collection.id),
-	)
-}
-
 /// Helper macros, which handles all benchmarking preparation in semi-declarative way
 ///
 /// `name` is a substrate account
@@ -200,31 +189,6 @@
 		#[block]
 		{
 			<Pallet<T>>::set_collection_properties(&collection, &owner, props.into_iter())?;
-		}
-
-		Ok(())
-	}
-
-	#[benchmark]
-	fn delete_collection_properties(
-		b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
-	) -> Result<(), BenchmarkError> {
-		bench_init! {
-			owner: sub; collection: collection(owner);
-			owner: cross_from_sub;
-		};
-		let props = (0..b)
-			.map(|p| Property {
-				key: property_key(p as usize),
-				value: property_value(),
-			})
-			.collect::<Vec<_>>();
-		<Pallet<T>>::set_collection_properties(&collection, &owner, props.into_iter())?;
-		let to_delete = (0..b).map(|p| property_key(p as usize)).collect::<Vec<_>>();
-
-		#[block]
-		{
-			<Pallet<T>>::delete_collection_properties(&collection, &owner, to_delete.into_iter())?;
 		}
 
 		Ok(())
@@ -263,7 +227,7 @@
 	}
 
 	#[benchmark]
-	fn init_token_properties_common() -> Result<(), BenchmarkError> {
+	fn property_writer_load_collection_info() -> Result<(), BenchmarkError> {
 		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: sub;
@@ -272,7 +236,7 @@
 
 		#[block]
 		{
-			load_is_admin_and_property_permissions(&collection, &sender);
+			<BenchmarkPropertyWriter<T>>::load_collection_info(&&collection, &sender);
 		}
 
 		Ok(())
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -126,7 +126,7 @@
 	///
 	/// @param key Property key.
 	#[solidity(hide)]
-	#[weight(<SelfWeightOf<T>>::delete_collection_properties(1))]
+	#[weight(<SelfWeightOf<T>>::set_collection_properties(1))]
 	fn delete_collection_property(&mut self, caller: Caller, key: String) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		let key = <Vec<u8>>::from(key)
@@ -139,7 +139,7 @@
 	/// Delete collection properties.
 	///
 	/// @param keys Properties keys.
-	#[weight(<SelfWeightOf<T>>::delete_collection_properties(keys.len() as u32))]
+	#[weight(<SelfWeightOf<T>>::set_collection_properties(keys.len() as u32))]
 	fn delete_collection_properties(&mut self, caller: Caller, keys: Vec<String>) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		let keys = keys
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -53,10 +53,12 @@
 #![cfg_attr(not(feature = "std"), no_std)]
 extern crate alloc;
 
+use alloc::boxed::Box;
 use core::{
 	marker::PhantomData,
 	ops::{Deref, DerefMut},
 	slice::from_ref,
+	unreachable,
 };
 
 use evm_coder::ToLog;
@@ -871,63 +873,77 @@
 	>;
 }
 
+enum LazyValueState<'a, T> {
+	Pending(Box<dyn FnOnce() -> T + 'a>),
+	InProgress,
+	Computed(T),
+}
+
 /// Value representation with delayed initialization time.
-pub struct LazyValue<T, F: FnOnce() -> T> {
-	value: Option<T>,
-	f: Option<F>,
+pub struct LazyValue<'a, T> {
+	state: LazyValueState<'a, T>,
 }
 
-impl<T, F: FnOnce() -> T> LazyValue<T, F> {
+impl<'a, T> LazyValue<'a, T> {
 	/// Create a new LazyValue.
-	pub fn new(f: F) -> Self {
+	pub fn new(f: impl FnOnce() -> T + 'a) -> Self {
 		Self {
-			value: None,
-			f: Some(f),
+			state: LazyValueState::Pending(Box::new(f)),
 		}
 	}
 
 	/// Get the value. If it is called the first time, the value will be initialized.
 	pub fn value(&mut self) -> &T {
 		self.force_value();
-		self.value.as_ref().unwrap()
+		self.value_mut()
 	}
 
 	/// Get the value. If it is called the first time, the value will be initialized.
 	pub fn value_mut(&mut self) -> &mut T {
 		self.force_value();
-		self.value.as_mut().unwrap()
+
+		if let LazyValueState::Computed(value) = &mut self.state {
+			value
+		} else {
+			unreachable!()
+		}
 	}
 
 	fn into_inner(mut self) -> T {
 		self.force_value();
-		self.value.unwrap()
+		if let LazyValueState::Computed(value) = self.state {
+			value
+		} else {
+			unreachable!()
+		}
 	}
 
 	/// Is value initialized?
 	pub fn has_value(&self) -> bool {
-		self.value.is_some()
+		matches!(self.state, LazyValueState::Computed(_))
 	}
 
 	fn force_value(&mut self) {
-		if self.value.is_none() {
-			self.value = Some(self.f.take().unwrap()())
+		use LazyValueState::*;
+
+		if self.has_value() {
+			return;
+		}
+
+		match sp_std::mem::replace(&mut self.state, InProgress) {
+			Pending(f) => self.state = Computed(f()),
+			_ => panic!("recursion isn't supported"),
 		}
 	}
 }
 
-fn check_token_permissions<T, FCA, FTO, FTE>(
+fn check_token_permissions<T: Config>(
 	collection_admin_permitted: bool,
 	token_owner_permitted: bool,
-	is_collection_admin: &mut LazyValue<bool, FCA>,
-	is_token_owner: &mut LazyValue<Result<bool, DispatchError>, FTO>,
-	is_token_exist: &mut LazyValue<bool, FTE>,
-) -> DispatchResult
-where
-	T: Config,
-	FCA: FnOnce() -> bool,
-	FTO: FnOnce() -> Result<bool, DispatchError>,
-	FTE: FnOnce() -> bool,
-{
+	is_collection_admin: &mut LazyValue<bool>,
+	is_token_owner: &mut LazyValue<Result<bool, DispatchError>>,
+	is_token_exist: &mut LazyValue<bool>,
+) -> DispatchResult {
 	if !(collection_admin_permitted && *is_collection_admin.value()
 		|| token_owner_permitted && (*is_token_owner.value())?)
 	{
@@ -1902,7 +1918,9 @@
 	/// Collection property deletion weight.
 	///
 	/// * `amount`- The number of properties to set.
-	fn delete_collection_properties(amount: u32) -> Weight;
+	fn delete_collection_properties(amount: u32) -> Weight {
+		Self::set_collection_properties(amount)
+	}
 
 	/// Token property setting weight.
 	///
@@ -1912,7 +1930,9 @@
 	/// Token property deletion weight.
 	///
 	/// * `amount`- The number of properties to delete.
-	fn delete_token_properties(amount: u32) -> Weight;
+	fn delete_token_properties(amount: u32) -> Weight {
+		Self::set_token_properties(amount)
+	}
 
 	/// Token property permissions set weight.
 	///
@@ -1933,31 +1953,7 @@
 
 	/// The price of burning a token from another user.
 	fn burn_from() -> Weight;
-
-	/// Differs from burn_item in case of Fungible and Refungible, as it should burn
-	/// whole users's balance.
-	///
-	/// This method shouldn't be used directly, as it doesn't count breadth price, use [burn_recursively](CommonWeightInfo::burn_recursively) instead
-	fn burn_recursively_self_raw() -> Weight;
 
-	/// Cost of iterating over `amount` children while burning, without counting child burning itself.
-	///
-	/// This method shouldn't be used directly, as it doesn't count depth price, use [burn_recursively](CommonWeightInfo::burn_recursively) instead
-	fn burn_recursively_breadth_raw(amount: u32) -> Weight;
-
-	/// The price of recursive burning a token.
-	///
-	/// `max_selfs` - The maximum burning weight of the token itself.
-	/// `max_breadth` - The maximum number of nested tokens to burn.
-	fn burn_recursively(max_selfs: u32, max_breadth: u32) -> Weight {
-		Self::burn_recursively_self_raw()
-			.saturating_mul(max_selfs.max(1) as u64)
-			.saturating_add(Self::burn_recursively_breadth_raw(max_breadth))
-	}
-
-	/// The price of retrieving token owner
-	fn token_owner() -> Weight;
-
 	/// The price of setting approval for all
 	fn set_allowance_for_all() -> Weight;
 
@@ -2029,20 +2025,6 @@
 		amount: u128,
 	) -> DispatchResultWithPostInfo;
 
-	/// Burn token and all nested tokens recursievly.
-	///
-	/// * `sender` - The user who owns the token.
-	/// * `token` - Token id that will burned.
-	/// * `self_budget` - The budget that can be spent on burning tokens.
-	/// * `breadth_budget` - The budget that can be spent on burning nested tokens.
-	fn burn_item_recursively(
-		&self,
-		sender: T::CrossAccountId,
-		token: TokenId,
-		self_budget: &dyn Budget,
-		breadth_budget: &dyn Budget,
-	) -> DispatchResultWithPostInfo;
-
 	/// Set collection properties.
 	///
 	/// * `sender` - Must be either the owner of the collection or its admin.
@@ -2374,160 +2356,33 @@
 	}
 }
 
-/// A marker structure that enables the writer implementation
-/// to provide the interface to write properties to **newly created** tokens.
-pub struct NewTokenPropertyWriter;
-
-/// A marker structure that enables the writer implementation
-/// to provide the interface to write properties to **already existing** tokens.
-pub struct ExistingTokenPropertyWriter;
-
 /// The type-safe interface for writing properties (setting or deleting) to tokens.
 /// It has two distinct implementations for newly created tokens and existing ones.
 ///
 /// This type utilizes the lazy evaluation to avoid repeating the computation
 /// of several performance-heavy or PoV-heavy tasks,
 /// such as checking the indirect ownership or reading the token property permissions.
-pub struct PropertyWriter<
-	'a,
-	T,
-	Handle,
-	WriterVariant,
-	FIsAdmin,
-	FPropertyPermissions,
-	FCheckTokenExist,
-	FGetProperties,
-> where
-	T: Config,
-	FIsAdmin: FnOnce() -> bool,
-	FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,
-{
+pub struct PropertyWriter<'a, WriterVariant, T, Handle> {
 	collection: &'a Handle,
-	is_collection_admin: LazyValue<bool, FIsAdmin>,
-	property_permissions: LazyValue<PropertiesPermissionMap, FPropertyPermissions>,
-	check_token_exist: FCheckTokenExist,
-	get_properties: FGetProperties,
+	collection_lazy_info: PropertyWriterLazyCollectionInfo<'a>,
 	_phantom: PhantomData<(T, WriterVariant)>,
 }
 
-impl<'a, T, Handle, FIsAdmin, FPropertyPermissions, FCheckTokenExist, FGetProperties>
-	PropertyWriter<
-		'a,
-		T,
-		Handle,
-		NewTokenPropertyWriter,
-		FIsAdmin,
-		FPropertyPermissions,
-		FCheckTokenExist,
-		FGetProperties,
-	> where
-	T: Config,
-	Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
-	FIsAdmin: FnOnce() -> bool,
-	FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,
-	FCheckTokenExist: Copy + FnOnce(TokenId) -> bool,
-	FGetProperties: Copy + FnOnce(TokenId) -> TokenProperties,
-{
-	/// A function to write properties to a **newly created** token.
-	pub fn write_token_properties(
-		&mut self,
-		mint_target_is_sender: bool,
-		token_id: TokenId,
-		properties_updates: impl Iterator<Item = Property>,
-		log: evm_coder::ethereum::Log,
-	) -> DispatchResult {
-		self.internal_write_token_properties(
-			token_id,
-			properties_updates.map(|p| (p.key, Some(p.value))),
-			|_| Ok(mint_target_is_sender),
-			log,
-		)
-	}
-}
-
-impl<'a, T, Handle, FIsAdmin, FPropertyPermissions, FCheckTokenExist, FGetProperties>
-	PropertyWriter<
-		'a,
-		T,
-		Handle,
-		ExistingTokenPropertyWriter,
-		FIsAdmin,
-		FPropertyPermissions,
-		FCheckTokenExist,
-		FGetProperties,
-	> where
+impl<'a, T, Handle, WriterVariant> PropertyWriter<'a, WriterVariant, T, Handle>
+where
 	T: Config,
 	Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
-	FIsAdmin: FnOnce() -> bool,
-	FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,
-	FCheckTokenExist: Copy + FnOnce(TokenId) -> bool,
-	FGetProperties: Copy + FnOnce(TokenId) -> TokenProperties,
 {
-	/// A function to write properties to an **already existing** token.
-	pub fn write_token_properties(
+	fn internal_write_token_properties(
 		&mut self,
-		sender: &T::CrossAccountId,
 		token_id: TokenId,
+		mut token_lazy_info: PropertyWriterLazyTokenInfo,
 		properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,
-		nesting_budget: &dyn Budget,
 		log: evm_coder::ethereum::Log,
 	) -> DispatchResult {
-		self.internal_write_token_properties(
-			token_id,
-			properties_updates,
-			|collection| collection.check_token_indirect_owner(token_id, sender, nesting_budget),
-			log,
-		)
-	}
-}
-
-impl<
-		'a,
-		T,
-		Handle,
-		WriterVariant,
-		FIsAdmin,
-		FPropertyPermissions,
-		FCheckTokenExist,
-		FGetProperties,
-	>
-	PropertyWriter<
-		'a,
-		T,
-		Handle,
-		WriterVariant,
-		FIsAdmin,
-		FPropertyPermissions,
-		FCheckTokenExist,
-		FGetProperties,
-	> where
-	T: Config,
-	Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
-	FIsAdmin: FnOnce() -> bool,
-	FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,
-	FCheckTokenExist: Copy + FnOnce(TokenId) -> bool,
-	FGetProperties: Copy + FnOnce(TokenId) -> TokenProperties,
-{
-	fn internal_write_token_properties<FCheckTokenOwner>(
-		&mut self,
-		token_id: TokenId,
-		properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,
-		check_token_owner: FCheckTokenOwner,
-		log: evm_coder::ethereum::Log,
-	) -> DispatchResult
-	where
-		FCheckTokenOwner: FnOnce(&Handle) -> Result<bool, DispatchError>,
-	{
-		let get_properties = self.get_properties;
-		let mut stored_properties = LazyValue::new(move || get_properties(token_id));
-
-		let mut is_token_owner = LazyValue::new(|| check_token_owner(self.collection));
-
-		let check_token_exist = self.check_token_exist;
-		let mut is_token_exist = LazyValue::new(move || check_token_exist(token_id));
-
 		for (key, value) in properties_updates {
 			let permission = self
+				.collection_lazy_info
 				.property_permissions
 				.value()
 				.get(&key)
@@ -2536,7 +2391,11 @@
 
 			match permission {
 				PropertyPermission { mutable: false, .. }
-					if stored_properties.value().get(&key).is_some() =>
+					if token_lazy_info
+						.stored_properties
+						.value()
+						.get(&key)
+						.is_some() =>
 				{
 					return Err(<Error<T>>::NoPermission.into());
 				}
@@ -2545,18 +2404,19 @@
 					collection_admin,
 					token_owner,
 					..
-				} => check_token_permissions::<T, _, _, _>(
+				} => check_token_permissions::<T>(
 					collection_admin,
 					token_owner,
-					&mut self.is_collection_admin,
-					&mut is_token_owner,
-					&mut is_token_exist,
+					&mut self.collection_lazy_info.is_collection_admin,
+					&mut token_lazy_info.is_token_owner,
+					&mut token_lazy_info.is_token_exist,
 				)?,
 			}
 
 			match value {
 				Some(value) => {
-					stored_properties
+					token_lazy_info
+						.stored_properties
 						.value_mut()
 						.try_set(key.clone(), value)
 						.map_err(<Error<T>>::from)?;
@@ -2568,7 +2428,8 @@
 					));
 				}
 				None => {
-					stored_properties
+					token_lazy_info
+						.stored_properties
 						.value_mut()
 						.remove(&key)
 						.map_err(<Error<T>>::from)?;
@@ -2582,142 +2443,292 @@
 			}
 		}
 
-		let properties_changed = stored_properties.has_value();
+		let properties_changed = token_lazy_info.stored_properties.has_value();
 		if properties_changed {
 			<PalletEvm<T>>::deposit_log(log);
 
 			self.collection
-				.set_token_properties_raw(token_id, stored_properties.into_inner());
+				.set_token_properties_raw(token_id, token_lazy_info.stored_properties.into_inner());
 		}
 
 		Ok(())
 	}
 }
 
-/// Create a [`PropertyWriter`] for newly created tokens.
-pub fn property_writer_for_new_token<'a, T, Handle>(
-	collection: &'a Handle,
-	sender: &'a T::CrossAccountId,
-) -> PropertyWriter<
-	'a,
-	T,
-	Handle,
-	NewTokenPropertyWriter,
-	impl FnOnce() -> bool + 'a,
-	impl FnOnce() -> PropertiesPermissionMap + 'a,
-	impl Copy + FnOnce(TokenId) -> bool + 'a,
-	impl Copy + FnOnce(TokenId) -> TokenProperties + 'a,
->
+/// A helper structure for the [`PropertyWriter`] that holds
+/// the collection-related info. The info is loaded using lazy evaluation.
+/// This info is common for any token for which we write properties.
+pub struct PropertyWriterLazyCollectionInfo<'a> {
+	is_collection_admin: LazyValue<'a, bool>,
+	property_permissions: LazyValue<'a, PropertiesPermissionMap>,
+}
+
+/// A helper structure for the [`PropertyWriter`] that holds
+/// the token-related info. The info is loaded using lazy evaluation.
+pub struct PropertyWriterLazyTokenInfo<'a> {
+	is_token_exist: LazyValue<'a, bool>,
+	is_token_owner: LazyValue<'a, Result<bool, DispatchError>>,
+	stored_properties: LazyValue<'a, TokenProperties>,
+}
+
+impl<'a> PropertyWriterLazyTokenInfo<'a> {
+	/// Create a lazy token info.
+	pub fn new(
+		check_token_exist: impl FnOnce() -> bool + 'a,
+		check_token_owner: impl FnOnce() -> Result<bool, DispatchError> + 'a,
+		get_token_properties: impl FnOnce() -> TokenProperties + 'a,
+	) -> Self {
+		Self {
+			is_token_exist: LazyValue::new(check_token_exist),
+			is_token_owner: LazyValue::new(check_token_owner),
+			stored_properties: LazyValue::new(get_token_properties),
+		}
+	}
+}
+
+/// A marker structure that enables the writer implementation
+/// to provide the interface to write properties to **newly created** tokens.
+pub struct NewTokenPropertyWriter<T>(PhantomData<T>);
+impl<T: Config> NewTokenPropertyWriter<T> {
+	/// Creates a [`PropertyWriter`] for **newly created** tokens.
+	pub fn new<'a, Handle>(
+		collection: &'a Handle,
+		sender: &'a T::CrossAccountId,
+	) -> PropertyWriter<'a, Self, T, Handle>
+	where
+		T: Config,
+		Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
+	{
+		PropertyWriter {
+			collection,
+			collection_lazy_info: PropertyWriterLazyCollectionInfo {
+				is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),
+				property_permissions: LazyValue::new(|| {
+					<Pallet<T>>::property_permissions(collection.id)
+				}),
+			},
+			_phantom: PhantomData,
+		}
+	}
+}
+
+impl<'a, T, Handle> PropertyWriter<'a, NewTokenPropertyWriter<T>, T, Handle>
 where
 	T: Config,
 	Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
 {
-	PropertyWriter {
-		collection,
-		is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),
-		property_permissions: LazyValue::new(|| <Pallet<T>>::property_permissions(collection.id)),
-		check_token_exist: |token_id| {
-			debug_assert!(collection.token_exists(token_id));
+	/// A function to write properties to a **newly created** token.
+	pub fn write_token_properties(
+		&mut self,
+		mint_target_is_sender: bool,
+		token_id: TokenId,
+		properties_updates: impl Iterator<Item = Property>,
+		log: evm_coder::ethereum::Log,
+	) -> DispatchResult {
+		let check_token_exist = || {
+			debug_assert!(self.collection.token_exists(token_id));
 			true
-		},
-		get_properties: |token_id| {
-			debug_assert!(collection.get_token_properties_raw(token_id).is_none());
+		};
+
+		let check_token_owner = || Ok(mint_target_is_sender);
+
+		let get_token_properties = || {
+			debug_assert!(self.collection.get_token_properties_raw(token_id).is_none());
 			TokenProperties::new()
-		},
-		_phantom: PhantomData,
+		};
+
+		self.internal_write_token_properties(
+			token_id,
+			PropertyWriterLazyTokenInfo::new(
+				check_token_exist,
+				check_token_owner,
+				get_token_properties,
+			),
+			properties_updates.map(|p| (p.key, Some(p.value))),
+			log,
+		)
 	}
 }
 
-#[cfg(feature = "runtime-benchmarks")]
-/// Create a `PropertyWriter` with preloaded `is_collection_admin` and `property_permissions.
-/// Also:
-/// * it will return `true` for the token ownership check.
-/// * it will return empty stored properties without reading them from the storage.
-pub fn collection_info_loaded_property_writer<T, Handle>(
-	collection: &Handle,
-	is_collection_admin: bool,
-	property_permissions: PropertiesPermissionMap,
-) -> PropertyWriter<
-	T,
-	Handle,
-	NewTokenPropertyWriter,
-	impl FnOnce() -> bool,
-	impl FnOnce() -> PropertiesPermissionMap,
-	impl Copy + FnOnce(TokenId) -> bool,
-	impl Copy + FnOnce(TokenId) -> TokenProperties,
->
+/// A marker structure that enables the writer implementation
+/// to provide the interface to write properties to **already existing** tokens.
+pub struct ExistingTokenPropertyWriter<T>(PhantomData<T>);
+impl<T: Config> ExistingTokenPropertyWriter<T> {
+	/// Creates a [`PropertyWriter`] for **already existing** tokens.
+	pub fn new<'a, Handle>(
+		collection: &'a Handle,
+		sender: &'a T::CrossAccountId,
+	) -> PropertyWriter<'a, Self, T, Handle>
+	where
+		Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
+	{
+		PropertyWriter {
+			collection,
+			collection_lazy_info: PropertyWriterLazyCollectionInfo {
+				is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),
+				property_permissions: LazyValue::new(|| {
+					<Pallet<T>>::property_permissions(collection.id)
+				}),
+			},
+			_phantom: PhantomData,
+		}
+	}
+}
+
+impl<'a, T, Handle> PropertyWriter<'a, ExistingTokenPropertyWriter<T>, T, Handle>
 where
 	T: Config,
 	Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
 {
-	PropertyWriter {
-		collection,
-		is_collection_admin: LazyValue::new(move || is_collection_admin),
-		property_permissions: LazyValue::new(move || property_permissions),
-		check_token_exist: |_token_id| true,
-		get_properties: |_token_id| TokenProperties::new(),
-		_phantom: PhantomData,
+	/// A function to write properties to an **already existing** token.
+	pub fn write_token_properties(
+		&mut self,
+		sender: &T::CrossAccountId,
+		token_id: TokenId,
+		properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,
+		nesting_budget: &dyn Budget,
+		log: evm_coder::ethereum::Log,
+	) -> DispatchResult {
+		let check_token_exist = || self.collection.token_exists(token_id);
+		let check_token_owner = || {
+			self.collection
+				.check_token_indirect_owner(token_id, sender, nesting_budget)
+		};
+		let get_token_properties = || {
+			self.collection
+				.get_token_properties_raw(token_id)
+				.unwrap_or_default()
+		};
+
+		self.internal_write_token_properties(
+			token_id,
+			PropertyWriterLazyTokenInfo::new(
+				check_token_exist,
+				check_token_owner,
+				get_token_properties,
+			),
+			properties_updates,
+			log,
+		)
 	}
 }
 
-/// Create a [`PropertyWriter`] for already existing tokens.
-pub fn property_writer_for_existing_token<'a, T, Handle>(
-	collection: &'a Handle,
-	sender: &'a T::CrossAccountId,
-) -> PropertyWriter<
-	'a,
-	T,
-	Handle,
-	ExistingTokenPropertyWriter,
-	impl FnOnce() -> bool + 'a,
-	impl FnOnce() -> PropertiesPermissionMap + 'a,
-	impl Copy + FnOnce(TokenId) -> bool + 'a,
-	impl Copy + FnOnce(TokenId) -> TokenProperties + 'a,
->
+/// A marker structure that enables the writer implementation
+/// to benchmark the token properties writing.
+#[cfg(feature = "runtime-benchmarks")]
+pub struct BenchmarkPropertyWriter<T>(PhantomData<T>);
+
+#[cfg(feature = "runtime-benchmarks")]
+impl<T: Config> BenchmarkPropertyWriter<T> {
+	/// Creates a [`PropertyWriter`] for benchmarking tokens properties writing.
+	pub fn new<'a, Handle>(
+		collection: &'a Handle,
+		collection_lazy_info: PropertyWriterLazyCollectionInfo<'a>,
+	) -> PropertyWriter<'a, Self, T, Handle>
+	where
+		Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
+	{
+		PropertyWriter {
+			collection,
+			collection_lazy_info,
+			_phantom: PhantomData,
+		}
+	}
+
+	/// Load the [`PropertyWriterLazyCollectionInfo`] from the storage.
+	pub fn load_collection_info<Handle>(
+		collection_handle: &Handle,
+		sender: &T::CrossAccountId,
+	) -> PropertyWriterLazyCollectionInfo<'static>
+	where
+		Handle: Deref<Target = CollectionHandle<T>>,
+	{
+		let is_collection_admin = collection_handle.is_owner_or_admin(sender);
+		let property_permissions = <Pallet<T>>::property_permissions(collection_handle.id);
+
+		PropertyWriterLazyCollectionInfo {
+			is_collection_admin: LazyValue::new(move || is_collection_admin),
+			property_permissions: LazyValue::new(move || property_permissions),
+		}
+	}
+
+	/// Load the [`PropertyWriterLazyTokenInfo`] with token properties from the storage.
+	pub fn load_token_properties<Handle>(
+		collection: &Handle,
+		token_id: TokenId,
+	) -> PropertyWriterLazyTokenInfo
+	where
+		Handle: CommonCollectionOperations<T>,
+	{
+		let stored_properties = collection
+			.get_token_properties_raw(token_id)
+			.unwrap_or_default();
+
+		PropertyWriterLazyTokenInfo {
+			is_token_exist: LazyValue::new(|| true),
+			is_token_owner: LazyValue::new(|| Ok(true)),
+			stored_properties: LazyValue::new(move || stored_properties),
+		}
+	}
+}
+
+#[cfg(feature = "runtime-benchmarks")]
+impl<'a, T, Handle> PropertyWriter<'a, BenchmarkPropertyWriter<T>, T, Handle>
 where
 	T: Config,
 	Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
 {
-	PropertyWriter {
-		collection,
-		is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),
-		property_permissions: LazyValue::new(|| <Pallet<T>>::property_permissions(collection.id)),
-		check_token_exist: |token_id| collection.token_exists(token_id),
-		get_properties: |token_id| {
-			collection
-				.get_token_properties_raw(token_id)
-				.unwrap_or_default()
-		},
-		_phantom: PhantomData,
+	/// A function to benchmark the writing of token properties.
+	pub fn write_token_properties(
+		&mut self,
+		token_id: TokenId,
+		properties_updates: impl Iterator<Item = Property>,
+		log: evm_coder::ethereum::Log,
+	) -> DispatchResult {
+		let check_token_exist = || true;
+		let check_token_owner = || Ok(true);
+		let get_token_properties = TokenProperties::new;
+
+		self.internal_write_token_properties(
+			token_id,
+			PropertyWriterLazyTokenInfo::new(
+				check_token_exist,
+				check_token_owner,
+				get_token_properties,
+			),
+			properties_updates.map(|p| (p.key, Some(p.value))),
+			log,
+		)
 	}
 }
 
-/// Computes the weight delta for newly created tokens with properties.
+/// Computes the weight of writing properties to tokens.
 /// * `properties_nums` - The properties num of each created token.
-/// * `init_token_properties` - The function to obtain the weight from a token's properties num.
-pub fn init_token_properties_delta<T: Config, I: Fn(u32) -> Weight>(
+/// * `per_token_weight_weight` - The function to obtain the weight
+/// of writing properties from a token's properties num.
+pub fn write_token_properties_total_weight<T: Config, I: Fn(u32) -> Weight>(
 	properties_nums: impl Iterator<Item = u32>,
-	init_token_properties: I,
+	per_token_weight: I,
 ) -> Weight {
-	let mut delta = properties_nums
+	let mut weight = properties_nums
 		.filter_map(|properties_num| {
 			if properties_num > 0 {
-				Some(init_token_properties(properties_num))
+				Some(per_token_weight(properties_num))
 			} else {
 				None
 			}
 		})
 		.fold(Weight::zero(), |a, b| a.saturating_add(b));
 
-	// If at least once the `init_token_properties` was called,
-	// it means at least one newly created token has properties.
-	// Becuase of that, some common collection data also was loaded and we need to add this weight.
-	// However, these common data was loaded only once which is guaranteed by the `PropertyWriter`.
-	if !delta.is_zero() {
-		delta = delta.saturating_add(<SelfWeightOf<T>>::init_token_properties_common())
+	if !weight.is_zero() {
+		// If we are here, it means the token properties were written at least once.
+		// Because of that, some common collection data was also loaded; we must add this weight.
+		// However, this common data was loaded only once, which is guaranteed by the `PropertyWriter`.
+
+		weight = weight.saturating_add(<SelfWeightOf<T>>::property_writer_load_collection_info());
 	}
 
-	delta
+	weight
 }
 
 #[cfg(any(feature = "tests", test))]
@@ -2781,20 +2792,14 @@
 		/* 15*/ TestCase::new(1, 1,  1, 1,  0),
 	];
 
-	pub fn check_token_permissions<T, FCA, FTO, FTE>(
+	pub fn check_token_permissions<T: Config>(
 		collection_admin_permitted: bool,
 		token_owner_permitted: bool,
-		is_collection_admin: &mut LazyValue<bool, FCA>,
-		check_token_ownership: &mut LazyValue<Result<bool, DispatchError>, FTO>,
-		check_token_existence: &mut LazyValue<bool, FTE>,
-	) -> DispatchResult
-	where
-		T: Config,
-		FCA: FnOnce() -> bool,
-		FTO: FnOnce() -> Result<bool, DispatchError>,
-		FTE: FnOnce() -> bool,
-	{
-		crate::check_token_permissions::<T, FCA, FTO, FTE>(
+		is_collection_admin: &mut LazyValue<bool>,
+		check_token_ownership: &mut LazyValue<Result<bool, DispatchError>>,
+		check_token_existence: &mut LazyValue<bool>,
+	) -> DispatchResult {
+		crate::check_token_permissions::<T>(
 			collection_admin_permitted,
 			token_owner_permitted,
 			is_collection_admin,
modifiedpallets/common/src/weights.rsdiffbeforeafterboth
--- a/pallets/common/src/weights.rs
+++ b/pallets/common/src/weights.rs
@@ -3,13 +3,13 @@
 //! Autogenerated weights for pallet_common
 //!
 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-09-30, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-10-13, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
 //! WORST CASE MAP SIZE: `1000000`
-//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
-//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
+//! HOSTNAME: `hearthstone`, CPU: `AMD Ryzen 9 7950X3D 16-Core Processor`
+//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
 
 // Executed Command:
-// target/production/unique-collator
+// ./target/production/unique-collator
 // benchmark
 // pallet
 // --pallet
@@ -20,7 +20,7 @@
 // *
 // --template=.maintain/frame-weight-template.hbs
 // --steps=50
-// --repeat=400
+// --repeat=80
 // --heap-pages=4096
 // --output=./pallets/common/src/weights.rs
 
@@ -34,116 +34,87 @@
 /// Weight functions needed for pallet_common.
 pub trait WeightInfo {
 	fn set_collection_properties(b: u32, ) -> Weight;
-	fn delete_collection_properties(b: u32, ) -> Weight;
 	fn check_accesslist() -> Weight;
-	fn init_token_properties_common() -> Weight;
+	fn property_writer_load_collection_info() -> Weight;
 }
 
 /// Weights for pallet_common using the Substrate node and recommended hardware.
 pub struct SubstrateWeight<T>(PhantomData<T>);
 impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
-	/// Storage: Common CollectionProperties (r:1 w:1)
-	/// Proof: Common CollectionProperties (max_values: None, max_size: Some(40992), added: 43467, mode: MaxEncodedLen)
+	/// Storage: `Common::CollectionProperties` (r:1 w:1)
+	/// Proof: `Common::CollectionProperties` (`max_values`: None, `max_size`: Some(40992), added: 43467, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 64]`.
 	fn set_collection_properties(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `298`
 		//  Estimated: `44457`
-		// Minimum execution time: 4_987_000 picoseconds.
-		Weight::from_parts(5_119_000, 44457)
-			// Standard Error: 7_609
-			.saturating_add(Weight::from_parts(5_750_459, 0).saturating_mul(b.into()))
-			.saturating_add(T::DbWeight::get().reads(1_u64))
-			.saturating_add(T::DbWeight::get().writes(1_u64))
-	}
-	/// Storage: Common CollectionProperties (r:1 w:1)
-	/// Proof: Common CollectionProperties (max_values: None, max_size: Some(40992), added: 43467, mode: MaxEncodedLen)
-	/// The range of component `b` is `[0, 64]`.
-	fn delete_collection_properties(b: u32, ) -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `303 + b * (33030 ±0)`
-		//  Estimated: `44457`
-		// Minimum execution time: 4_923_000 picoseconds.
-		Weight::from_parts(5_074_000, 44457)
-			// Standard Error: 36_651
-			.saturating_add(Weight::from_parts(23_145_677, 0).saturating_mul(b.into()))
+		// Minimum execution time: 4_560_000 picoseconds.
+		Weight::from_parts(28_643_440, 44457)
+			// Standard Error: 28_941
+			.saturating_add(Weight::from_parts(18_277_422, 0).saturating_mul(b.into()))
 			.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)
+	/// 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:  `373`
 		//  Estimated: `3535`
-		// Minimum execution time: 4_271_000 picoseconds.
-		Weight::from_parts(4_461_000, 3535)
+		// Minimum execution time: 4_290_000 picoseconds.
+		Weight::from_parts(4_460_000, 3535)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 	}
-	/// Storage: Common IsAdmin (r:1 w:0)
-	/// Proof: Common IsAdmin (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)
-	/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
-	/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
-	fn init_token_properties_common() -> Weight {
+	/// Storage: `Common::IsAdmin` (r:1 w:0)
+	/// Proof: `Common::IsAdmin` (`max_values`: None, `max_size`: Some(70), added: 2545, mode: `MaxEncodedLen`)
+	/// Storage: `Common::CollectionPropertyPermissions` (r:1 w:0)
+	/// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)
+	fn property_writer_load_collection_info() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `326`
 		//  Estimated: `20191`
-		// Minimum execution time: 5_889_000 picoseconds.
-		Weight::from_parts(6_138_000, 20191)
+		// Minimum execution time: 6_100_000 picoseconds.
+		Weight::from_parts(6_350_000, 20191)
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 	}
 }
 
 // For backwards compatibility and tests
 impl WeightInfo for () {
-	/// Storage: Common CollectionProperties (r:1 w:1)
-	/// Proof: Common CollectionProperties (max_values: None, max_size: Some(40992), added: 43467, mode: MaxEncodedLen)
+	/// Storage: `Common::CollectionProperties` (r:1 w:1)
+	/// Proof: `Common::CollectionProperties` (`max_values`: None, `max_size`: Some(40992), added: 43467, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 64]`.
 	fn set_collection_properties(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `298`
 		//  Estimated: `44457`
-		// Minimum execution time: 4_987_000 picoseconds.
-		Weight::from_parts(5_119_000, 44457)
-			// Standard Error: 7_609
-			.saturating_add(Weight::from_parts(5_750_459, 0).saturating_mul(b.into()))
+		// Minimum execution time: 4_560_000 picoseconds.
+		Weight::from_parts(28_643_440, 44457)
+			// Standard Error: 28_941
+			.saturating_add(Weight::from_parts(18_277_422, 0).saturating_mul(b.into()))
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: Common CollectionProperties (r:1 w:1)
-	/// Proof: Common CollectionProperties (max_values: None, max_size: Some(40992), added: 43467, mode: MaxEncodedLen)
-	/// The range of component `b` is `[0, 64]`.
-	fn delete_collection_properties(b: u32, ) -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `303 + b * (33030 ±0)`
-		//  Estimated: `44457`
-		// Minimum execution time: 4_923_000 picoseconds.
-		Weight::from_parts(5_074_000, 44457)
-			// Standard Error: 36_651
-			.saturating_add(Weight::from_parts(23_145_677, 0).saturating_mul(b.into()))
-			.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)
+	/// 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:  `373`
 		//  Estimated: `3535`
-		// Minimum execution time: 4_271_000 picoseconds.
-		Weight::from_parts(4_461_000, 3535)
+		// Minimum execution time: 4_290_000 picoseconds.
+		Weight::from_parts(4_460_000, 3535)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 	}
-	/// Storage: Common IsAdmin (r:1 w:0)
-	/// Proof: Common IsAdmin (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)
-	/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
-	/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
-	fn init_token_properties_common() -> Weight {
+	/// Storage: `Common::IsAdmin` (r:1 w:0)
+	/// Proof: `Common::IsAdmin` (`max_values`: None, `max_size`: Some(70), added: 2545, mode: `MaxEncodedLen`)
+	/// Storage: `Common::CollectionPropertyPermissions` (r:1 w:0)
+	/// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)
+	fn property_writer_load_collection_info() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `326`
 		//  Estimated: `20191`
-		// Minimum execution time: 5_889_000 picoseconds.
-		Weight::from_parts(6_138_000, 20191)
+		// Minimum execution time: 6_100_000 picoseconds.
+		Weight::from_parts(6_350_000, 20191)
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 	}
 }
modifiedpallets/evm-coder-substrate/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-coder-substrate/src/lib.rs
+++ b/pallets/evm-coder-substrate/src/lib.rs
@@ -84,7 +84,7 @@
 }
 impl<T: Config> budget::Budget for GasCallsBudget<'_, T> {
 	fn consume_custom(&self, calls: u32) -> bool {
-		let (gas, overflown) = (calls as u64).overflowing_add(self.gas_per_call);
+		let (gas, overflown) = (calls as u64).overflowing_mul(self.gas_per_call);
 		if overflown {
 			return false;
 		}
modifiedpallets/foreign-assets/src/impl_fungibles.rsdiffbeforeafterboth
--- a/pallets/foreign-assets/src/impl_fungibles.rs
+++ b/pallets/foreign-assets/src/impl_fungibles.rs
@@ -23,7 +23,7 @@
 use pallet_common::{CollectionHandle, CommonCollectionOperations};
 use pallet_fungible::FungibleHandle;
 use sp_runtime::traits::{CheckedAdd, CheckedSub};
-use up_data_structs::budget::Value;
+use up_data_structs::budget;
 
 use super::*;
 
@@ -327,7 +327,7 @@
 					&collection,
 					&account,
 					amount_data,
-					&Value::new(0),
+					&budget::Value::new(0),
 				)?;
 
 				Ok(amount)
@@ -440,7 +440,7 @@
 					&T::CrossAccountId::from_sub(source.clone()),
 					&T::CrossAccountId::from_sub(dest.clone()),
 					amount.into(),
-					&Value::new(0),
+					&budget::Value::new(0),
 				)
 				.map_err(|e| e.error)?;
 
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -16,14 +16,11 @@
 
 use core::marker::PhantomData;
 
-use frame_support::{
-	dispatch::DispatchResultWithPostInfo, ensure, fail, traits::Get, weights::Weight,
-};
+use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};
 use pallet_common::{
 	weights::WeightInfo as _, with_weight, CommonCollectionOperations, CommonWeightInfo,
 	RefungibleExtensions, SelfWeightOf as PalletCommonWeightOf,
 };
-use pallet_structure::Error as StructureError;
 use sp_runtime::{ArithmeticError, DispatchError};
 use sp_std::{vec, vec::Vec};
 use up_data_structs::{
@@ -58,18 +55,9 @@
 
 	fn set_collection_properties(amount: u32) -> Weight {
 		<pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)
-	}
-
-	fn delete_collection_properties(amount: u32) -> Weight {
-		<pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)
 	}
 
 	fn set_token_properties(_amount: u32) -> Weight {
-		// Error
-		Weight::zero()
-	}
-
-	fn delete_token_properties(_amount: u32) -> Weight {
 		// Error
 		Weight::zero()
 	}
@@ -80,7 +68,8 @@
 	}
 
 	fn transfer() -> Weight {
-		<SelfWeightOf<T>>::transfer_raw() + <PalletCommonWeightOf<T>>::check_accesslist() * 2
+		<SelfWeightOf<T>>::transfer_raw()
+			.saturating_add(<PalletCommonWeightOf<T>>::check_accesslist().saturating_mul(2))
 	}
 
 	fn approve() -> Weight {
@@ -93,28 +82,14 @@
 
 	fn transfer_from() -> Weight {
 		Self::transfer()
-			+ <SelfWeightOf<T>>::check_allowed_raw()
-			+ <SelfWeightOf<T>>::set_allowance_unchecked_raw()
+			.saturating_add(<SelfWeightOf<T>>::check_allowed_raw())
+			.saturating_add(<SelfWeightOf<T>>::set_allowance_unchecked_raw())
 	}
 
 	fn burn_from() -> Weight {
 		<SelfWeightOf<T>>::burn_from()
 	}
 
-	fn burn_recursively_self_raw() -> Weight {
-		// Read to get total balance
-		Self::burn_item() + T::DbWeight::get().reads(1)
-	}
-
-	fn burn_recursively_breadth_raw(_amount: u32) -> Weight {
-		// Fungible tokens can't have children
-		Weight::zero()
-	}
-
-	fn token_owner() -> Weight {
-		Weight::zero()
-	}
-
 	fn set_allowance_for_all() -> Weight {
 		Weight::zero()
 	}
@@ -200,26 +175,6 @@
 		with_weight(
 			<Pallet<T>>::burn(self, &sender, amount),
 			<CommonWeights<T>>::burn_item(),
-		)
-	}
-
-	fn burn_item_recursively(
-		&self,
-		sender: T::CrossAccountId,
-		token: TokenId,
-		self_budget: &dyn Budget,
-		_breadth_budget: &dyn Budget,
-	) -> DispatchResultWithPostInfo {
-		// Should not happen?
-		ensure!(
-			token == TokenId::default(),
-			<Error<T>>::FungibleItemsHaveNoId
-		);
-		ensure!(self_budget.consume(), <StructureError<T>>::DepthLimit,);
-
-		with_weight(
-			<Pallet<T>>::burn(self, &sender, <Balance<T>>::get((self.id, &sender))),
-			<CommonWeights<T>>::burn_recursively_self_raw(),
 		)
 	}
 
modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -32,12 +32,12 @@
 use pallet_evm_coder_substrate::{
 	call, dispatch_to_evm,
 	execution::{PreDispatch, Result},
-	frontier_contract,
+	frontier_contract, SubstrateRecorder,
 };
 use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};
 use sp_core::{Get, U256};
 use sp_std::vec::Vec;
-use up_data_structs::CollectionMode;
+use up_data_structs::{budget::Budget, CollectionMode};
 
 use crate::{
 	common::CommonWeights, weights::WeightInfo, Allowance, Balance, Config, FungibleHandle, Pallet,
@@ -73,6 +73,10 @@
 	amount: U256,
 }
 
+fn nesting_budget<T: Config>(recorder: &SubstrateRecorder<T>) -> impl Budget + '_ {
+	recorder.weight_calls_budget(<StructureWeight<T>>::find_parent())
+}
+
 #[solidity_interface(name = ERC20, events(ERC20Events), enum(derive(PreDispatch)), enum_attr(weight), expect_selector = 0x942e8b22)]
 impl<T: Config> FungibleHandle<T> {
 	fn name(&self) -> Result<String> {
@@ -106,11 +110,8 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = T::CrossAccountId::from_eth(to);
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::transfer(self, &caller, &to, amount, &budget)
+		<Pallet<T>>::transfer(self, &caller, &to, amount, &nesting_budget(&self.recorder))
 			.map_err(|e| dispatch_to_evm::<T>(e.error))?;
 		Ok(true)
 	}
@@ -127,12 +128,16 @@
 		let from = T::CrossAccountId::from_eth(from);
 		let to = T::CrossAccountId::from_eth(to);
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)
-			.map_err(|e| dispatch_to_evm::<T>(e.error))?;
+		<Pallet<T>>::transfer_from(
+			self,
+			&caller,
+			&from,
+			&to,
+			amount,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(|e| dispatch_to_evm::<T>(e.error))?;
 		Ok(true)
 	}
 	#[weight(<SelfWeightOf<T>>::approve())]
@@ -164,10 +169,8 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = T::CrossAccountId::from_eth(to);
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
-		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), &nesting_budget(&self.recorder))
 			.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
@@ -201,10 +204,8 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = to.into_sub_cross_account::<T>()?;
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
-		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), &nesting_budget(&self.recorder))
 			.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
@@ -236,12 +237,15 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let from = T::CrossAccountId::from_eth(from);
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::burn_from(self, &caller, &from, amount, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::burn_from(
+			self,
+			&caller,
+			&from,
+			amount,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
 
@@ -260,12 +264,15 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let from = from.into_sub_cross_account::<T>()?;
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::burn_from(self, &caller, &from, amount, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::burn_from(
+			self,
+			&caller,
+			&from,
+			amount,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
 
@@ -274,9 +281,6 @@
 	#[weight(<SelfWeightOf<T>>::create_multiple_items_ex(amounts.len() as u32))]
 	fn mint_bulk(&mut self, caller: Caller, amounts: Vec<AmountForAddress>) -> Result<bool> {
 		let caller = T::CrossAccountId::from_eth(caller);
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 		let amounts = amounts
 			.into_iter()
 			.map(|AmountForAddress { to, amount }| {
@@ -287,7 +291,7 @@
 			})
 			.collect::<Result<_>>()?;
 
-		<Pallet<T>>::create_multiple_items(self, &caller, amounts, &budget)
+		<Pallet<T>>::create_multiple_items(self, &caller, amounts, &nesting_budget(&self.recorder))
 			.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
@@ -297,11 +301,9 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = to.into_sub_cross_account::<T>()?;
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::transfer(self, &caller, &to, amount, &budget).map_err(|_| "transfer error")?;
+		<Pallet<T>>::transfer(self, &caller, &to, amount, &nesting_budget(&self.recorder))
+			.map_err(|_| "transfer error")?;
 		Ok(true)
 	}
 
@@ -317,12 +319,16 @@
 		let from = from.into_sub_cross_account::<T>()?;
 		let to = to.into_sub_cross_account::<T>()?;
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)
-			.map_err(|e| dispatch_to_evm::<T>(e.error))?;
+		<Pallet<T>>::transfer_from(
+			self,
+			&caller,
+			&from,
+			&to,
+			amount,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(|e| dispatch_to_evm::<T>(e.error))?;
 		Ok(true)
 	}
 
modifiedpallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -18,7 +18,6 @@
 use pallet_common::{
 	bench_init,
 	benchmarking::{create_collection_raw, property_key, property_value},
-	CommonCollectionOperations,
 };
 use sp_std::prelude::*;
 use up_data_structs::{
@@ -131,49 +130,8 @@
 		#[block]
 		{
 			<Pallet<T>>::burn(&collection, &burner, item)?;
-		}
-
-		Ok(())
-	}
-
-	#[benchmark]
-	fn burn_recursively_self_raw() -> Result<(), BenchmarkError> {
-		bench_init! {
-			owner: sub; collection: collection(owner);
-			sender: cross_from_sub(owner); burner: cross_sub;
-		};
-		let item = create_max_item(&collection, &sender, burner.clone())?;
-
-		#[block]
-		{
-			<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?;
-		}
-
-		Ok(())
-	}
-
-	#[benchmark]
-	fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(
-		b: Linear<0, 200>,
-	) -> Result<(), BenchmarkError> {
-		bench_init! {
-			owner: sub; collection: collection(owner);
-			sender: cross_from_sub(owner); burner: cross_sub;
-		};
-		let item = create_max_item(&collection, &sender, burner.clone())?;
-		for _ in 0..b {
-			create_max_item(
-				&collection,
-				&sender,
-				T::CrossTokenAddressMapping::token_to_address(collection.id, item),
-			)?;
 		}
 
-		#[block]
-		{
-			<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?;
-		}
-
 		Ok(())
 	}
 
@@ -267,38 +225,29 @@
 	}
 
 	#[benchmark]
-	fn set_token_property_permissions(
-		b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
-	) -> Result<(), BenchmarkError> {
+	fn load_token_properties() -> Result<(), BenchmarkError> {
 		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub;
 		};
-		let perms = (0..b)
-			.map(|k| PropertyKeyPermission {
-				key: property_key(k as usize),
-				permission: PropertyPermission {
-					mutable: false,
-					collection_admin: false,
-					token_owner: false,
-				},
-			})
-			.collect::<Vec<_>>();
 
+		let item = create_max_item(&collection, &owner, owner.clone())?;
+
 		#[block]
 		{
-			<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
+			pallet_common::BenchmarkPropertyWriter::<T>::load_token_properties(&collection, item);
 		}
 
 		Ok(())
 	}
 
 	#[benchmark]
-	fn set_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {
+	fn write_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {
 		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub;
 		};
+
 		let perms = (0..b)
 			.map(|k| PropertyKeyPermission {
 				key: property_key(k as usize),
@@ -318,71 +267,29 @@
 			.collect::<Vec<_>>();
 		let item = create_max_item(&collection, &owner, owner.clone())?;
 
+		let lazy_collection_info =
+			pallet_common::BenchmarkPropertyWriter::<T>::load_collection_info(&collection, &owner);
+
 		#[block]
 		{
-			<Pallet<T>>::set_token_properties(
-				&collection,
-				&owner,
+			let mut property_writer =
+				pallet_common::BenchmarkPropertyWriter::new(&collection, lazy_collection_info);
+
+			property_writer.write_token_properties(
 				item,
 				props.into_iter(),
-				&Unlimited,
+				crate::erc::ERC721TokenEvent::TokenChanged {
+					token_id: item.into(),
+				}
+				.to_log(T::ContractAddress::get()),
 			)?;
 		}
 
 		Ok(())
 	}
 
-	// TODO:
 	#[benchmark]
-	fn init_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {
-		// bench_init! {
-		// 	owner: sub; collection: collection(owner);
-		// 	owner: cross_from_sub;
-		// };
-
-		// let perms = (0..b)
-		// 	.map(|k| PropertyKeyPermission {
-		// 		key: property_key(k as usize),
-		// 		permission: PropertyPermission {
-		// 			mutable: false,
-		// 			collection_admin: true,
-		// 			token_owner: true,
-		// 		},
-		// 	})
-		// 	.collect::<Vec<_>>();
-		// <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
-		#[block]
-		{}
-		// let props = (0..b)
-		// 	.map(|k| Property {
-		// 		key: property_key(k as usize),
-		// 		value: property_value(),
-		// 	})
-		// 	.collect::<Vec<_>>();
-		// let item = create_max_item(&collection, &owner, owner.clone())?;
-
-		// let (is_collection_admin, property_permissions) =
-		// 	load_is_admin_and_property_permissions(&collection, &owner);
-		// #[block]
-		// {
-		// 	let mut property_writer =
-		// 		pallet_common::BenchmarkPropertyWriter::new(&collection, lazy_collection_info);
-
-		// 	property_writer.write_token_properties(
-		// 		item,
-		// 		props.into_iter(),
-		// 		crate::erc::ERC721TokenEvent::TokenChanged {
-		// 			token_id: item.into(),
-		// 		}
-		// 		.to_log(T::ContractAddress::get()),
-		// 	)?;
-		// }
-
-		Ok(())
-	}
-
-	#[benchmark]
-	fn delete_token_properties(
+	fn set_token_property_permissions(
 		b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
 	) -> Result<(), BenchmarkError> {
 		bench_init! {
@@ -393,54 +300,16 @@
 			.map(|k| PropertyKeyPermission {
 				key: property_key(k as usize),
 				permission: PropertyPermission {
-					mutable: true,
-					collection_admin: true,
-					token_owner: true,
+					mutable: false,
+					collection_admin: false,
+					token_owner: false,
 				},
 			})
 			.collect::<Vec<_>>();
-		<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
-		let props = (0..b)
-			.map(|k| Property {
-				key: property_key(k as usize),
-				value: property_value(),
-			})
-			.collect::<Vec<_>>();
-		let item = create_max_item(&collection, &owner, owner.clone())?;
-		<Pallet<T>>::set_token_properties(
-			&collection,
-			&owner,
-			item,
-			props.into_iter(),
-			&Unlimited,
-		)?;
-		let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();
 
 		#[block]
 		{
-			<Pallet<T>>::delete_token_properties(
-				&collection,
-				&owner,
-				item,
-				to_delete.into_iter(),
-				&Unlimited,
-			)?;
-		}
-
-		Ok(())
-	}
-
-	#[benchmark]
-	fn token_owner() -> Result<(), BenchmarkError> {
-		bench_init! {
-			owner: sub; collection: collection(owner);
-			owner: cross_from_sub;
-		};
-		let item = create_max_item(&collection, &owner, owner.clone())?;
-
-		#[block]
-		{
-			collection.token_owner(item).unwrap();
+			<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
 		}
 
 		Ok(())
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -18,8 +18,9 @@
 
 use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};
 use pallet_common::{
-	init_token_properties_delta, weights::WeightInfo as _, with_weight, CommonCollectionOperations,
-	CommonWeightInfo, RefungibleExtensions, SelfWeightOf as PalletCommonWeightOf,
+	weights::WeightInfo as _, with_weight, write_token_properties_total_weight,
+	CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions,
+	SelfWeightOf as PalletCommonWeightOf,
 };
 use pallet_structure::Pallet as PalletStructure;
 use sp_runtime::DispatchError;
@@ -38,24 +39,21 @@
 impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {
 	fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {
 		match data {
-			CreateItemExData::NFT(t) => <SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32)
-				.saturating_add(init_token_properties_delta::<T, _>(
-					t.iter().map(|t| t.properties.len() as u32),
-					<SelfWeightOf<T>>::init_token_properties,
-				)),
+			CreateItemExData::NFT(t) => mint_with_props_weight::<T>(
+				<SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32),
+				t.iter().map(|t| t.properties.len() as u32),
+			),
 			_ => Weight::zero(),
 		}
 	}
 
 	fn create_multiple_items(data: &[up_data_structs::CreateItemData]) -> Weight {
-		<SelfWeightOf<T>>::create_multiple_items(data.len() as u32).saturating_add(
-			init_token_properties_delta::<T, _>(
-				data.iter().map(|t| match t {
-					up_data_structs::CreateItemData::NFT(n) => n.properties.len() as u32,
-					_ => 0,
-				}),
-				<SelfWeightOf<T>>::init_token_properties,
-			),
+		mint_with_props_weight::<T>(
+			<SelfWeightOf<T>>::create_multiple_items(data.len() as u32),
+			data.iter().map(|t| match t {
+				up_data_structs::CreateItemData::NFT(n) => n.properties.len() as u32,
+				_ => 0,
+			}),
 		)
 	}
 
@@ -65,18 +63,17 @@
 
 	fn set_collection_properties(amount: u32) -> Weight {
 		<pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)
-	}
-
-	fn delete_collection_properties(amount: u32) -> Weight {
-		<pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)
 	}
 
 	fn set_token_properties(amount: u32) -> Weight {
-		<SelfWeightOf<T>>::set_token_properties(amount)
+		write_token_properties_total_weight::<T, _>([amount].into_iter(), |amount| {
+			<SelfWeightOf<T>>::load_token_properties()
+				.saturating_add(<SelfWeightOf<T>>::write_token_properties(amount))
+		})
 	}
 
 	fn delete_token_properties(amount: u32) -> Weight {
-		<SelfWeightOf<T>>::delete_token_properties(amount)
+		Self::set_token_properties(amount)
 	}
 
 	fn set_token_property_permissions(amount: u32) -> Weight {
@@ -84,7 +81,8 @@
 	}
 
 	fn transfer() -> Weight {
-		<SelfWeightOf<T>>::transfer_raw() + <PalletCommonWeightOf<T>>::check_accesslist() * 2
+		<SelfWeightOf<T>>::transfer_raw()
+			.saturating_add(<PalletCommonWeightOf<T>>::check_accesslist().saturating_mul(2))
 	}
 
 	fn approve() -> Weight {
@@ -96,24 +94,11 @@
 	}
 
 	fn transfer_from() -> Weight {
-		Self::transfer() + <SelfWeightOf<T>>::check_allowed_raw()
+		Self::transfer().saturating_add(<SelfWeightOf<T>>::check_allowed_raw())
 	}
 
 	fn burn_from() -> Weight {
 		<SelfWeightOf<T>>::burn_from()
-	}
-
-	fn burn_recursively_self_raw() -> Weight {
-		<SelfWeightOf<T>>::burn_recursively_self_raw()
-	}
-
-	fn burn_recursively_breadth_raw(amount: u32) -> Weight {
-		<SelfWeightOf<T>>::burn_recursively_breadth_plus_self_plus_self_per_each_raw(amount)
-			.saturating_sub(Self::burn_recursively_self_raw().saturating_mul(amount as u64 + 1))
-	}
-
-	fn token_owner() -> Weight {
-		<SelfWeightOf<T>>::token_owner()
 	}
 
 	fn set_allowance_for_all() -> Weight {
@@ -125,6 +110,20 @@
 	}
 }
 
+/// Weight of minting tokens with properties
+/// * `create_no_data_weight` -- the weight of minting without properties
+/// * `token_properties_nums` -- number of properties of each token
+#[inline]
+pub(crate) fn mint_with_props_weight<T: Config>(
+	create_no_data_weight: Weight,
+	token_properties_nums: impl Iterator<Item = u32> + Clone,
+) -> Weight {
+	create_no_data_weight.saturating_add(write_token_properties_total_weight::<T, _>(
+		token_properties_nums,
+		<SelfWeightOf<T>>::write_token_properties,
+	))
+}
+
 fn map_create_data<T: Config>(
 	data: up_data_structs::CreateItemData,
 	to: &T::CrossAccountId,
@@ -306,16 +305,6 @@
 			<Pallet<T>>::check_token_immediate_ownership(self, token, &sender)?;
 			Ok(().into())
 		}
-	}
-
-	fn burn_item_recursively(
-		&self,
-		sender: T::CrossAccountId,
-		token: TokenId,
-		self_budget: &dyn Budget,
-		breadth_budget: &dyn Budget,
-	) -> DispatchResultWithPostInfo {
-		<Pallet<T>>::burn_recursively(self, &sender, token, self_budget, breadth_budget)
 	}
 
 	fn transfer(
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -38,19 +38,21 @@
 use pallet_evm_coder_substrate::{
 	call, dispatch_to_evm,
 	execution::{Error, PreDispatch, Result},
-	frontier_contract,
+	frontier_contract, SubstrateRecorder,
 };
 use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};
 use sp_core::{Get, U256};
 use sp_std::{vec, vec::Vec};
 use up_data_structs::{
-	CollectionId, CollectionPropertiesVec, Property, PropertyKey, PropertyKeyPermission,
-	PropertyPermission, TokenId,
+	budget::Budget, CollectionId, CollectionPropertiesVec, Property, PropertyKey,
+	PropertyKeyPermission, PropertyPermission, TokenId,
 };
 
 use crate::{
-	common::CommonWeights, weights::WeightInfo, AccountBalance, Config, CreateItemData,
-	NonfungibleHandle, Pallet, SelfWeightOf, TokenData, TokenProperties, TokensMinted,
+	common::{mint_with_props_weight, CommonWeights},
+	weights::WeightInfo,
+	AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, SelfWeightOf, TokenData,
+	TokenProperties, TokensMinted,
 };
 
 /// Nft events.
@@ -78,6 +80,10 @@
 	impl<T: Config> Contract for NonfungibleHandle<T> {...}
 }
 
+fn nesting_budget<T: Config>(recorder: &SubstrateRecorder<T>) -> impl Budget + '_ {
+	recorder.weight_calls_budget(<StructureWeight<T>>::find_parent())
+}
+
 /// @title A contract that allows to set and delete token properties and change token property permissions.
 #[solidity_interface(name = TokenProperties, events(ERC721TokenEvent), enum(derive(PreDispatch)), enum_attr(weight))]
 impl<T: Config> NonfungibleHandle<T> {
@@ -146,7 +152,7 @@
 	/// @param key Property key.
 	/// @param value Property value.
 	#[solidity(hide)]
-	#[weight(<SelfWeightOf<T>>::set_token_properties(1))]
+	#[weight(<CommonWeights<T>>::set_token_properties(1))]
 	fn set_property(
 		&mut self,
 		caller: Caller,
@@ -161,16 +167,12 @@
 			.map_err(|_| "key too long")?;
 		let value = value.0.try_into().map_err(|_| "value too long")?;
 
-		let nesting_budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
-
 		<Pallet<T>>::set_token_property(
 			self,
 			&caller,
 			TokenId(token_id),
 			Property { key, value },
-			&nesting_budget,
+			&nesting_budget(&self.recorder),
 		)
 		.map_err(dispatch_to_evm::<T>)
 	}
@@ -179,7 +181,7 @@
 	/// @dev Throws error if `msg.sender` has no permission to edit the property.
 	/// @param tokenId ID of the token.
 	/// @param properties settable properties
-	#[weight(<SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]
+	#[weight(<CommonWeights<T>>::set_token_properties(properties.len() as u32))]
 	fn set_properties(
 		&mut self,
 		caller: Caller,
@@ -189,10 +191,6 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
 
-		let nesting_budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
-
 		let properties = properties
 			.into_iter()
 			.map(eth::Property::try_into)
@@ -203,7 +201,7 @@
 			&caller,
 			TokenId(token_id),
 			properties.into_iter(),
-			&nesting_budget,
+			&nesting_budget(&self.recorder),
 		)
 		.map_err(dispatch_to_evm::<T>)
 	}
@@ -213,7 +211,7 @@
 	/// @param tokenId ID of the token.
 	/// @param key Property key.
 	#[solidity(hide)]
-	#[weight(<SelfWeightOf<T>>::delete_token_properties(1))]
+	#[weight(<CommonWeights<T>>::delete_token_properties(1))]
 	fn delete_property(&mut self, token_id: U256, caller: Caller, key: String) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
@@ -221,19 +219,21 @@
 			.try_into()
 			.map_err(|_| "key too long")?;
 
-		let nesting_budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
-
-		<Pallet<T>>::delete_token_property(self, &caller, TokenId(token_id), key, &nesting_budget)
-			.map_err(dispatch_to_evm::<T>)
+		<Pallet<T>>::delete_token_property(
+			self,
+			&caller,
+			TokenId(token_id),
+			key,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)
 	}
 
 	/// @notice Delete token properties value.
 	/// @dev Throws error if `msg.sender` has no permission to edit the property.
 	/// @param tokenId ID of the token.
 	/// @param keys Properties key.
-	#[weight(<SelfWeightOf<T>>::delete_token_properties(keys.len() as u32))]
+	#[weight(<CommonWeights<T>>::delete_token_properties(keys.len() as u32))]
 	fn delete_properties(
 		&mut self,
 		token_id: U256,
@@ -247,16 +247,12 @@
 			.map(|k| Ok(<Vec<u8>>::from(k).try_into().map_err(|_| "key too long")?))
 			.collect::<Result<Vec<_>>>()?;
 
-		let nesting_budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
-
 		<Pallet<T>>::delete_token_properties(
 			self,
 			&caller,
 			TokenId(token_id),
 			keys.into_iter(),
-			&nesting_budget,
+			&nesting_budget(&self.recorder),
 		)
 		.map_err(dispatch_to_evm::<T>)
 	}
@@ -481,12 +477,16 @@
 		let from = T::CrossAccountId::from_eth(from);
 		let to = T::CrossAccountId::from_eth(to);
 		let token = token_id.try_into()?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::transfer_from(self, &caller, &from, &to, token, &budget)
-			.map_err(|e| dispatch_to_evm::<T>(e.error))?;
+		<Pallet<T>>::transfer_from(
+			self,
+			&caller,
+			&from,
+			&to,
+			token,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(|e| dispatch_to_evm::<T>(e.error))?;
 		Ok(())
 	}
 
@@ -594,9 +594,6 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = T::CrossAccountId::from_eth(to);
 		let token_id: u32 = token_id.try_into()?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		if <TokensMinted<T>>::get(self.id)
 			.checked_add(1)
@@ -613,7 +610,7 @@
 				properties: BoundedVec::default(),
 				owner: to,
 			},
-			&budget,
+			&nesting_budget(&self.recorder),
 		)
 		.map_err(dispatch_to_evm::<T>)?;
 
@@ -625,7 +622,7 @@
 	/// @param tokenUri Token URI that would be stored in the NFT properties
 	/// @return uint256 The id of the newly minted token
 	#[solidity(rename_selector = "mintWithTokenURI")]
-	#[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(1))]
+	#[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [1].into_iter()))]
 	fn mint_with_token_uri(
 		&mut self,
 		caller: Caller,
@@ -647,7 +644,7 @@
 	/// @param tokenId ID of the minted NFT
 	/// @param tokenUri Token URI that would be stored in the NFT properties
 	#[solidity(hide, rename_selector = "mintWithTokenURI")]
-	#[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(1))]
+	#[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [1].into_iter()))]
 	fn mint_with_token_uri_check_id(
 		&mut self,
 		caller: Caller,
@@ -664,9 +661,6 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = T::CrossAccountId::from_eth(to);
 		let token_id: u32 = token_id.try_into().map_err(|_| "amount overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		if <TokensMinted<T>>::get(self.id)
 			.checked_add(1)
@@ -694,7 +688,7 @@
 				properties,
 				owner: to,
 			},
-			&budget,
+			&nesting_budget(&self.recorder),
 		)
 		.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
@@ -840,11 +834,8 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = T::CrossAccountId::from_eth(to);
 		let token = token_id.try_into()?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::transfer(self, &caller, &to, token, &budget)
+		<Pallet<T>>::transfer(self, &caller, &to, token, &nesting_budget(&self.recorder))
 			.map_err(|e| dispatch_to_evm::<T>(e.error))?;
 		Ok(())
 	}
@@ -864,11 +855,8 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = to.into_sub_cross_account::<T>()?;
 		let token = token_id.try_into()?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::transfer(self, &caller, &to, token, &budget)
+		<Pallet<T>>::transfer(self, &caller, &to, token, &nesting_budget(&self.recorder))
 			.map_err(|e| dispatch_to_evm::<T>(e.error))?;
 		Ok(())
 	}
@@ -891,11 +879,16 @@
 		let from = from.into_sub_cross_account::<T>()?;
 		let to = to.into_sub_cross_account::<T>()?;
 		let token_id = token_id.try_into()?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
-		Pallet::<T>::transfer_from(self, &caller, &from, &to, token_id, &budget)
-			.map_err(|e| dispatch_to_evm::<T>(e.error))?;
+
+		Pallet::<T>::transfer_from(
+			self,
+			&caller,
+			&from,
+			&to,
+			token_id,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(|e| dispatch_to_evm::<T>(e.error))?;
 		Ok(())
 	}
 
@@ -911,11 +904,8 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let from = T::CrossAccountId::from_eth(from);
 		let token = token_id.try_into()?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::burn_from(self, &caller, &from, token, &budget)
+		<Pallet<T>>::burn_from(self, &caller, &from, token, &nesting_budget(&self.recorder))
 			.map_err(dispatch_to_evm::<T>)?;
 		Ok(())
 	}
@@ -936,11 +926,8 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let from = from.into_sub_cross_account::<T>()?;
 		let token = token_id.try_into()?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::burn_from(self, &caller, &from, token, &budget)
+		<Pallet<T>>::burn_from(self, &caller, &from, token, &nesting_budget(&self.recorder))
 			.map_err(dispatch_to_evm::<T>)?;
 		Ok(())
 	}
@@ -966,9 +953,6 @@
 		let mut expected_index = <TokensMinted<T>>::get(self.id)
 			.checked_add(1)
 			.ok_or("item id overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		let total_tokens = token_ids.len();
 		for id in token_ids.into_iter() {
@@ -985,19 +969,21 @@
 			})
 			.collect();
 
-		<Pallet<T>>::create_multiple_items(self, &caller, data, &budget)
+		<Pallet<T>>::create_multiple_items(self, &caller, data, &nesting_budget(&self.recorder))
 			.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
 
 	/// @notice Function to mint a token.
 	/// @param data Array of pairs of token owner and token's properties for minted token
-	#[weight(<SelfWeightOf<T>>::create_multiple_items(data.len() as u32) + <SelfWeightOf<T>>::set_token_properties(data.len() as u32))]
+	#[weight(
+		mint_with_props_weight::<T>(
+			<SelfWeightOf<T>>::create_multiple_items_ex(data.len() as u32),
+			data.iter().map(|d| d.properties.len() as u32),
+		)
+	)]
 	fn mint_bulk_cross(&mut self, caller: Caller, data: Vec<MintTokenData>) -> Result<bool> {
 		let caller = T::CrossAccountId::from_eth(caller);
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		let mut create_nft_data = Vec::with_capacity(data.len());
 		for MintTokenData { owner, properties } in data {
@@ -1013,8 +999,13 @@
 			});
 		}
 
-		<Pallet<T>>::create_multiple_items(self, &caller, create_nft_data, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::create_multiple_items(
+			self,
+			&caller,
+			create_nft_data,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
 
@@ -1024,7 +1015,12 @@
 	/// @param to The new owner
 	/// @param tokens array of pairs of token ID and token URI for minted tokens
 	#[solidity(hide, rename_selector = "mintBulkWithTokenURI")]
-	#[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32) + <SelfWeightOf<T>>::set_token_properties(tokens.len() as u32))]
+	#[weight(
+		mint_with_props_weight::<T>(
+			<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32),
+			tokens.iter().map(|_| 1),
+		)
+	)]
 	fn mint_bulk_with_token_uri(
 		&mut self,
 		caller: Caller,
@@ -1037,9 +1033,6 @@
 		let mut expected_index = <TokensMinted<T>>::get(self.id)
 			.checked_add(1)
 			.ok_or("item id overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		let mut data = Vec::with_capacity(tokens.len());
 		for TokenUri { id, uri } in tokens {
@@ -1066,7 +1059,7 @@
 			});
 		}
 
-		<Pallet<T>>::create_multiple_items(self, &caller, data, &budget)
+		<Pallet<T>>::create_multiple_items(self, &caller, data, &nesting_budget(&self.recorder))
 			.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
@@ -1075,7 +1068,7 @@
 	/// @param to The new owner crossAccountId
 	/// @param properties Properties of minted token
 	/// @return uint256 The id of the newly minted token
-	#[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]
+	#[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [properties.len() as u32].into_iter()))]
 	fn mint_cross(
 		&mut self,
 		caller: Caller,
@@ -1096,10 +1089,6 @@
 			.map_err(|_| Error::Revert("too many properties".to_string()))?;
 
 		let caller = T::CrossAccountId::from_eth(caller);
-
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		<Pallet<T>>::create_item(
 			self,
@@ -1108,7 +1097,7 @@
 				properties,
 				owner: to,
 			},
-			&budget,
+			&nesting_budget(&self.recorder),
 		)
 		.map_err(dispatch_to_evm::<T>)?;
 
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -109,7 +109,7 @@
 };
 use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
 use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
-use pallet_structure::{Error as StructureError, Pallet as PalletStructure};
+use pallet_structure::Pallet as PalletStructure;
 use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
 use scale_info::TypeInfo;
 use sp_core::{Get, H160};
@@ -502,52 +502,7 @@
 		));
 		Ok(())
 	}
-
-	/// Same as [`burn`] but burns all the tokens that are nested in the token first
-	///
-	/// - `self_budget`: Limit for searching children in depth.
-	/// - `breadth_budget`: Limit of breadth of searching children.
-	///
-	/// [`burn`]: struct.Pallet.html#method.burn
-	#[transactional]
-	pub fn burn_recursively(
-		collection: &NonfungibleHandle<T>,
-		sender: &T::CrossAccountId,
-		token: TokenId,
-		self_budget: &dyn Budget,
-		breadth_budget: &dyn Budget,
-	) -> DispatchResultWithPostInfo {
-		ensure!(self_budget.consume(), <StructureError<T>>::DepthLimit,);
 
-		let current_token_account =
-			T::CrossTokenAddressMapping::token_to_address(collection.id, token);
-
-		let mut weight = Weight::zero();
-
-		// This method is transactional, if user in fact doesn't have permissions to remove token -
-		// tokens removed here will be restored after rejected transaction
-		for ((collection, token), _) in <TokenChildren<T>>::iter_prefix((collection.id, token)) {
-			ensure!(breadth_budget.consume(), <StructureError<T>>::BreadthLimit,);
-			let PostDispatchInfo { actual_weight, .. } =
-				<PalletStructure<T>>::burn_item_recursively(
-					current_token_account.clone(),
-					collection,
-					token,
-					self_budget,
-					breadth_budget,
-				)?;
-			if let Some(actual_weight) = actual_weight {
-				weight = weight.saturating_add(actual_weight);
-			}
-		}
-
-		Self::burn(collection, sender, token)?;
-		DispatchResultWithPostInfo::Ok(PostDispatchInfo {
-			actual_weight: Some(weight + <SelfWeightOf<T>>::burn_item()),
-			pays_fee: Pays::Yes,
-		})
-	}
-
 	/// A batch operation to add, edit or remove properties for a token.
 	///
 	/// - `nesting_budget`: Limit for searching parents in-depth to check ownership.
@@ -568,7 +523,7 @@
 		nesting_budget: &dyn Budget,
 	) -> DispatchResult {
 		let mut property_writer =
-			pallet_common::property_writer_for_existing_token(collection, sender);
+			pallet_common::ExistingTokenPropertyWriter::new(collection, sender);
 
 		property_writer.write_token_properties(
 			sender,
@@ -915,7 +870,7 @@
 
 		// =========
 
-		let mut property_writer = pallet_common::property_writer_for_new_token(collection, sender);
+		let mut property_writer = pallet_common::NewTokenPropertyWriter::new(collection, sender);
 
 		with_transaction(|| {
 			for (i, data) in data.iter().enumerate() {
modifiedpallets/nonfungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -3,13 +3,13 @@
 //! Autogenerated weights for pallet_nonfungible
 //!
 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-09-30, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-10-13, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
 //! WORST CASE MAP SIZE: `1000000`
-//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
-//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
+//! HOSTNAME: `hearthstone`, CPU: `AMD Ryzen 9 7950X3D 16-Core Processor`
+//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
 
 // Executed Command:
-// target/production/unique-collator
+// ./target/production/unique-collator
 // benchmark
 // pallet
 // --pallet
@@ -20,7 +20,7 @@
 // *
 // --template=.maintain/frame-weight-template.hbs
 // --steps=50
-// --repeat=400
+// --repeat=80
 // --heap-pages=4096
 // --output=./pallets/nonfungible/src/weights.rs
 
@@ -37,18 +37,14 @@
 	fn create_multiple_items(b: u32, ) -> Weight;
 	fn create_multiple_items_ex(b: u32, ) -> Weight;
 	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_raw() -> Weight;
 	fn approve() -> Weight;
 	fn approve_from() -> Weight;
 	fn check_allowed_raw() -> Weight;
 	fn burn_from() -> Weight;
+	fn load_token_properties() -> Weight;
+	fn write_token_properties(b: u32, ) -> Weight;
 	fn set_token_property_permissions(b: u32, ) -> Weight;
-	fn set_token_properties(b: u32, ) -> Weight;
-	fn init_token_properties(b: u32, ) -> Weight;
-	fn delete_token_properties(b: u32, ) -> Weight;
-	fn token_owner() -> Weight;
 	fn set_allowance_for_all() -> Weight;
 	fn allowance_for_all() -> Weight;
 	fn repair_item() -> Weight;
@@ -57,321 +53,231 @@
 /// Weights for pallet_nonfungible using the Substrate node and recommended hardware.
 pub struct SubstrateWeight<T>(PhantomData<T>);
 impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
-	/// Storage: Nonfungible TokensMinted (r:1 w:1)
-	/// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Nonfungible AccountBalance (r:1 w:1)
-	/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenData (r:0 w:1)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Owned (r:0 w:1)
-	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::TokensMinted` (r:1 w:1)
+	/// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::TokenData` (r:0 w:1)
+	/// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::Owned` (r:0 w:1)
+	/// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn create_item() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `142`
 		//  Estimated: `3530`
-		// Minimum execution time: 9_726_000 picoseconds.
-		Weight::from_parts(10_059_000, 3530)
+		// Minimum execution time: 15_410_000 picoseconds.
+		Weight::from_parts(15_850_000, 3530)
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 			.saturating_add(T::DbWeight::get().writes(4_u64))
 	}
-	/// Storage: Nonfungible TokensMinted (r:1 w:1)
-	/// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Nonfungible AccountBalance (r:1 w:1)
-	/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenData (r:0 w:200)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Owned (r:0 w:200)
-	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::TokensMinted` (r:1 w:1)
+	/// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::TokenData` (r:0 w:200)
+	/// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::Owned` (r:0 w:200)
+	/// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 200]`.
 	fn create_multiple_items(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `142`
 		//  Estimated: `3530`
-		// Minimum execution time: 3_270_000 picoseconds.
-		Weight::from_parts(3_693_659, 3530)
-			// Standard Error: 255
-			.saturating_add(Weight::from_parts(3_024_284, 0).saturating_mul(b.into()))
+		// Minimum execution time: 3_300_000 picoseconds.
+		Weight::from_parts(5_992_994, 3530)
+			// Standard Error: 4_478
+			.saturating_add(Weight::from_parts(8_002_092, 0).saturating_mul(b.into()))
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 			.saturating_add(T::DbWeight::get().writes(2_u64))
 			.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(b.into())))
 	}
-	/// Storage: Nonfungible TokensMinted (r:1 w:1)
-	/// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Nonfungible AccountBalance (r:200 w:200)
-	/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenData (r:0 w:200)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Owned (r:0 w:200)
-	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::TokensMinted` (r:1 w:1)
+	/// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::AccountBalance` (r:200 w:200)
+	/// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::TokenData` (r:0 w:200)
+	/// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::Owned` (r:0 w:200)
+	/// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 200]`.
 	fn create_multiple_items_ex(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `142`
 		//  Estimated: `3481 + b * (2540 ±0)`
-		// Minimum execution time: 3_188_000 picoseconds.
-		Weight::from_parts(3_307_000, 3481)
-			// Standard Error: 567
-			.saturating_add(Weight::from_parts(4_320_449, 0).saturating_mul(b.into()))
+		// Minimum execution time: 3_300_000 picoseconds.
+		Weight::from_parts(3_980_000, 3481)
+			// Standard Error: 1_382
+			.saturating_add(Weight::from_parts(11_259_286, 0).saturating_mul(b.into()))
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 			.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))
 			.saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))
 	}
-	/// Storage: Nonfungible TokenData (r:1 w:1)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenChildren (r:1 w:0)
-	/// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokensBurnt (r:1 w:1)
-	/// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Nonfungible AccountBalance (r:1 w:1)
-	/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Allowance (r:1 w:0)
-	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Owned (r:0 w:1)
-	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenProperties (r:0 w:1)
-	/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, 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::TokenChildren` (r:1 w:0)
+	/// Proof: `Nonfungible::TokenChildren` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::TokensBurnt` (r:1 w:1)
+	/// Proof: `Nonfungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::Allowance` (r:1 w:0)
+	/// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::Owned` (r:0 w:1)
+	/// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::TokenProperties` (r:0 w:1)
+	/// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
 	fn burn_item() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `380`
 		//  Estimated: `3530`
-		// Minimum execution time: 18_062_000 picoseconds.
-		Weight::from_parts(18_433_000, 3530)
-			.saturating_add(T::DbWeight::get().reads(5_u64))
-			.saturating_add(T::DbWeight::get().writes(5_u64))
-	}
-	/// Storage: Nonfungible TokenChildren (r:1 w:0)
-	/// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, 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 TokensBurnt (r:1 w:1)
-	/// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Nonfungible AccountBalance (r:1 w:1)
-	/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Allowance (r:1 w:0)
-	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Owned (r:0 w:1)
-	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenProperties (r:0 w:1)
-	/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
-	fn burn_recursively_self_raw() -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `380`
-		//  Estimated: `3530`
-		// Minimum execution time: 22_942_000 picoseconds.
-		Weight::from_parts(23_527_000, 3530)
+		// Minimum execution time: 26_360_000 picoseconds.
+		Weight::from_parts(26_850_000, 3530)
 			.saturating_add(T::DbWeight::get().reads(5_u64))
 			.saturating_add(T::DbWeight::get().writes(5_u64))
-	}
-	/// Storage: Nonfungible TokenChildren (r:401 w:200)
-	/// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
-	/// Storage: Common CollectionById (r:1 w:0)
-	/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenData (r:201 w:201)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokensBurnt (r:1 w:1)
-	/// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, 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 Allowance (r:201 w:0)
-	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Owned (r:0 w:201)
-	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenProperties (r:0 w:201)
-	/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
-	/// The range of component `b` is `[0, 200]`.
-	fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `1500 + b * (58 ±0)`
-		//  Estimated: `5874 + b * (5032 ±0)`
-		// Minimum execution time: 22_709_000 picoseconds.
-		Weight::from_parts(23_287_000, 5874)
-			// Standard Error: 89_471
-			.saturating_add(Weight::from_parts(63_285_201, 0).saturating_mul(b.into()))
-			.saturating_add(T::DbWeight::get().reads(7_u64))
-			.saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(b.into())))
-			.saturating_add(T::DbWeight::get().writes(6_u64))
-			.saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(b.into())))
-			.saturating_add(Weight::from_parts(0, 5032).saturating_mul(b.into()))
 	}
-	/// 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 Allowance (r:1 w:0)
-	/// 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)
+	/// 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::Allowance` (r:1 w:0)
+	/// 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_raw() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `380`
 		//  Estimated: `6070`
-		// Minimum execution time: 13_652_000 picoseconds.
-		Weight::from_parts(13_981_000, 6070)
+		// Minimum execution time: 22_710_000 picoseconds.
+		Weight::from_parts(23_130_000, 6070)
 			.saturating_add(T::DbWeight::get().reads(4_u64))
 			.saturating_add(T::DbWeight::get().writes(5_u64))
 	}
-	/// Storage: Nonfungible TokenData (r:1 w:0)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Allowance (r:1 w:1)
-	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::TokenData` (r:1 w:0)
+	/// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::Allowance` (r:1 w:1)
+	/// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
 	fn approve() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `326`
 		//  Estimated: `3522`
-		// Minimum execution time: 7_837_000 picoseconds.
-		Weight::from_parts(8_113_000, 3522)
+		// Minimum execution time: 11_520_000 picoseconds.
+		Weight::from_parts(12_030_000, 3522)
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: Nonfungible TokenData (r:1 w:0)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Allowance (r:1 w:1)
-	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::TokenData` (r:1 w:0)
+	/// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::Allowance` (r:1 w:1)
+	/// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
 	fn approve_from() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `313`
 		//  Estimated: `3522`
-		// Minimum execution time: 7_769_000 picoseconds.
-		Weight::from_parts(7_979_000, 3522)
+		// Minimum execution time: 11_570_000 picoseconds.
+		Weight::from_parts(12_139_000, 3522)
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: Nonfungible Allowance (r:1 w:0)
-	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::Allowance` (r:1 w:0)
+	/// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
 	fn check_allowed_raw() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `362`
 		//  Estimated: `3522`
-		// Minimum execution time: 4_194_000 picoseconds.
-		Weight::from_parts(4_353_000, 3522)
+		// Minimum execution time: 4_210_000 picoseconds.
+		Weight::from_parts(4_350_000, 3522)
 			.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)
-	/// Storage: Nonfungible TokenData (r:1 w:1)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenChildren (r:1 w:0)
-	/// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokensBurnt (r:1 w:1)
-	/// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Nonfungible AccountBalance (r:1 w:1)
-	/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Owned (r:0 w:1)
-	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenProperties (r:0 w:1)
-	/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::Allowance` (r:1 w:1)
+	/// 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::TokenChildren` (r:1 w:0)
+	/// Proof: `Nonfungible::TokenChildren` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::TokensBurnt` (r:1 w:1)
+	/// Proof: `Nonfungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::Owned` (r:0 w:1)
+	/// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::TokenProperties` (r:0 w:1)
+	/// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
 	fn burn_from() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `463`
 		//  Estimated: `3530`
-		// Minimum execution time: 21_978_000 picoseconds.
-		Weight::from_parts(22_519_000, 3530)
+		// Minimum execution time: 32_230_000 picoseconds.
+		Weight::from_parts(33_210_000, 3530)
 			.saturating_add(T::DbWeight::get().reads(5_u64))
 			.saturating_add(T::DbWeight::get().writes(6_u64))
 	}
-	/// Storage: Common CollectionPropertyPermissions (r:1 w:1)
-	/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
-	/// The range of component `b` is `[0, 64]`.
-	fn set_token_property_permissions(b: u32, ) -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `314`
-		//  Estimated: `20191`
-		// Minimum execution time: 1_457_000 picoseconds.
-		Weight::from_parts(1_563_000, 20191)
-			// Standard Error: 14_041
-			.saturating_add(Weight::from_parts(8_452_415, 0).saturating_mul(b.into()))
-			.saturating_add(T::DbWeight::get().reads(1_u64))
-			.saturating_add(T::DbWeight::get().writes(1_u64))
-	}
-	/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
-	/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenProperties (r:1 w:1)
-	/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenData (r:1 w:0)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// The range of component `b` is `[0, 64]`.
-	fn set_token_properties(b: u32, ) -> Weight {
+	/// Storage: `Nonfungible::TokenProperties` (r:1 w:0)
+	/// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
+	fn load_token_properties() -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `640 + b * (261 ±0)`
+		//  Measured:  `279`
 		//  Estimated: `36269`
-		// Minimum execution time: 963_000 picoseconds.
-		Weight::from_parts(1_126_511, 36269)
-			// Standard Error: 9_175
-			.saturating_add(Weight::from_parts(5_096_011, 0).saturating_mul(b.into()))
-			.saturating_add(T::DbWeight::get().reads(3_u64))
-			.saturating_add(T::DbWeight::get().writes(1_u64))
+		// Minimum execution time: 3_180_000 picoseconds.
+		Weight::from_parts(3_370_000, 36269)
+			.saturating_add(T::DbWeight::get().reads(1_u64))
 	}
-	/// Storage: Nonfungible TokenProperties (r:0 w:1)
-	/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::TokenProperties` (r:0 w:1)
+	/// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 64]`.
-	fn init_token_properties(b: u32, ) -> Weight {
+	fn write_token_properties(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `0`
 		//  Estimated: `0`
-		// Minimum execution time: 194_000 picoseconds.
-		Weight::from_parts(222_000, 0)
-			// Standard Error: 7_295
-			.saturating_add(Weight::from_parts(4_499_463, 0).saturating_mul(b.into()))
+		// Minimum execution time: 440_000 picoseconds.
+		Weight::from_parts(3_567_990, 0)
+			// Standard Error: 24_013
+			.saturating_add(Weight::from_parts(19_386_123, 0).saturating_mul(b.into()))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
-	/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenData (r:1 w:0)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenProperties (r:1 w:1)
-	/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Common::CollectionPropertyPermissions` (r:1 w:1)
+	/// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 64]`.
-	fn delete_token_properties(b: u32, ) -> Weight {
+	fn set_token_property_permissions(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `699 + b * (33291 ±0)`
-		//  Estimated: `36269`
-		// Minimum execution time: 992_000 picoseconds.
-		Weight::from_parts(1_043_000, 36269)
-			// Standard Error: 37_370
-			.saturating_add(Weight::from_parts(23_672_870, 0).saturating_mul(b.into()))
-			.saturating_add(T::DbWeight::get().reads(3_u64))
+		//  Measured:  `314`
+		//  Estimated: `20191`
+		// Minimum execution time: 1_460_000 picoseconds.
+		Weight::from_parts(1_530_000, 20191)
+			// Standard Error: 124_929
+			.saturating_add(Weight::from_parts(28_397_581, 0).saturating_mul(b.into()))
+			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: Nonfungible TokenData (r:1 w:0)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	fn token_owner() -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `326`
-		//  Estimated: `3522`
-		// Minimum execution time: 3_743_000 picoseconds.
-		Weight::from_parts(3_908_000, 3522)
-			.saturating_add(T::DbWeight::get().reads(1_u64))
-	}
-	/// Storage: Nonfungible CollectionAllowance (r:0 w:1)
-	/// Proof: Nonfungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::CollectionAllowance` (r:0 w:1)
+	/// Proof: `Nonfungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)
 	fn set_allowance_for_all() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `0`
 		//  Estimated: `0`
-		// Minimum execution time: 4_106_000 picoseconds.
-		Weight::from_parts(4_293_000, 0)
+		// Minimum execution time: 6_840_000 picoseconds.
+		Weight::from_parts(7_160_000, 0)
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: Nonfungible CollectionAllowance (r:1 w:0)
-	/// Proof: Nonfungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::CollectionAllowance` (r:1 w:0)
+	/// Proof: `Nonfungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)
 	fn allowance_for_all() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `142`
 		//  Estimated: `3576`
-		// Minimum execution time: 2_775_000 picoseconds.
-		Weight::from_parts(2_923_000, 3576)
+		// Minimum execution time: 3_630_000 picoseconds.
+		Weight::from_parts(3_780_000, 3576)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 	}
-	/// Storage: Nonfungible TokenProperties (r:1 w:1)
-	/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::TokenProperties` (r:1 w:1)
+	/// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
 	fn repair_item() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `279`
 		//  Estimated: `36269`
-		// Minimum execution time: 3_033_000 picoseconds.
-		Weight::from_parts(3_174_000, 36269)
+		// Minimum execution time: 3_280_000 picoseconds.
+		Weight::from_parts(3_480_000, 36269)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
@@ -379,321 +285,231 @@
 
 // For backwards compatibility and tests
 impl WeightInfo for () {
-	/// Storage: Nonfungible TokensMinted (r:1 w:1)
-	/// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Nonfungible AccountBalance (r:1 w:1)
-	/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenData (r:0 w:1)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Owned (r:0 w:1)
-	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::TokensMinted` (r:1 w:1)
+	/// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::TokenData` (r:0 w:1)
+	/// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::Owned` (r:0 w:1)
+	/// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn create_item() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `142`
 		//  Estimated: `3530`
-		// Minimum execution time: 9_726_000 picoseconds.
-		Weight::from_parts(10_059_000, 3530)
+		// Minimum execution time: 15_410_000 picoseconds.
+		Weight::from_parts(15_850_000, 3530)
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 			.saturating_add(RocksDbWeight::get().writes(4_u64))
 	}
-	/// Storage: Nonfungible TokensMinted (r:1 w:1)
-	/// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Nonfungible AccountBalance (r:1 w:1)
-	/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenData (r:0 w:200)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Owned (r:0 w:200)
-	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::TokensMinted` (r:1 w:1)
+	/// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::TokenData` (r:0 w:200)
+	/// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::Owned` (r:0 w:200)
+	/// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 200]`.
 	fn create_multiple_items(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `142`
 		//  Estimated: `3530`
-		// Minimum execution time: 3_270_000 picoseconds.
-		Weight::from_parts(3_693_659, 3530)
-			// Standard Error: 255
-			.saturating_add(Weight::from_parts(3_024_284, 0).saturating_mul(b.into()))
+		// Minimum execution time: 3_300_000 picoseconds.
+		Weight::from_parts(5_992_994, 3530)
+			// Standard Error: 4_478
+			.saturating_add(Weight::from_parts(8_002_092, 0).saturating_mul(b.into()))
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 			.saturating_add(RocksDbWeight::get().writes(2_u64))
 			.saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(b.into())))
 	}
-	/// Storage: Nonfungible TokensMinted (r:1 w:1)
-	/// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Nonfungible AccountBalance (r:200 w:200)
-	/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenData (r:0 w:200)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Owned (r:0 w:200)
-	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::TokensMinted` (r:1 w:1)
+	/// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::AccountBalance` (r:200 w:200)
+	/// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::TokenData` (r:0 w:200)
+	/// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::Owned` (r:0 w:200)
+	/// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 200]`.
 	fn create_multiple_items_ex(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `142`
 		//  Estimated: `3481 + b * (2540 ±0)`
-		// Minimum execution time: 3_188_000 picoseconds.
-		Weight::from_parts(3_307_000, 3481)
-			// Standard Error: 567
-			.saturating_add(Weight::from_parts(4_320_449, 0).saturating_mul(b.into()))
+		// Minimum execution time: 3_300_000 picoseconds.
+		Weight::from_parts(3_980_000, 3481)
+			// Standard Error: 1_382
+			.saturating_add(Weight::from_parts(11_259_286, 0).saturating_mul(b.into()))
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 			.saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))
 			.saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))
 	}
-	/// Storage: Nonfungible TokenData (r:1 w:1)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenChildren (r:1 w:0)
-	/// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokensBurnt (r:1 w:1)
-	/// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Nonfungible AccountBalance (r:1 w:1)
-	/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Allowance (r:1 w:0)
-	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Owned (r:0 w:1)
-	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenProperties (r:0 w:1)
-	/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, 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::TokenChildren` (r:1 w:0)
+	/// Proof: `Nonfungible::TokenChildren` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::TokensBurnt` (r:1 w:1)
+	/// Proof: `Nonfungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::Allowance` (r:1 w:0)
+	/// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::Owned` (r:0 w:1)
+	/// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::TokenProperties` (r:0 w:1)
+	/// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
 	fn burn_item() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `380`
 		//  Estimated: `3530`
-		// Minimum execution time: 18_062_000 picoseconds.
-		Weight::from_parts(18_433_000, 3530)
-			.saturating_add(RocksDbWeight::get().reads(5_u64))
-			.saturating_add(RocksDbWeight::get().writes(5_u64))
-	}
-	/// Storage: Nonfungible TokenChildren (r:1 w:0)
-	/// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, 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 TokensBurnt (r:1 w:1)
-	/// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Nonfungible AccountBalance (r:1 w:1)
-	/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Allowance (r:1 w:0)
-	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Owned (r:0 w:1)
-	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenProperties (r:0 w:1)
-	/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
-	fn burn_recursively_self_raw() -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `380`
-		//  Estimated: `3530`
-		// Minimum execution time: 22_942_000 picoseconds.
-		Weight::from_parts(23_527_000, 3530)
+		// Minimum execution time: 26_360_000 picoseconds.
+		Weight::from_parts(26_850_000, 3530)
 			.saturating_add(RocksDbWeight::get().reads(5_u64))
 			.saturating_add(RocksDbWeight::get().writes(5_u64))
 	}
-	/// Storage: Nonfungible TokenChildren (r:401 w:200)
-	/// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
-	/// Storage: Common CollectionById (r:1 w:0)
-	/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenData (r:201 w:201)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokensBurnt (r:1 w:1)
-	/// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, 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 Allowance (r:201 w:0)
-	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Owned (r:0 w:201)
-	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenProperties (r:0 w:201)
-	/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
-	/// The range of component `b` is `[0, 200]`.
-	fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `1500 + b * (58 ±0)`
-		//  Estimated: `5874 + b * (5032 ±0)`
-		// Minimum execution time: 22_709_000 picoseconds.
-		Weight::from_parts(23_287_000, 5874)
-			// Standard Error: 89_471
-			.saturating_add(Weight::from_parts(63_285_201, 0).saturating_mul(b.into()))
-			.saturating_add(RocksDbWeight::get().reads(7_u64))
-			.saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(b.into())))
-			.saturating_add(RocksDbWeight::get().writes(6_u64))
-			.saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(b.into())))
-			.saturating_add(Weight::from_parts(0, 5032).saturating_mul(b.into()))
-	}
-	/// 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 Allowance (r:1 w:0)
-	/// 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)
+	/// 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::Allowance` (r:1 w:0)
+	/// 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_raw() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `380`
 		//  Estimated: `6070`
-		// Minimum execution time: 13_652_000 picoseconds.
-		Weight::from_parts(13_981_000, 6070)
+		// Minimum execution time: 22_710_000 picoseconds.
+		Weight::from_parts(23_130_000, 6070)
 			.saturating_add(RocksDbWeight::get().reads(4_u64))
 			.saturating_add(RocksDbWeight::get().writes(5_u64))
 	}
-	/// Storage: Nonfungible TokenData (r:1 w:0)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Allowance (r:1 w:1)
-	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::TokenData` (r:1 w:0)
+	/// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::Allowance` (r:1 w:1)
+	/// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
 	fn approve() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `326`
 		//  Estimated: `3522`
-		// Minimum execution time: 7_837_000 picoseconds.
-		Weight::from_parts(8_113_000, 3522)
+		// Minimum execution time: 11_520_000 picoseconds.
+		Weight::from_parts(12_030_000, 3522)
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: Nonfungible TokenData (r:1 w:0)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Allowance (r:1 w:1)
-	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::TokenData` (r:1 w:0)
+	/// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::Allowance` (r:1 w:1)
+	/// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
 	fn approve_from() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `313`
 		//  Estimated: `3522`
-		// Minimum execution time: 7_769_000 picoseconds.
-		Weight::from_parts(7_979_000, 3522)
+		// Minimum execution time: 11_570_000 picoseconds.
+		Weight::from_parts(12_139_000, 3522)
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: Nonfungible Allowance (r:1 w:0)
-	/// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::Allowance` (r:1 w:0)
+	/// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
 	fn check_allowed_raw() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `362`
 		//  Estimated: `3522`
-		// Minimum execution time: 4_194_000 picoseconds.
-		Weight::from_parts(4_353_000, 3522)
+		// Minimum execution time: 4_210_000 picoseconds.
+		Weight::from_parts(4_350_000, 3522)
 			.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)
-	/// Storage: Nonfungible TokenData (r:1 w:1)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenChildren (r:1 w:0)
-	/// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokensBurnt (r:1 w:1)
-	/// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Nonfungible AccountBalance (r:1 w:1)
-	/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Nonfungible Owned (r:0 w:1)
-	/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenProperties (r:0 w:1)
-	/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::Allowance` (r:1 w:1)
+	/// 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::TokenChildren` (r:1 w:0)
+	/// Proof: `Nonfungible::TokenChildren` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::TokensBurnt` (r:1 w:1)
+	/// Proof: `Nonfungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::Owned` (r:0 w:1)
+	/// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
+	/// Storage: `Nonfungible::TokenProperties` (r:0 w:1)
+	/// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
 	fn burn_from() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `463`
 		//  Estimated: `3530`
-		// Minimum execution time: 21_978_000 picoseconds.
-		Weight::from_parts(22_519_000, 3530)
+		// Minimum execution time: 32_230_000 picoseconds.
+		Weight::from_parts(33_210_000, 3530)
 			.saturating_add(RocksDbWeight::get().reads(5_u64))
 			.saturating_add(RocksDbWeight::get().writes(6_u64))
-	}
-	/// Storage: Common CollectionPropertyPermissions (r:1 w:1)
-	/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
-	/// The range of component `b` is `[0, 64]`.
-	fn set_token_property_permissions(b: u32, ) -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `314`
-		//  Estimated: `20191`
-		// Minimum execution time: 1_457_000 picoseconds.
-		Weight::from_parts(1_563_000, 20191)
-			// Standard Error: 14_041
-			.saturating_add(Weight::from_parts(8_452_415, 0).saturating_mul(b.into()))
-			.saturating_add(RocksDbWeight::get().reads(1_u64))
-			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
-	/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenProperties (r:1 w:1)
-	/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenData (r:1 w:0)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// The range of component `b` is `[0, 64]`.
-	fn set_token_properties(b: u32, ) -> Weight {
+	/// Storage: `Nonfungible::TokenProperties` (r:1 w:0)
+	/// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
+	fn load_token_properties() -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `640 + b * (261 ±0)`
+		//  Measured:  `279`
 		//  Estimated: `36269`
-		// Minimum execution time: 963_000 picoseconds.
-		Weight::from_parts(1_126_511, 36269)
-			// Standard Error: 9_175
-			.saturating_add(Weight::from_parts(5_096_011, 0).saturating_mul(b.into()))
-			.saturating_add(RocksDbWeight::get().reads(3_u64))
-			.saturating_add(RocksDbWeight::get().writes(1_u64))
+		// Minimum execution time: 3_180_000 picoseconds.
+		Weight::from_parts(3_370_000, 36269)
+			.saturating_add(RocksDbWeight::get().reads(1_u64))
 	}
-	/// Storage: Nonfungible TokenProperties (r:0 w:1)
-	/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::TokenProperties` (r:0 w:1)
+	/// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 64]`.
-	fn init_token_properties(b: u32, ) -> Weight {
+	fn write_token_properties(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `0`
 		//  Estimated: `0`
-		// Minimum execution time: 194_000 picoseconds.
-		Weight::from_parts(222_000, 0)
-			// Standard Error: 7_295
-			.saturating_add(Weight::from_parts(4_499_463, 0).saturating_mul(b.into()))
+		// Minimum execution time: 440_000 picoseconds.
+		Weight::from_parts(3_567_990, 0)
+			// Standard Error: 24_013
+			.saturating_add(Weight::from_parts(19_386_123, 0).saturating_mul(b.into()))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
-	/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenData (r:1 w:0)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	/// Storage: Nonfungible TokenProperties (r:1 w:1)
-	/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Common::CollectionPropertyPermissions` (r:1 w:1)
+	/// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 64]`.
-	fn delete_token_properties(b: u32, ) -> Weight {
+	fn set_token_property_permissions(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `699 + b * (33291 ±0)`
-		//  Estimated: `36269`
-		// Minimum execution time: 992_000 picoseconds.
-		Weight::from_parts(1_043_000, 36269)
-			// Standard Error: 37_370
-			.saturating_add(Weight::from_parts(23_672_870, 0).saturating_mul(b.into()))
-			.saturating_add(RocksDbWeight::get().reads(3_u64))
+		//  Measured:  `314`
+		//  Estimated: `20191`
+		// Minimum execution time: 1_460_000 picoseconds.
+		Weight::from_parts(1_530_000, 20191)
+			// Standard Error: 124_929
+			.saturating_add(Weight::from_parts(28_397_581, 0).saturating_mul(b.into()))
+			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: Nonfungible TokenData (r:1 w:0)
-	/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
-	fn token_owner() -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `326`
-		//  Estimated: `3522`
-		// Minimum execution time: 3_743_000 picoseconds.
-		Weight::from_parts(3_908_000, 3522)
-			.saturating_add(RocksDbWeight::get().reads(1_u64))
-	}
-	/// Storage: Nonfungible CollectionAllowance (r:0 w:1)
-	/// Proof: Nonfungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::CollectionAllowance` (r:0 w:1)
+	/// Proof: `Nonfungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)
 	fn set_allowance_for_all() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `0`
 		//  Estimated: `0`
-		// Minimum execution time: 4_106_000 picoseconds.
-		Weight::from_parts(4_293_000, 0)
+		// Minimum execution time: 6_840_000 picoseconds.
+		Weight::from_parts(7_160_000, 0)
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: Nonfungible CollectionAllowance (r:1 w:0)
-	/// Proof: Nonfungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::CollectionAllowance` (r:1 w:0)
+	/// Proof: `Nonfungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)
 	fn allowance_for_all() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `142`
 		//  Estimated: `3576`
-		// Minimum execution time: 2_775_000 picoseconds.
-		Weight::from_parts(2_923_000, 3576)
+		// Minimum execution time: 3_630_000 picoseconds.
+		Weight::from_parts(3_780_000, 3576)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 	}
-	/// Storage: Nonfungible TokenProperties (r:1 w:1)
-	/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Nonfungible::TokenProperties` (r:1 w:1)
+	/// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
 	fn repair_item() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `279`
 		//  Estimated: `36269`
-		// Minimum execution time: 3_033_000 picoseconds.
-		Weight::from_parts(3_174_000, 36269)
+		// Minimum execution time: 3_280_000 picoseconds.
+		Weight::from_parts(3_480_000, 36269)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
modifiedpallets/refungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -19,10 +19,7 @@
 use frame_benchmarking::v2::*;
 use pallet_common::{
 	bench_init,
-	benchmarking::{
-		create_collection_raw, /*load_is_admin_and_property_permissions,*/ property_key,
-		property_value,
-	},
+	benchmarking::{create_collection_raw, property_key, property_value},
 };
 use sp_std::prelude::*;
 use up_data_structs::{
@@ -425,38 +422,29 @@
 	}
 
 	#[benchmark]
-	fn set_token_property_permissions(
-		b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
-	) -> Result<(), BenchmarkError> {
+	fn load_token_properties() -> Result<(), BenchmarkError> {
 		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub;
 		};
-		let perms = (0..b)
-			.map(|k| PropertyKeyPermission {
-				key: property_key(k as usize),
-				permission: PropertyPermission {
-					mutable: false,
-					collection_admin: false,
-					token_owner: false,
-				},
-			})
-			.collect::<Vec<_>>();
 
+		let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
+
 		#[block]
 		{
-			<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
+			pallet_common::BenchmarkPropertyWriter::<T>::load_token_properties(&collection, item);
 		}
 
 		Ok(())
 	}
 
 	#[benchmark]
-	fn set_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {
+	fn write_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {
 		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub;
 		};
+
 		let perms = (0..b)
 			.map(|k| PropertyKeyPermission {
 				key: property_key(k as usize),
@@ -476,73 +464,29 @@
 			.collect::<Vec<_>>();
 		let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
 
+		let lazy_collection_info =
+			pallet_common::BenchmarkPropertyWriter::<T>::load_collection_info(&collection, &owner);
+
 		#[block]
 		{
-			<Pallet<T>>::set_token_properties(
-				&collection,
-				&owner,
+			let mut property_writer =
+				pallet_common::BenchmarkPropertyWriter::new(&collection, lazy_collection_info);
+
+			property_writer.write_token_properties(
 				item,
 				props.into_iter(),
-				&Unlimited,
+				crate::erc::ERC721TokenEvent::TokenChanged {
+					token_id: item.into(),
+				}
+				.to_log(T::ContractAddress::get()),
 			)?;
 		}
 
 		Ok(())
 	}
 
-	// TODO:
 	#[benchmark]
-	fn init_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {
-		// bench_init! {
-		// 	owner: sub; collection: collection(owner);
-		// 	owner: cross_from_sub;
-		// };
-
-		// let perms = (0..b)
-		// 	.map(|k| PropertyKeyPermission {
-		// 		key: property_key(k as usize),
-		// 		permission: PropertyPermission {
-		// 			mutable: false,
-		// 			collection_admin: true,
-		// 			token_owner: true,
-		// 		},
-		// 	})
-		// 	.collect::<Vec<_>>();
-		// <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
-
-		#[block]
-		{}
-		// let props = (0..b).map(|k| Property {
-		// 	key: property_key(k as usize),
-		// 	value: property_value(),
-		// }).collect::<Vec<_>>();
-		// let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
-
-		// let (is_collection_admin, property_permissions) = load_is_admin_and_property_permissions(&collection, &owner)
-		// let mut property_writer = pallet_common::collection_info_loaded_property_writer(
-		// 	&collection,
-		// 	is_collection_admin,
-		// 	property_permissions,
-		// );
-
-		// #[block]
-		// {
-		// 	property_writer.write_token_properties(
-		// 		true,
-		// 		item,
-		// 		props.into_iter(),
-		// 		crate::erc::ERC721TokenEvent::TokenChanged {
-		// 			token_id: item.into(),
-		// 		}
-		// 		.to_log(T::ContractAddress::get()),
-		// 	)?;
-		// }
-
-		Ok(())
-	}
-
-	#[benchmark]
-	fn delete_token_properties(
+	fn set_token_property_permissions(
 		b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
 	) -> Result<(), BenchmarkError> {
 		bench_init! {
@@ -553,38 +497,16 @@
 			.map(|k| PropertyKeyPermission {
 				key: property_key(k as usize),
 				permission: PropertyPermission {
-					mutable: true,
-					collection_admin: true,
-					token_owner: true,
+					mutable: false,
+					collection_admin: false,
+					token_owner: false,
 				},
-			})
-			.collect::<Vec<_>>();
-		<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
-		let props = (0..b)
-			.map(|k| Property {
-				key: property_key(k as usize),
-				value: property_value(),
 			})
 			.collect::<Vec<_>>();
-		let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
-		<Pallet<T>>::set_token_properties(
-			&collection,
-			&owner,
-			item,
-			props.into_iter(),
-			&Unlimited,
-		)?;
-		let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();
 
 		#[block]
 		{
-			<Pallet<T>>::delete_token_properties(
-				&collection,
-				&owner,
-				item,
-				to_delete.into_iter(),
-				&Unlimited,
-			)?;
+			<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
 		}
 
 		Ok(())
@@ -601,22 +523,6 @@
 		#[block]
 		{
 			<Pallet<T>>::repartition(&collection, &owner, item, 200)?;
-		}
-
-		Ok(())
-	}
-
-	#[benchmark]
-	fn token_owner() -> Result<(), BenchmarkError> {
-		bench_init! {
-			owner: sub; collection: collection(owner);
-			sender: cross_from_sub(owner); owner: cross_sub;
-		};
-		let item = create_max_item(&collection, &sender, [(owner, 100)])?;
-
-		#[block]
-		{
-			<Pallet<T>>::token_owner(collection.id, item).unwrap();
 		}
 
 		Ok(())
modifiedpallets/refungible/src/common.rsdiffbeforeafterboth
--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -16,14 +16,12 @@
 
 use core::marker::PhantomData;
 
-use frame_support::{
-	dispatch::DispatchResultWithPostInfo, ensure, fail, traits::Get, weights::Weight,
-};
+use frame_support::{dispatch::DispatchResultWithPostInfo, fail, weights::Weight};
 use pallet_common::{
-	init_token_properties_delta, weights::WeightInfo as _, with_weight, CommonCollectionOperations,
-	CommonWeightInfo, RefungibleExtensions,
+	weights::WeightInfo as _, with_weight, write_token_properties_total_weight,
+	CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions,
 };
-use pallet_structure::{Error as StructureError, Pallet as PalletStructure};
+use pallet_structure::Pallet as PalletStructure;
 use sp_runtime::DispatchError;
 use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};
 use up_data_structs::{
@@ -49,35 +47,27 @@
 pub struct CommonWeights<T: Config>(PhantomData<T>);
 impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {
 	fn create_multiple_items(data: &[up_data_structs::CreateItemData]) -> Weight {
-		<SelfWeightOf<T>>::create_multiple_items(data.len() as u32).saturating_add(
-			init_token_properties_delta::<T, _>(
-				data.iter().map(|data| match data {
-					up_data_structs::CreateItemData::ReFungible(rft_data) => {
-						rft_data.properties.len() as u32
-					}
-					_ => 0,
-				}),
-				<SelfWeightOf<T>>::init_token_properties,
-			),
+		mint_with_props_weight::<T>(
+			<SelfWeightOf<T>>::create_multiple_items(data.len() as u32),
+			data.iter().map(|data| match data {
+				up_data_structs::CreateItemData::ReFungible(rft_data) => {
+					rft_data.properties.len() as u32
+				}
+				_ => 0,
+			}),
 		)
 	}
 
 	fn create_multiple_items_ex(call: &CreateItemExData<T::CrossAccountId>) -> Weight {
 		match call {
-			CreateItemExData::RefungibleMultipleOwners(i) => {
-				<SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(i.users.len() as u32)
-					.saturating_add(init_token_properties_delta::<T, _>(
-						[i.properties.len() as u32].into_iter(),
-						<SelfWeightOf<T>>::init_token_properties,
-					))
-			}
-			CreateItemExData::RefungibleMultipleItems(i) => {
-				<SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(i.len() as u32)
-					.saturating_add(init_token_properties_delta::<T, _>(
-						i.iter().map(|d| d.properties.len() as u32),
-						<SelfWeightOf<T>>::init_token_properties,
-					))
-			}
+			CreateItemExData::RefungibleMultipleOwners(i) => mint_with_props_weight::<T>(
+				<SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(i.users.len() as u32),
+				[i.properties.len() as u32].into_iter(),
+			),
+			CreateItemExData::RefungibleMultipleItems(i) => mint_with_props_weight::<T>(
+				<SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(i.len() as u32),
+				i.iter().map(|d| d.properties.len() as u32),
+			),
 			_ => Weight::zero(),
 		}
 	}
@@ -88,18 +78,13 @@
 
 	fn set_collection_properties(amount: u32) -> Weight {
 		<pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)
-	}
-
-	fn delete_collection_properties(amount: u32) -> Weight {
-		<pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)
 	}
 
 	fn set_token_properties(amount: u32) -> Weight {
-		<SelfWeightOf<T>>::set_token_properties(amount)
-	}
-
-	fn delete_token_properties(amount: u32) -> Weight {
-		<SelfWeightOf<T>>::delete_token_properties(amount)
+		write_token_properties_total_weight::<T, _>([amount].into_iter(), |amount| {
+			<SelfWeightOf<T>>::load_token_properties()
+				.saturating_add(<SelfWeightOf<T>>::write_token_properties(amount))
+		})
 	}
 
 	fn set_token_property_permissions(amount: u32) -> Weight {
@@ -136,19 +121,6 @@
 		<SelfWeightOf<T>>::burn_from()
 	}
 
-	fn burn_recursively_self_raw() -> Weight {
-		// Read to get total balance
-		Self::burn_item() + T::DbWeight::get().reads(1)
-	}
-	fn burn_recursively_breadth_raw(_amount: u32) -> Weight {
-		// Refungible token can't have children
-		Weight::zero()
-	}
-
-	fn token_owner() -> Weight {
-		<SelfWeightOf<T>>::token_owner()
-	}
-
 	fn set_allowance_for_all() -> Weight {
 		<SelfWeightOf<T>>::set_allowance_for_all()
 	}
@@ -158,6 +130,20 @@
 	}
 }
 
+/// Weight of minting tokens with properties
+/// * `create_no_data_weight` -- the weight of minting without properties
+/// * `token_properties_nums` -- number of properties of each token
+#[inline]
+pub(crate) fn mint_with_props_weight<T: Config>(
+	create_no_data_weight: Weight,
+	token_properties_nums: impl Iterator<Item = u32> + Clone,
+) -> Weight {
+	create_no_data_weight.saturating_add(write_token_properties_total_weight::<T, _>(
+		token_properties_nums,
+		<SelfWeightOf<T>>::write_token_properties,
+	))
+}
+
 fn map_create_data<T: Config>(
 	data: up_data_structs::CreateItemData,
 	to: &T::CrossAccountId,
@@ -262,25 +248,6 @@
 		with_weight(
 			<Pallet<T>>::burn(self, &sender, token, amount),
 			<CommonWeights<T>>::burn_item(),
-		)
-	}
-
-	fn burn_item_recursively(
-		&self,
-		sender: T::CrossAccountId,
-		token: TokenId,
-		self_budget: &dyn Budget,
-		_breadth_budget: &dyn Budget,
-	) -> DispatchResultWithPostInfo {
-		ensure!(self_budget.consume(), <StructureError<T>>::DepthLimit,);
-		with_weight(
-			<Pallet<T>>::burn(
-				self,
-				&sender,
-				token,
-				<Balance<T>>::get((self.id, token, &sender)),
-			),
-			<CommonWeights<T>>::burn_recursively_self_raw(),
 		)
 	}
 
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -32,26 +32,28 @@
 use pallet_common::{
 	erc::{static_property::key, CollectionCall, CommonEvmHandler},
 	eth::{self, TokenUri},
-	CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,
+	CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations, CommonWeightInfo,
 	Error as CommonError,
 };
 use pallet_evm::{account::CrossAccountId, PrecompileHandle};
 use pallet_evm_coder_substrate::{
 	call, dispatch_to_evm,
 	execution::{Error, PreDispatch, Result},
-	frontier_contract,
+	frontier_contract, SubstrateRecorder,
 };
 use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};
 use sp_core::{Get, H160, U256};
 use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};
 use up_data_structs::{
-	mapping::TokenAddressMapping, CollectionId, CollectionPropertiesVec, Property, PropertyKey,
-	PropertyKeyPermission, PropertyPermission, TokenId, TokenOwnerError,
+	budget::Budget, mapping::TokenAddressMapping, CollectionId, CollectionPropertiesVec, Property,
+	PropertyKey, PropertyKeyPermission, PropertyPermission, TokenId, TokenOwnerError,
 };
 
 use crate::{
-	weights::WeightInfo, AccountBalance, Balance, Config, CreateItemData, Pallet, RefungibleHandle,
-	SelfWeightOf, TokenProperties, TokensMinted, TotalSupply,
+	common::{mint_with_props_weight, CommonWeights},
+	weights::WeightInfo,
+	AccountBalance, Balance, Config, CreateItemData, Pallet, RefungibleHandle, SelfWeightOf,
+	TokenProperties, TokensMinted, TotalSupply,
 };
 
 frontier_contract! {
@@ -90,6 +92,10 @@
 	pub properties: Vec<eth::Property>,
 }
 
+pub fn nesting_budget<T: Config>(recorder: &SubstrateRecorder<T>) -> impl Budget + '_ {
+	recorder.weight_calls_budget(<StructureWeight<T>>::find_parent())
+}
+
 /// @title A contract that allows to set and delete token properties and change token property permissions.
 #[solidity_interface(name = TokenProperties, events(ERC721TokenEvent), enum(derive(PreDispatch)), enum_attr(weight))]
 impl<T: Config> RefungibleHandle<T> {
@@ -158,7 +164,7 @@
 	/// @param key Property key.
 	/// @param value Property value.
 	#[solidity(hide)]
-	#[weight(<SelfWeightOf<T>>::set_token_properties(1))]
+	#[weight(<CommonWeights<T>>::set_token_properties(1))]
 	fn set_property(
 		&mut self,
 		caller: Caller,
@@ -172,17 +178,13 @@
 			.try_into()
 			.map_err(|_| "key too long")?;
 		let value = value.0.try_into().map_err(|_| "value too long")?;
-
-		let nesting_budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		<Pallet<T>>::set_token_property(
 			self,
 			&caller,
 			TokenId(token_id),
 			Property { key, value },
-			&nesting_budget,
+			&nesting_budget(&self.recorder),
 		)
 		.map_err(dispatch_to_evm::<T>)
 	}
@@ -191,7 +193,7 @@
 	/// @dev Throws error if `msg.sender` has no permission to edit the property.
 	/// @param tokenId ID of the token.
 	/// @param properties settable properties
-	#[weight(<SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]
+	#[weight(<CommonWeights<T>>::set_token_properties(properties.len() as u32))]
 	fn set_properties(
 		&mut self,
 		caller: Caller,
@@ -201,10 +203,6 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
 
-		let nesting_budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
-
 		let properties = properties
 			.into_iter()
 			.map(eth::Property::try_into)
@@ -215,7 +213,7 @@
 			&caller,
 			TokenId(token_id),
 			properties.into_iter(),
-			&nesting_budget,
+			&nesting_budget(&self.recorder),
 		)
 		.map_err(dispatch_to_evm::<T>)
 	}
@@ -225,7 +223,7 @@
 	/// @param tokenId ID of the token.
 	/// @param key Property key.
 	#[solidity(hide)]
-	#[weight(<SelfWeightOf<T>>::delete_token_properties(1))]
+	#[weight(<CommonWeights<T>>::delete_token_properties(1))]
 	fn delete_property(&mut self, token_id: U256, caller: Caller, key: String) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
@@ -233,19 +231,21 @@
 			.try_into()
 			.map_err(|_| "key too long")?;
 
-		let nesting_budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
-
-		<Pallet<T>>::delete_token_property(self, &caller, TokenId(token_id), key, &nesting_budget)
-			.map_err(dispatch_to_evm::<T>)
+		<Pallet<T>>::delete_token_property(
+			self,
+			&caller,
+			TokenId(token_id),
+			key,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)
 	}
 
 	/// @notice Delete token properties value.
 	/// @dev Throws error if `msg.sender` has no permission to edit the property.
 	/// @param tokenId ID of the token.
 	/// @param keys Properties key.
-	#[weight(<SelfWeightOf<T>>::delete_token_properties(keys.len() as u32))]
+	#[weight(<CommonWeights<T>>::delete_token_properties(keys.len() as u32))]
 	fn delete_properties(
 		&mut self,
 		token_id: U256,
@@ -259,16 +259,12 @@
 			.map(|k| Ok(<Vec<u8>>::from(k).try_into().map_err(|_| "key too long")?))
 			.collect::<Result<Vec<_>>>()?;
 
-		let nesting_budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
-
 		<Pallet<T>>::delete_token_properties(
 			self,
 			&caller,
 			TokenId(token_id),
 			keys.into_iter(),
-			&nesting_budget,
+			&nesting_budget(&self.recorder),
 		)
 		.map_err(dispatch_to_evm::<T>)
 	}
@@ -497,15 +493,20 @@
 		let from = T::CrossAccountId::from_eth(from);
 		let to = T::CrossAccountId::from_eth(to);
 		let token = token_id.try_into()?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		let balance = balance(self, token, &from)?;
 		ensure_single_owner(self, token, balance)?;
 
-		<Pallet<T>>::transfer_from(self, &caller, &from, &to, token, balance, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::transfer_from(
+			self,
+			&caller,
+			&from,
+			&to,
+			token,
+			balance,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 
 		Ok(())
 	}
@@ -629,9 +630,6 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = T::CrossAccountId::from_eth(to);
 		let token_id: u32 = token_id.try_into()?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		if <TokensMinted<T>>::get(self.id)
 			.checked_add(1)
@@ -653,7 +651,7 @@
 				users,
 				properties: CollectionPropertiesVec::default(),
 			},
-			&budget,
+			&nesting_budget(&self.recorder),
 		)
 		.map_err(dispatch_to_evm::<T>)?;
 
@@ -665,7 +663,7 @@
 	/// @param tokenUri Token URI that would be stored in the NFT properties
 	/// @return uint256 The id of the newly minted token
 	#[solidity(rename_selector = "mintWithTokenURI")]
-	#[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(1))]
+	#[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [1].into_iter()))]
 	fn mint_with_token_uri(
 		&mut self,
 		caller: Caller,
@@ -687,7 +685,7 @@
 	/// @param tokenId ID of the minted RFT
 	/// @param tokenUri Token URI that would be stored in the RFT properties
 	#[solidity(hide, rename_selector = "mintWithTokenURI")]
-	#[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(1))]
+	#[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [1].into_iter()))]
 	fn mint_with_token_uri_check_id(
 		&mut self,
 		caller: Caller,
@@ -704,9 +702,6 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = T::CrossAccountId::from_eth(to);
 		let token_id: u32 = token_id.try_into().map_err(|_| "amount overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		if <TokensMinted<T>>::get(self.id)
 			.checked_add(1)
@@ -736,7 +731,7 @@
 			self,
 			&caller,
 			CreateItemData::<T> { users, properties },
-			&budget,
+			&nesting_budget(&self.recorder),
 		)
 		.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
@@ -865,15 +860,19 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = T::CrossAccountId::from_eth(to);
 		let token = token_id.try_into()?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		let balance = balance(self, token, &caller)?;
 		ensure_single_owner(self, token, balance)?;
 
-		<Pallet<T>>::transfer(self, &caller, &to, token, balance, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::transfer(
+			self,
+			&caller,
+			&to,
+			token,
+			balance,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 		Ok(())
 	}
 
@@ -893,15 +892,19 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = to.into_sub_cross_account::<T>()?;
 		let token = token_id.try_into()?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		let balance = balance(self, token, &caller)?;
 		ensure_single_owner(self, token, balance)?;
 
-		<Pallet<T>>::transfer(self, &caller, &to, token, balance, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::transfer(
+			self,
+			&caller,
+			&to,
+			token,
+			balance,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 		Ok(())
 	}
 
@@ -923,15 +926,20 @@
 		let from = from.into_sub_cross_account::<T>()?;
 		let to = to.into_sub_cross_account::<T>()?;
 		let token_id = token_id.try_into()?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		let balance = balance(self, token_id, &from)?;
 		ensure_single_owner(self, token_id, balance)?;
 
-		Pallet::<T>::transfer_from(self, &caller, &from, &to, token_id, balance, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+		Pallet::<T>::transfer_from(
+			self,
+			&caller,
+			&from,
+			&to,
+			token_id,
+			balance,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 		Ok(())
 	}
 
@@ -948,15 +956,19 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let from = T::CrossAccountId::from_eth(from);
 		let token = token_id.try_into()?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		let balance = balance(self, token, &from)?;
 		ensure_single_owner(self, token, balance)?;
 
-		<Pallet<T>>::burn_from(self, &caller, &from, token, balance, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::burn_from(
+			self,
+			&caller,
+			&from,
+			token,
+			balance,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 		Ok(())
 	}
 
@@ -977,15 +989,19 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let from = from.into_sub_cross_account::<T>()?;
 		let token = token_id.try_into()?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		let balance = balance(self, token, &from)?;
 		ensure_single_owner(self, token, balance)?;
 
-		<Pallet<T>>::burn_from(self, &caller, &from, token, balance, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::burn_from(
+			self,
+			&caller,
+			&from,
+			token,
+			balance,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 		Ok(())
 	}
 
@@ -1010,9 +1026,6 @@
 		let mut expected_index = <TokensMinted<T>>::get(self.id)
 			.checked_add(1)
 			.ok_or("item id overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		let total_tokens = token_ids.len();
 		for id in token_ids.into_iter() {
@@ -1035,31 +1048,32 @@
 			.map(|_| create_item_data.clone())
 			.collect();
 
-		<Pallet<T>>::create_multiple_items(self, &caller, data, &budget)
+		<Pallet<T>>::create_multiple_items(self, &caller, data, &nesting_budget(&self.recorder))
 			.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
 
 	/// @notice Function to mint a token.
-	/// @param tokenProperties Properties of minted token
-	#[weight(if token_properties.len() == 1 {
-		<SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(token_properties.iter().next().unwrap().owners.len() as u32)
+	/// @param tokensData Data of minted token(s)
+	#[weight(if tokens_data.len() == 1 {
+		let token_data = tokens_data.first().unwrap();
+
+		mint_with_props_weight::<T>(
+			<SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(token_data.owners.len() as u32),
+			[token_data.properties.len() as u32].into_iter(),
+		)
 	} else {
-		<SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(token_properties.len() as u32)
-	} + <SelfWeightOf<T>>::set_token_properties(token_properties.len() as u32))]
-	fn mint_bulk_cross(
-		&mut self,
-		caller: Caller,
-		token_properties: Vec<MintTokenData>,
-	) -> Result<bool> {
+		mint_with_props_weight::<T>(
+			<SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(tokens_data.len() as u32),
+			tokens_data.iter().map(|d| d.properties.len() as u32),
+		)
+	})]
+	fn mint_bulk_cross(&mut self, caller: Caller, tokens_data: Vec<MintTokenData>) -> Result<bool> {
 		let caller = T::CrossAccountId::from_eth(caller);
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
-		let has_multiple_tokens = token_properties.len() > 1;
+		let has_multiple_tokens = tokens_data.len() > 1;
 
-		let mut create_rft_data = Vec::with_capacity(token_properties.len());
-		for MintTokenData { owners, properties } in token_properties {
+		let mut create_rft_data = Vec::with_capacity(tokens_data.len());
+		for MintTokenData { owners, properties } in tokens_data {
 			let has_multiple_owners = owners.len() > 1;
 			if has_multiple_tokens & has_multiple_owners {
 				return Err(
@@ -1084,8 +1098,13 @@
 			});
 		}
 
-		<Pallet<T>>::create_multiple_items(self, &caller, create_rft_data, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::create_multiple_items(
+			self,
+			&caller,
+			create_rft_data,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
 
@@ -1095,7 +1114,12 @@
 	/// @param to The new owner
 	/// @param tokens array of pairs of token ID and token URI for minted tokens
 	#[solidity(hide, rename_selector = "mintBulkWithTokenURI")]
-	#[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32) + <SelfWeightOf<T>>::set_token_properties(tokens.len() as u32))]
+	#[weight(
+		mint_with_props_weight::<T>(
+			<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32),
+			tokens.iter().map(|_| 1),
+		)
+	)]
 	fn mint_bulk_with_token_uri(
 		&mut self,
 		caller: Caller,
@@ -1108,9 +1132,6 @@
 		let mut expected_index = <TokensMinted<T>>::get(self.id)
 			.checked_add(1)
 			.ok_or("item id overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
 		let mut data = Vec::with_capacity(tokens.len());
 		let users: BoundedBTreeMap<_, _, _> = [(to, 1)]
@@ -1143,7 +1164,7 @@
 			data.push(create_item_data);
 		}
 
-		<Pallet<T>>::create_multiple_items(self, &caller, data, &budget)
+		<Pallet<T>>::create_multiple_items(self, &caller, data, &nesting_budget(&self.recorder))
 			.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
@@ -1152,7 +1173,7 @@
 	/// @param to The new owner crossAccountId
 	/// @param properties Properties of minted token
 	/// @return uint256 The id of the newly minted token
-	#[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]
+	#[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [properties.len() as u32].into_iter()))]
 	fn mint_cross(
 		&mut self,
 		caller: Caller,
@@ -1174,10 +1195,6 @@
 
 		let caller = T::CrossAccountId::from_eth(caller);
 
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
-
 		let users = [(to, 1)]
 			.into_iter()
 			.collect::<BTreeMap<_, _>>()
@@ -1187,7 +1204,7 @@
 			self,
 			&caller,
 			CreateItemData::<T> { users, properties },
-			&budget,
+			&nesting_budget(&self.recorder),
 		)
 		.map_err(dispatch_to_evm::<T>)?;
 
modifiedpallets/refungible/src/erc_token.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc_token.rs
+++ b/pallets/refungible/src/erc_token.rs
@@ -37,14 +37,13 @@
 	execution::{PreDispatch, Result},
 	frontier_contract, WithRecorder,
 };
-use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};
 use sp_core::U256;
 use sp_std::vec::Vec;
 use up_data_structs::TokenId;
 
 use crate::{
-	common::CommonWeights, weights::WeightInfo, Allowance, Balance, Config, Pallet,
-	RefungibleHandle, SelfWeightOf, TotalSupply,
+	common::CommonWeights, erc::nesting_budget, weights::WeightInfo, Allowance, Balance, Config,
+	Pallet, RefungibleHandle, SelfWeightOf, TotalSupply,
 };
 
 /// Refungible token handle contains information about token's collection and id
@@ -140,12 +139,16 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = T::CrossAccountId::from_eth(to);
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::transfer(self, &caller, &to, self.1, amount, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::transfer(
+			self,
+			&caller,
+			&to,
+			self.1,
+			amount,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
 
@@ -165,12 +168,17 @@
 		let from = T::CrossAccountId::from_eth(from);
 		let to = T::CrossAccountId::from_eth(to);
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::transfer_from(self, &caller, &from, &to, self.1, amount, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::transfer_from(
+			self,
+			&caller,
+			&from,
+			&to,
+			self.1,
+			amount,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
 
@@ -231,12 +239,16 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let from = T::CrossAccountId::from_eth(from);
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::burn_from(self, &caller, &from, self.1, amount, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::burn_from(
+			self,
+			&caller,
+			&from,
+			self.1,
+			amount,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
 
@@ -254,12 +266,16 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let from = from.into_sub_cross_account::<T>()?;
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::burn_from(self, &caller, &from, self.1, amount, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::burn_from(
+			self,
+			&caller,
+			&from,
+			self.1,
+			amount,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
 
@@ -315,12 +331,16 @@
 		let caller = T::CrossAccountId::from_eth(caller);
 		let to = to.into_sub_cross_account::<T>()?;
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::transfer(self, &caller, &to, self.1, amount, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::transfer(
+			self,
+			&caller,
+			&to,
+			self.1,
+			amount,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
 
@@ -340,12 +360,17 @@
 		let from = from.into_sub_cross_account::<T>()?;
 		let to = to.into_sub_cross_account::<T>()?;
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
-		let budget = self
-			.recorder
-			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
-		<Pallet<T>>::transfer_from(self, &caller, &from, &to, self.1, amount, &budget)
-			.map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::transfer_from(
+			self,
+			&caller,
+			&from,
+			&to,
+			self.1,
+			amount,
+			&nesting_budget(&self.recorder),
+		)
+		.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
 }
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
before · pallets/refungible/src/lib.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/>.1617//! # Refungible Pallet18//!19//! The Refungible pallet provides functionality for handling refungible collections and tokens.20//!21//! - [`Config`]22//! - [`RefungibleHandle`]23//! - [`Pallet`]24//! - [`CommonWeights`](common::CommonWeights)25//!26//! ## Overview27//!28//! The Refungible pallet provides functions for:29//!30//! - RFT collection creation and removal31//! - Minting and burning of RFT tokens32//! - Partition and repartition of RFT tokens33//! - Retrieving number of pieces of RFT token34//! - Retrieving account balances35//! - Transfering RFT token pieces36//! - Burning RFT token pieces37//! - Setting and checking allowance for RFT tokens38//!39//! ### Terminology40//!41//! - **RFT token:** Non fungible token that was partitioned to pieces. If an account owns all42//!   of the RFT token pieces than it owns the RFT token and can repartition it.43//!44//! - **RFT Collection:** A collection of RFT tokens. All RFT tokens are part of a collection.45//!   Each collection has its own settings and set of permissions.46//!47//! - **RFT token piece:** A fungible part of an RFT token.48//!49//! - **Balance:** RFT token pieces owned by an account50//!51//! - **Allowance:** Maximum number of RFT token pieces that one account is allowed to52//!   transfer from the balance of another account53//!54//! - **Burning:** The process of “deleting” a token from a collection or removing token pieces from55//!   an account balance.56//!57//! ### Implementations58//!59//! The Refungible pallet provides implementations for the following traits. If these traits provide60//! the functionality that you need, then you can avoid coupling with the Refungible pallet.61//!62//! - [`CommonWeightInfo`](pallet_common::CommonWeightInfo): Functions for retrieval of transaction weight63//! - [`CommonCollectionOperations`](pallet_common::CommonCollectionOperations): Functions for dealing64//!   with collections65//! - [`RefungibleExtensions`](pallet_common::RefungibleExtensions): Functions specific for refungible66//!   collection67//!68//! ## Interface69//!70//! ### Dispatchable Functions71//!72//! - `init_collection` - Create RFT collection. RFT collection can be configured to allow or deny access for73//!   some accounts.74//! - `destroy_collection` - Destroy exising RFT collection. There should be no tokens in the collection.75//! - `burn` - Burn some amount of RFT token pieces owned by account. Burns the RFT token if no pieces left.76//! - `transfer` - Transfer some amount of RFT token pieces. Transfers should be enabled for RFT collection.77//!   Nests the RFT token if RFT token pieces are sent to another token.78//! - `create_item` - Mint RFT token in collection. Sender should have permission to mint tokens.79//! - `set_allowance` - Set allowance for another account to transfer balance from sender's account.80//! - `repartition` - Repartition token to selected number of pieces. Sender should own all existing pieces.81//!82//! ## Assumptions83//!84//! * Total number of pieces for one token shouldn't exceed `up_data_structs::MAX_REFUNGIBLE_PIECES`.85//! * Total number of tokens of all types shouldn't be greater than `up_data_structs::MAX_TOKEN_PREFIX_LENGTH`.86//! * Sender should be in collection's allow list to perform operations on tokens.8788#![cfg_attr(not(feature = "std"), no_std)]8990use core::{cmp::Ordering, ops::Deref};9192use evm_coder::ToLog;93use frame_support::{ensure, storage::with_transaction, transactional};94pub use pallet::*;95use pallet_common::{96	eth::collection_id_to_address, Error as CommonError, Event as CommonEvent,97	Pallet as PalletCommon,98};99use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};100use pallet_evm_coder_substrate::WithRecorder;101use pallet_structure::Pallet as PalletStructure;102use sp_core::{Get, H160};103use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, TransactionOutcome};104use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};105use up_data_structs::{106	budget::Budget, mapping::TokenAddressMapping, AccessMode, CollectionId, CreateCollectionData,107	CreateRefungibleExMultipleOwners, PropertiesPermissionMap, Property, PropertyKey,108	PropertyKeyPermission, PropertyScope, PropertyValue, TokenId, TokenOwnerError,109	TokenProperties as TokenPropertiesT, MAX_REFUNGIBLE_PIECES,110};111112use crate::{erc::ERC721Events, erc_token::ERC20Events};113#[cfg(feature = "runtime-benchmarks")]114pub mod benchmarking;115pub mod common;116pub mod erc;117pub mod erc_token;118pub mod weights;119120pub type CreateItemData<T> =121	CreateRefungibleExMultipleOwners<<T as pallet_evm::Config>::CrossAccountId>;122pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;123124#[frame_support::pallet]125pub mod pallet {126	use frame_support::{127		pallet_prelude::*, storage::Key, traits::StorageVersion, Blake2_128, Blake2_128Concat,128		Twox64Concat,129	};130	use up_data_structs::{CollectionId, TokenId};131132	use super::{weights::WeightInfo, *};133134	#[pallet::error]135	pub enum Error<T> {136		/// Not Refungible item data used to mint in Refungible collection.137		NotRefungibleDataUsedToMintFungibleCollectionToken,138		/// Maximum refungibility exceeded.139		WrongRefungiblePieces,140		/// Refungible token can't be repartitioned by user who isn't owns all pieces.141		RepartitionWhileNotOwningAllPieces,142		/// Refungible token can't nest other tokens.143		RefungibleDisallowsNesting,144		/// Setting item properties is not allowed.145		SettingPropertiesNotAllowed,146	}147148	#[pallet::config]149	pub trait Config:150		frame_system::Config + pallet_common::Config + pallet_structure::Config151	{152		type WeightInfo: WeightInfo;153	}154155	const STORAGE_VERSION: StorageVersion = StorageVersion::new(2);156157	#[pallet::pallet]158	#[pallet::storage_version(STORAGE_VERSION)]159	pub struct Pallet<T>(_);160161	/// Total amount of minted tokens in a collection.162	#[pallet::storage]163	pub type TokensMinted<T: Config> =164		StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;165166	/// Amount of tokens burnt in a collection.167	#[pallet::storage]168	pub type TokensBurnt<T: Config> =169		StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;170171	/// Amount of pieces a refungible token is split into.172	#[pallet::storage]173	#[pallet::getter(fn token_properties)]174	pub type TokenProperties<T: Config> = StorageNMap<175		Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),176		Value = TokenPropertiesT,177		QueryKind = OptionQuery,178	>;179180	/// Total amount of pieces for token181	#[pallet::storage]182	pub type TotalSupply<T: Config> = StorageNMap<183		Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),184		Value = u128,185		QueryKind = ValueQuery,186	>;187188	/// Used to enumerate tokens owned by account.189	#[pallet::storage]190	pub type Owned<T: Config> = StorageNMap<191		Key = (192			Key<Twox64Concat, CollectionId>,193			Key<Blake2_128Concat, T::CrossAccountId>,194			Key<Twox64Concat, TokenId>,195		),196		Value = bool,197		QueryKind = ValueQuery,198	>;199200	/// Amount of tokens (not pieces) partially owned by an account within a collection.201	#[pallet::storage]202	pub type AccountBalance<T: Config> = StorageNMap<203		Key = (204			Key<Twox64Concat, CollectionId>,205			// Owner206			Key<Blake2_128Concat, T::CrossAccountId>,207		),208		Value = u32,209		QueryKind = ValueQuery,210	>;211212	/// Amount of token pieces owned by account.213	#[pallet::storage]214	pub type Balance<T: Config> = StorageNMap<215		Key = (216			Key<Twox64Concat, CollectionId>,217			Key<Twox64Concat, TokenId>,218			// Owner219			Key<Blake2_128Concat, T::CrossAccountId>,220		),221		Value = u128,222		QueryKind = ValueQuery,223	>;224225	/// Allowance set by a token owner for another user to perform one of certain transactions on a number of pieces of a token.226	#[pallet::storage]227	pub type Allowance<T: Config> = StorageNMap<228		Key = (229			Key<Twox64Concat, CollectionId>,230			Key<Twox64Concat, TokenId>,231			// Owner232			Key<Blake2_128, T::CrossAccountId>,233			// Spender234			Key<Blake2_128Concat, T::CrossAccountId>,235		),236		Value = u128,237		QueryKind = ValueQuery,238	>;239240	/// Spender set by a wallet owner that could perform certain transactions on all tokens in the wallet.241	#[pallet::storage]242	pub type CollectionAllowance<T: Config> = StorageNMap<243		Key = (244			Key<Twox64Concat, CollectionId>,245			Key<Blake2_128Concat, T::CrossAccountId>, // Owner246			Key<Blake2_128Concat, T::CrossAccountId>, // Spender247		),248		Value = bool,249		QueryKind = ValueQuery,250	>;251}252253pub struct RefungibleHandle<T: Config>(pallet_common::CollectionHandle<T>);254impl<T: Config> RefungibleHandle<T> {255	pub fn cast(inner: pallet_common::CollectionHandle<T>) -> Self {256		Self(inner)257	}258	pub fn into_inner(self) -> pallet_common::CollectionHandle<T> {259		self.0260	}261	pub fn common_mut(&mut self) -> &mut pallet_common::CollectionHandle<T> {262		&mut self.0263	}264}265266impl<T: Config> Deref for RefungibleHandle<T> {267	type Target = pallet_common::CollectionHandle<T>;268269	fn deref(&self) -> &Self::Target {270		&self.0271	}272}273274impl<T: Config> WithRecorder<T> for RefungibleHandle<T> {275	fn recorder(&self) -> &pallet_evm_coder_substrate::SubstrateRecorder<T> {276		self.0.recorder()277	}278	fn into_recorder(self) -> pallet_evm_coder_substrate::SubstrateRecorder<T> {279		self.0.into_recorder()280	}281}282283impl<T: Config> Pallet<T> {284	/// Get number of RFT tokens in collection285	pub fn total_supply(collection: &RefungibleHandle<T>) -> u32 {286		<TokensMinted<T>>::get(collection.id) - <TokensBurnt<T>>::get(collection.id)287	}288289	/// Check that RFT token exists290	///291	/// - `token`: Token ID.292	pub fn token_exists(collection: &RefungibleHandle<T>, token: TokenId) -> bool {293		<TotalSupply<T>>::contains_key((collection.id, token))294	}295}296297// unchecked calls skips any permission checks298impl<T: Config> Pallet<T> {299	/// Create RFT collection300	///301	/// `init_collection` will take non-refundable deposit for collection creation.302	///303	/// - `data`: Contains settings for collection limits and permissions.304	pub fn init_collection(305		owner: T::CrossAccountId,306		payer: T::CrossAccountId,307		data: CreateCollectionData<T::CrossAccountId>,308	) -> Result<CollectionId, DispatchError> {309		<PalletCommon<T>>::init_collection(owner, payer, data)310	}311312	/// Destroy RFT collection313	///314	/// `destroy_collection` will throw error if collection contains any tokens.315	/// Only owner can destroy collection.316	pub fn destroy_collection(317		collection: RefungibleHandle<T>,318		sender: &T::CrossAccountId,319	) -> DispatchResult {320		let id = collection.id;321322		if Self::collection_has_tokens(id) {323			return Err(<CommonError<T>>::CantDestroyNotEmptyCollection.into());324		}325326		// =========327328		PalletCommon::destroy_collection(collection.0, sender)?;329330		<TokensMinted<T>>::remove(id);331		<TokensBurnt<T>>::remove(id);332		let _ = <TotalSupply<T>>::clear_prefix((id,), u32::MAX, None);333		let _ = <Balance<T>>::clear_prefix((id,), u32::MAX, None);334		let _ = <Allowance<T>>::clear_prefix((id,), u32::MAX, None);335		let _ = <Owned<T>>::clear_prefix((id,), u32::MAX, None);336		let _ = <AccountBalance<T>>::clear_prefix((id,), u32::MAX, None);337		Ok(())338	}339340	fn collection_has_tokens(collection_id: CollectionId) -> bool {341		<TotalSupply<T>>::iter_prefix((collection_id,))342			.next()343			.is_some()344	}345346	pub fn burn_token_unchecked(347		collection: &RefungibleHandle<T>,348		owner: &T::CrossAccountId,349		token_id: TokenId,350	) -> DispatchResult {351		let burnt = <TokensBurnt<T>>::get(collection.id)352			.checked_add(1)353			.ok_or(ArithmeticError::Overflow)?;354355		<TokensBurnt<T>>::insert(collection.id, burnt);356		<TokenProperties<T>>::remove((collection.id, token_id));357		<TotalSupply<T>>::remove((collection.id, token_id));358		let _ = <Balance<T>>::clear_prefix((collection.id, token_id), u32::MAX, None);359		let _ = <Allowance<T>>::clear_prefix((collection.id, token_id), u32::MAX, None);360		<PalletEvm<T>>::deposit_log(361			ERC721Events::Transfer {362				from: *owner.as_eth(),363				to: H160::default(),364				token_id: token_id.into(),365			}366			.to_log(collection_id_to_address(collection.id)),367		);368		Ok(())369	}370371	/// Burn RFT token pieces372	///373	/// `burn` will decrease total amount of token pieces and amount owned by sender.374	/// `burn` can be called even if there are multiple owners of the RFT token.375	/// If sender wouldn't have any pieces left after `burn` than she will stop being376	/// one of the owners of the token. If there is no account that owns any pieces of377	/// the token than token will be burned too.378	///379	/// - `amount`: Amount of token pieces to burn.380	/// - `token`: Token who's pieces should be burned381	/// - `collection`: Collection that contains the token382	pub fn burn(383		collection: &RefungibleHandle<T>,384		owner: &T::CrossAccountId,385		token: TokenId,386		amount: u128,387	) -> DispatchResult {388		if <Balance<T>>::get((collection.id, token, owner)) == 0 {389			return Err(<CommonError<T>>::TokenValueTooLow.into());390		}391392		let total_supply = <TotalSupply<T>>::get((collection.id, token))393			.checked_sub(amount)394			.ok_or(<CommonError<T>>::TokenValueTooLow)?;395396		// This was probally last owner of this token?397		if total_supply == 0 {398			// Ensure user actually owns this amount399			ensure!(400				<Balance<T>>::get((collection.id, token, owner)) == amount,401				<CommonError<T>>::TokenValueTooLow402			);403			let account_balance = <AccountBalance<T>>::get((collection.id, owner))404				.checked_sub(1)405				// Should not occur406				.ok_or(ArithmeticError::Underflow)?;407408			// =========409410			<Owned<T>>::remove((collection.id, owner, token));411			<PalletStructure<T>>::unnest_if_nested(owner, collection.id, token);412			<AccountBalance<T>>::insert((collection.id, owner), account_balance);413			Self::burn_token_unchecked(collection, owner, token)?;414			<PalletEvm<T>>::deposit_log(415				ERC20Events::Transfer {416					from: *owner.as_eth(),417					to: H160::default(),418					value: amount.into(),419				}420				.to_log(collection_id_to_address(collection.id)),421			);422			<PalletCommon<T>>::deposit_event(CommonEvent::ItemDestroyed(423				collection.id,424				token,425				owner.clone(),426				amount,427			));428			return Ok(());429		}430431		let balance = <Balance<T>>::get((collection.id, token, owner))432			.checked_sub(amount)433			.ok_or(<CommonError<T>>::TokenValueTooLow)?;434		let account_balance = if balance == 0 {435			<AccountBalance<T>>::get((collection.id, owner))436				.checked_sub(1)437				// Should not occur438				.ok_or(ArithmeticError::Underflow)?439		} else {440			0441		};442443		// =========444445		if balance == 0 {446			<Owned<T>>::remove((collection.id, owner, token));447			<PalletStructure<T>>::unnest_if_nested(owner, collection.id, token);448			<Balance<T>>::remove((collection.id, token, owner));449			<AccountBalance<T>>::insert((collection.id, owner), account_balance);450451			if let Ok(user) = Self::token_owner(collection.id, token) {452				<PalletEvm<T>>::deposit_log(453					ERC721Events::Transfer {454						from: erc::ADDRESS_FOR_PARTIALLY_OWNED_TOKENS,455						to: *user.as_eth(),456						token_id: token.into(),457					}458					.to_log(collection_id_to_address(collection.id)),459				);460			}461		} else {462			<Balance<T>>::insert((collection.id, token, owner), balance);463		}464		<TotalSupply<T>>::insert((collection.id, token), total_supply);465466		<PalletEvm<T>>::deposit_log(467			ERC20Events::Transfer {468				from: *owner.as_eth(),469				to: H160::default(),470				value: amount.into(),471			}472			.to_log(T::EvmTokenAddressMapping::token_to_address(473				collection.id,474				token,475			)),476		);477		<PalletCommon<T>>::deposit_event(CommonEvent::ItemDestroyed(478			collection.id,479			token,480			owner.clone(),481			amount,482		));483		Ok(())484	}485486	/// A batch operation to add, edit or remove properties for a token.487	/// It sets or removes a token's properties according to488	/// `properties_updates` contents:489	/// * sets a property under the <key> with the value provided `(<key>, Some(<value>))`490	/// * removes a property under the <key> if the value is `None` `(<key>, None)`.491	///492	/// - `nesting_budget`: Limit for searching parents in-depth to check ownership.493	///494	/// All affected properties should have `mutable` permission495	/// to be **deleted** or to be **set more than once**,496	/// and the sender should have permission to edit those properties.497	///498	/// This function fires an event for each property change.499	/// In case of an error, all the changes (including the events) will be reverted500	/// since the function is transactional.501	#[transactional]502	fn modify_token_properties(503		collection: &RefungibleHandle<T>,504		sender: &T::CrossAccountId,505		token_id: TokenId,506		properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,507		nesting_budget: &dyn Budget,508	) -> DispatchResult {509		let mut property_writer =510			pallet_common::property_writer_for_existing_token(collection, sender);511512		property_writer.write_token_properties(513			sender,514			token_id,515			properties_updates,516			nesting_budget,517			erc::ERC721TokenEvent::TokenChanged {518				token_id: token_id.into(),519			}520			.to_log(T::ContractAddress::get()),521		)522	}523524	pub fn next_token_id(collection: &RefungibleHandle<T>) -> Result<TokenId, DispatchError> {525		let next_token_id = <TokensMinted<T>>::get(collection.id)526			.checked_add(1)527			.ok_or(<CommonError<T>>::CollectionTokenLimitExceeded)?;528529		ensure!(530			collection.limits.token_limit() >= next_token_id,531			<CommonError<T>>::CollectionTokenLimitExceeded532		);533534		Ok(TokenId(next_token_id))535	}536537	pub fn set_token_properties(538		collection: &RefungibleHandle<T>,539		sender: &T::CrossAccountId,540		token_id: TokenId,541		properties: impl Iterator<Item = Property>,542		nesting_budget: &dyn Budget,543	) -> DispatchResult {544		Self::modify_token_properties(545			collection,546			sender,547			token_id,548			properties.map(|p| (p.key, Some(p.value))),549			nesting_budget,550		)551	}552553	pub fn set_token_property(554		collection: &RefungibleHandle<T>,555		sender: &T::CrossAccountId,556		token_id: TokenId,557		property: Property,558		nesting_budget: &dyn Budget,559	) -> DispatchResult {560		Self::set_token_properties(561			collection,562			sender,563			token_id,564			[property].into_iter(),565			nesting_budget,566		)567	}568569	pub fn delete_token_properties(570		collection: &RefungibleHandle<T>,571		sender: &T::CrossAccountId,572		token_id: TokenId,573		property_keys: impl Iterator<Item = PropertyKey>,574		nesting_budget: &dyn Budget,575	) -> DispatchResult {576		Self::modify_token_properties(577			collection,578			sender,579			token_id,580			property_keys.into_iter().map(|key| (key, None)),581			nesting_budget,582		)583	}584585	pub fn delete_token_property(586		collection: &RefungibleHandle<T>,587		sender: &T::CrossAccountId,588		token_id: TokenId,589		property_key: PropertyKey,590		nesting_budget: &dyn Budget,591	) -> DispatchResult {592		Self::delete_token_properties(593			collection,594			sender,595			token_id,596			[property_key].into_iter(),597			nesting_budget,598		)599	}600601	/// Transfer RFT token pieces from one account to another.602	///603	/// If the sender is no longer owns any pieces after the `transfer` than she stops being an owner of the token.604	///605	/// - `from`: Owner of token pieces to transfer.606	/// - `to`: Recepient of transfered token pieces.607	/// - `amount`: Amount of token pieces to transfer.608	/// - `token`: Token whos pieces should be transfered609	/// - `collection`: Collection that contains the token610	pub fn transfer(611		collection: &RefungibleHandle<T>,612		from: &T::CrossAccountId,613		to: &T::CrossAccountId,614		token: TokenId,615		amount: u128,616		nesting_budget: &dyn Budget,617	) -> DispatchResult {618		ensure!(619			collection.limits.transfers_enabled(),620			<CommonError<T>>::TransferNotAllowed621		);622623		if collection.permissions.access() == AccessMode::AllowList {624			collection.check_allowlist(from)?;625			collection.check_allowlist(to)?;626		}627		<PalletCommon<T>>::ensure_correct_receiver(to)?;628629		let initial_balance_from = <Balance<T>>::get((collection.id, token, from));630631		if initial_balance_from == 0 {632			return Err(<CommonError<T>>::TokenValueTooLow.into());633		}634635		let updated_balance_from = initial_balance_from636			.checked_sub(amount)637			.ok_or(<CommonError<T>>::TokenValueTooLow)?;638		let mut create_target = false;639		let from_to_differ = from != to;640		let updated_balance_to = if from != to && amount != 0 {641			let old_balance = <Balance<T>>::get((collection.id, token, to));642			if old_balance == 0 {643				create_target = true;644			}645			Some(646				old_balance647					.checked_add(amount)648					.ok_or(ArithmeticError::Overflow)?,649			)650		} else {651			None652		};653654		let account_balance_from = if updated_balance_from == 0 {655			Some(656				<AccountBalance<T>>::get((collection.id, from))657					.checked_sub(1)658					// Should not occur659					.ok_or(ArithmeticError::Underflow)?,660			)661		} else {662			None663		};664		// Account data is created in token, AccountBalance should be increased665		// But only if from != to as we shouldn't check overflow in this case666		let account_balance_to = if create_target && from_to_differ {667			let account_balance_to = <AccountBalance<T>>::get((collection.id, to))668				.checked_add(1)669				.ok_or(ArithmeticError::Overflow)?;670			ensure!(671				account_balance_to < collection.limits.account_token_ownership_limit(),672				<CommonError<T>>::AccountTokenLimitExceeded,673			);674675			Some(account_balance_to)676		} else {677			None678		};679680		// =========681682		if let Some(updated_balance_to) = updated_balance_to {683			// from != to && amount != 0684685			<PalletStructure<T>>::nest_if_sent_to_token(686				from.clone(),687				to,688				collection.id,689				token,690				nesting_budget,691			)?;692693			if updated_balance_from == 0 {694				<Balance<T>>::remove((collection.id, token, from));695				<PalletStructure<T>>::unnest_if_nested(from, collection.id, token);696			} else {697				<Balance<T>>::insert((collection.id, token, from), updated_balance_from);698			}699			<Balance<T>>::insert((collection.id, token, to), updated_balance_to);700			if let Some(account_balance_from) = account_balance_from {701				<AccountBalance<T>>::insert((collection.id, from), account_balance_from);702				<Owned<T>>::remove((collection.id, from, token));703			}704			if let Some(account_balance_to) = account_balance_to {705				<AccountBalance<T>>::insert((collection.id, to), account_balance_to);706				<Owned<T>>::insert((collection.id, to, token), true);707			}708		}709710		<PalletEvm<T>>::deposit_log(711			ERC20Events::Transfer {712				from: *from.as_eth(),713				to: *to.as_eth(),714				value: amount.into(),715			}716			.to_log(T::EvmTokenAddressMapping::token_to_address(717				collection.id,718				token,719			)),720		);721722		<PalletCommon<T>>::deposit_event(CommonEvent::Transfer(723			collection.id,724			token,725			from.clone(),726			to.clone(),727			amount,728		));729730		let total_supply = <TotalSupply<T>>::get((collection.id, token));731732		if amount == total_supply {733			// if token was fully owned by `from` and will be fully owned by `to` after transfer734			<PalletEvm<T>>::deposit_log(735				ERC721Events::Transfer {736					from: *from.as_eth(),737					to: *to.as_eth(),738					token_id: token.into(),739				}740				.to_log(collection_id_to_address(collection.id)),741			);742		} else if let Some(updated_balance_to) = updated_balance_to {743			// if `from` not equals `to`. This condition is needed to avoid sending event744			// when `from` fully owns token and sends part of token pieces to itself.745			if initial_balance_from == total_supply {746				// if token was fully owned by `from` and will be only partially owned by `to`747				// and `from` after transfer748				<PalletEvm<T>>::deposit_log(749					ERC721Events::Transfer {750						from: *from.as_eth(),751						to: erc::ADDRESS_FOR_PARTIALLY_OWNED_TOKENS,752						token_id: token.into(),753					}754					.to_log(collection_id_to_address(collection.id)),755				);756			} else if updated_balance_to == total_supply {757				// if token was partially owned by `from` and will be fully owned by `to` after transfer758				<PalletEvm<T>>::deposit_log(759					ERC721Events::Transfer {760						from: erc::ADDRESS_FOR_PARTIALLY_OWNED_TOKENS,761						to: *to.as_eth(),762						token_id: token.into(),763					}764					.to_log(collection_id_to_address(collection.id)),765				);766			}767		}768769		Ok(())770	}771772	/// Batched operation to create multiple RFT tokens.773	///774	/// Same as `create_item` but creates multiple tokens.775	///776	/// - `data`: Same as 'data` in `create_item` but contains data for multiple tokens.777	pub fn create_multiple_items(778		collection: &RefungibleHandle<T>,779		sender: &T::CrossAccountId,780		data: Vec<CreateItemData<T>>,781		nesting_budget: &dyn Budget,782	) -> DispatchResult {783		if !collection.is_owner_or_admin(sender) {784			ensure!(785				collection.permissions.mint_mode(),786				<CommonError<T>>::PublicMintingNotAllowed787			);788			collection.check_allowlist(sender)?;789790			for item in data.iter() {791				for user in item.users.keys() {792					collection.check_allowlist(user)?;793				}794			}795		}796797		for item in data.iter() {798			for (owner, _) in item.users.iter() {799				<PalletCommon<T>>::ensure_correct_receiver(owner)?;800			}801		}802803		// Total pieces per tokens804		let totals = data805			.iter()806			.map(|data| {807				Ok(data808					.users809					.iter()810					.map(|u| u.1)811					.try_fold(0u128, |acc, v| acc.checked_add(*v))812					.ok_or(ArithmeticError::Overflow)?)813			})814			.collect::<Result<Vec<_>, DispatchError>>()?;815		for total in &totals {816			ensure!(817				*total <= MAX_REFUNGIBLE_PIECES,818				<Error<T>>::WrongRefungiblePieces819			);820		}821822		let first_token_id = <TokensMinted<T>>::get(collection.id);823		let tokens_minted = first_token_id824			.checked_add(data.len() as u32)825			.ok_or(ArithmeticError::Overflow)?;826		ensure!(827			tokens_minted < collection.limits.token_limit(),828			<CommonError<T>>::CollectionTokenLimitExceeded829		);830831		let mut balances = BTreeMap::new();832		for data in &data {833			for owner in data.users.keys() {834				let balance = balances835					.entry(owner)836					.or_insert_with(|| <AccountBalance<T>>::get((collection.id, owner)));837				*balance = balance.checked_add(1).ok_or(ArithmeticError::Overflow)?;838839				ensure!(840					*balance <= collection.limits.account_token_ownership_limit(),841					<CommonError<T>>::AccountTokenLimitExceeded,842				);843			}844		}845846		for (i, token) in data.iter().enumerate() {847			let token_id = TokenId(first_token_id + i as u32 + 1);848			for (to, _) in token.users.iter() {849				<PalletStructure<T>>::check_nesting(850					sender.clone(),851					to,852					collection.id,853					token_id,854					nesting_budget,855				)?;856			}857		}858859		// =========860861		let mut property_writer = pallet_common::property_writer_for_new_token(collection, sender);862863		with_transaction(|| {864			for (i, data) in data.iter().enumerate() {865				let token_id = first_token_id + i as u32 + 1;866				<TotalSupply<T>>::insert((collection.id, token_id), totals[i]);867868				let token = TokenId(token_id);869870				let mut mint_target_is_sender = true;871				for (user, amount) in data.users.iter() {872					if *amount == 0 {873						continue;874					}875876					mint_target_is_sender = mint_target_is_sender && sender.conv_eq(user);877878					<Balance<T>>::insert((collection.id, token_id, &user), amount);879					<Owned<T>>::insert((collection.id, &user, token), true);880					<PalletStructure<T>>::nest_if_sent_to_token_unchecked(881						user,882						collection.id,883						token,884					);885				}886887				if let Err(e) = property_writer.write_token_properties(888					mint_target_is_sender,889					token,890					data.properties.clone().into_iter(),891					erc::ERC721TokenEvent::TokenChanged {892						token_id: token.into(),893					}894					.to_log(T::ContractAddress::get()),895				) {896					return TransactionOutcome::Rollback(Err(e));897				}898			}899			TransactionOutcome::Commit(Ok(()))900		})?;901902		<TokensMinted<T>>::insert(collection.id, tokens_minted);903904		for (account, balance) in balances {905			<AccountBalance<T>>::insert((collection.id, account), balance);906		}907908		for (i, token) in data.into_iter().enumerate() {909			let token_id = first_token_id + i as u32 + 1;910911			let receivers = token912				.users913				.into_iter()914				.filter(|(_, amount)| *amount > 0)915				.collect::<Vec<_>>();916917			if let [(user, _)] = receivers.as_slice() {918				// if there is exactly one receiver919				<PalletEvm<T>>::deposit_log(920					ERC721Events::Transfer {921						from: H160::default(),922						to: *user.as_eth(),923						token_id: token_id.into(),924					}925					.to_log(collection_id_to_address(collection.id)),926				);927			} else if let [_, ..] = receivers.as_slice() {928				// if there is more than one receiver929				<PalletEvm<T>>::deposit_log(930					ERC721Events::Transfer {931						from: H160::default(),932						to: erc::ADDRESS_FOR_PARTIALLY_OWNED_TOKENS,933						token_id: token_id.into(),934					}935					.to_log(collection_id_to_address(collection.id)),936				);937			}938939			for (user, amount) in receivers.into_iter() {940				<PalletEvm<T>>::deposit_log(941					ERC20Events::Transfer {942						from: H160::default(),943						to: *user.as_eth(),944						value: amount.into(),945					}946					.to_log(T::EvmTokenAddressMapping::token_to_address(947						collection.id,948						TokenId(token_id),949					)),950				);951				<PalletCommon<T>>::deposit_event(CommonEvent::ItemCreated(952					collection.id,953					TokenId(token_id),954					user,955					amount,956				));957			}958		}959		Ok(())960	}961962	pub fn set_allowance_unchecked(963		collection: &RefungibleHandle<T>,964		sender: &T::CrossAccountId,965		spender: &T::CrossAccountId,966		token: TokenId,967		amount: u128,968	) {969		if amount == 0 {970			<Allowance<T>>::remove((collection.id, token, sender, spender));971		} else {972			<Allowance<T>>::insert((collection.id, token, sender, spender), amount);973		}974975		<PalletEvm<T>>::deposit_log(976			ERC20Events::Approval {977				owner: *sender.as_eth(),978				spender: *spender.as_eth(),979				value: amount.into(),980			}981			.to_log(T::EvmTokenAddressMapping::token_to_address(982				collection.id,983				token,984			)),985		);986		<PalletCommon<T>>::deposit_event(CommonEvent::Approved(987			collection.id,988			token,989			sender.clone(),990			spender.clone(),991			amount,992		))993	}994995	/// Set allowance for the spender to `transfer` or `burn` sender's token pieces.996	///997	/// - `amount`: Amount of token pieces the spender is allowed to `transfer` or `burn.998	pub fn set_allowance(999		collection: &RefungibleHandle<T>,1000		sender: &T::CrossAccountId,1001		spender: &T::CrossAccountId,1002		token: TokenId,1003		amount: u128,1004	) -> DispatchResult {1005		if collection.permissions.access() == AccessMode::AllowList {1006			collection.check_allowlist(sender)?;1007			collection.check_allowlist(spender)?;1008		}10091010		<PalletCommon<T>>::ensure_correct_receiver(spender)?;10111012		if <Balance<T>>::get((collection.id, token, sender)) < amount {1013			ensure!(1014				collection.ignores_owned_amount(sender) && Self::token_exists(collection, token),1015				<CommonError<T>>::CantApproveMoreThanOwned1016			);1017		}10181019		// =========10201021		Self::set_allowance_unchecked(collection, sender, spender, token, amount);1022		Ok(())1023	}10241025	/// Set allowance to spend from sender's eth mirror1026	///1027	/// - `from`: Address of sender's eth mirror.1028	/// - `to`: Adress of spender.1029	/// - `amount`: Amount of token pieces the spender is allowed to `transfer` or `burn.1030	pub fn set_allowance_from(1031		collection: &RefungibleHandle<T>,1032		sender: &T::CrossAccountId,1033		from: &T::CrossAccountId,1034		to: &T::CrossAccountId,1035		token_id: TokenId,1036		amount: u128,1037	) -> DispatchResult {1038		if collection.permissions.access() == AccessMode::AllowList {1039			collection.check_allowlist(sender)?;1040			collection.check_allowlist(from)?;1041			collection.check_allowlist(to)?;1042		}10431044		<PalletCommon<T>>::ensure_correct_receiver(to)?;10451046		ensure!(1047			sender.conv_eq(from),1048			<CommonError<T>>::AddressIsNotEthMirror1049		);10501051		if <Balance<T>>::get((collection.id, token_id, from)) < amount {1052			ensure!(1053				collection.limits.owner_can_transfer()1054					&& (collection.is_owner_or_admin(sender) || collection.is_owner_or_admin(from))1055					&& Self::token_exists(collection, token_id),1056				<CommonError<T>>::CantApproveMoreThanOwned1057			);1058		}10591060		// =========10611062		Self::set_allowance_unchecked(collection, from, to, token_id, amount);1063		Ok(())1064	}10651066	/// Returns allowance, which should be set after transaction1067	fn check_allowed(1068		collection: &RefungibleHandle<T>,1069		spender: &T::CrossAccountId,1070		from: &T::CrossAccountId,1071		token: TokenId,1072		amount: u128,1073		nesting_budget: &dyn Budget,1074	) -> Result<Option<u128>, DispatchError> {1075		if spender.conv_eq(from) {1076			return Ok(None);1077		}1078		if collection.permissions.access() == AccessMode::AllowList {1079			// `from`, `to` checked in [`transfer`]1080			collection.check_allowlist(spender)?;1081		}10821083		if collection.ignores_token_restrictions(spender) {1084			return Ok(Self::compute_allowance_decrease(1085				collection, token, from, spender, amount,1086			));1087		}10881089		if let Some(source) = T::CrossTokenAddressMapping::address_to_token(from) {1090			// TODO: should collection owner be allowed to perform this transfer?1091			ensure!(1092				<PalletStructure<T>>::check_indirectly_owned(1093					spender.clone(),1094					source.0,1095					source.1,1096					None,1097					nesting_budget1098				)?,1099				<CommonError<T>>::ApprovedValueTooLow,1100			);1101			return Ok(None);1102		}11031104		let allowance = Self::compute_allowance_decrease(collection, token, from, spender, amount);1105		if allowance.is_some() {1106			return Ok(allowance);1107		}11081109		// Allowance (if any) would be reduced if spender is also wallet operator1110		if <CollectionAllowance<T>>::get((collection.id, from, spender)) {1111			return Ok(allowance);1112		}11131114		Err(<CommonError<T>>::ApprovedValueTooLow.into())1115	}11161117	/// Returns `Some(amount)` if the `spender` have allowance to spend this amount.1118	/// Otherwise, it returns `None`.1119	fn compute_allowance_decrease(1120		collection: &RefungibleHandle<T>,1121		token: TokenId,1122		from: &T::CrossAccountId,1123		spender: &T::CrossAccountId,1124		amount: u128,1125	) -> Option<u128> {1126		<Allowance<T>>::get((collection.id, token, from, spender)).checked_sub(amount)1127	}11281129	/// Transfer RFT token pieces from one account to another.1130	///1131	/// Same as the [`transfer`] but spender doesn't needs to be an owner of the token pieces.1132	/// The owner should set allowance for the spender to transfer pieces.1133	///1134	/// [`transfer`]: struct.Pallet.html#method.transfer1135	pub fn transfer_from(1136		collection: &RefungibleHandle<T>,1137		spender: &T::CrossAccountId,1138		from: &T::CrossAccountId,1139		to: &T::CrossAccountId,1140		token: TokenId,1141		amount: u128,1142		nesting_budget: &dyn Budget,1143	) -> DispatchResult {1144		let allowance =1145			Self::check_allowed(collection, spender, from, token, amount, nesting_budget)?;11461147		// =========11481149		Self::transfer(collection, from, to, token, amount, nesting_budget)?;1150		if let Some(allowance) = allowance {1151			Self::set_allowance_unchecked(collection, from, spender, token, allowance);1152		}1153		Ok(())1154	}11551156	/// Burn RFT token pieces from the account.1157	///1158	/// Same as the [`burn`] but spender doesn't need to be an owner of the token pieces. The owner should1159	/// set allowance for the spender to burn pieces1160	///1161	/// [`burn`]: struct.Pallet.html#method.burn1162	pub fn burn_from(1163		collection: &RefungibleHandle<T>,1164		spender: &T::CrossAccountId,1165		from: &T::CrossAccountId,1166		token: TokenId,1167		amount: u128,1168		nesting_budget: &dyn Budget,1169	) -> DispatchResult {1170		let allowance =1171			Self::check_allowed(collection, spender, from, token, amount, nesting_budget)?;11721173		// =========11741175		Self::burn(collection, from, token, amount)?;1176		if let Some(allowance) = allowance {1177			Self::set_allowance_unchecked(collection, from, spender, token, allowance);1178		}1179		Ok(())1180	}11811182	/// Create RFT token.1183	///1184	/// The sender should be the owner/admin of the collection or collection should be configured1185	/// to allow public minting.1186	///1187	/// - `data`: Contains list of users who will become the owners of the token pieces and amount1188	///   of token pieces they will receive.1189	pub fn create_item(1190		collection: &RefungibleHandle<T>,1191		sender: &T::CrossAccountId,1192		data: CreateItemData<T>,1193		nesting_budget: &dyn Budget,1194	) -> DispatchResult {1195		Self::create_multiple_items(collection, sender, vec![data], nesting_budget)1196	}11971198	/// Repartition RFT token.1199	///1200	/// `repartition` will set token balance of the sender and total amount of token pieces.1201	/// Sender should own all of the token pieces. `repartition' could be done even if some1202	/// token pieces were burned before.1203	///1204	/// - `amount`: Total amount of token pieces that the token will have after `repartition`.1205	pub fn repartition(1206		collection: &RefungibleHandle<T>,1207		owner: &T::CrossAccountId,1208		token: TokenId,1209		amount: u128,1210	) -> DispatchResult {1211		ensure!(1212			amount <= MAX_REFUNGIBLE_PIECES,1213			<Error<T>>::WrongRefungiblePieces1214		);1215		ensure!(amount > 0, <CommonError<T>>::TokenValueTooLow);1216		// Ensure user owns all pieces1217		let total_pieces = Self::total_pieces(collection.id, token).unwrap_or(u128::MAX);1218		let balance = <Balance<T>>::get((collection.id, token, owner));1219		ensure!(1220			total_pieces == balance,1221			<Error<T>>::RepartitionWhileNotOwningAllPieces1222		);12231224		<Balance<T>>::insert((collection.id, token, owner), amount);1225		<TotalSupply<T>>::insert((collection.id, token), amount);12261227		match total_pieces.cmp(&amount) {1228			Ordering::Less => {1229				let mint_amount = amount - total_pieces;1230				<PalletEvm<T>>::deposit_log(1231					ERC20Events::Transfer {1232						from: H160::default(),1233						to: *owner.as_eth(),1234						value: mint_amount.into(),1235					}1236					.to_log(T::EvmTokenAddressMapping::token_to_address(1237						collection.id,1238						token,1239					)),1240				);1241				<PalletCommon<T>>::deposit_event(CommonEvent::ItemCreated(1242					collection.id,1243					token,1244					owner.clone(),1245					mint_amount,1246				));1247			}1248			Ordering::Greater => {1249				let burn_amount = total_pieces - amount;1250				<PalletEvm<T>>::deposit_log(1251					ERC20Events::Transfer {1252						from: *owner.as_eth(),1253						to: H160::default(),1254						value: burn_amount.into(),1255					}1256					.to_log(T::EvmTokenAddressMapping::token_to_address(1257						collection.id,1258						token,1259					)),1260				);1261				<PalletCommon<T>>::deposit_event(CommonEvent::ItemDestroyed(1262					collection.id,1263					token,1264					owner.clone(),1265					burn_amount,1266				));1267			}1268			Ordering::Equal => {}1269		}12701271		Ok(())1272	}12731274	fn token_owner(1275		collection_id: CollectionId,1276		token_id: TokenId,1277	) -> Result<T::CrossAccountId, TokenOwnerError> {1278		let mut owner = None;1279		let mut count = 0;1280		for key in Balance::<T>::iter_key_prefix((collection_id, token_id)) {1281			count += 1;1282			if count > 1 {1283				return Err(TokenOwnerError::MultipleOwners);1284			}1285			owner = Some(key);1286		}1287		owner.ok_or(TokenOwnerError::NotFound)1288	}12891290	fn total_pieces(collection_id: CollectionId, token_id: TokenId) -> Option<u128> {1291		<TotalSupply<T>>::try_get((collection_id, token_id)).ok()1292	}12931294	pub fn set_collection_properties(1295		collection: &RefungibleHandle<T>,1296		sender: &T::CrossAccountId,1297		properties: Vec<Property>,1298	) -> DispatchResult {1299		<PalletCommon<T>>::set_collection_properties(collection, sender, properties.into_iter())1300	}13011302	pub fn delete_collection_properties(1303		collection: &RefungibleHandle<T>,1304		sender: &T::CrossAccountId,1305		property_keys: Vec<PropertyKey>,1306	) -> DispatchResult {1307		<PalletCommon<T>>::delete_collection_properties(1308			collection,1309			sender,1310			property_keys.into_iter(),1311		)1312	}13131314	pub fn set_token_property_permissions(1315		collection: &RefungibleHandle<T>,1316		sender: &T::CrossAccountId,1317		property_permissions: Vec<PropertyKeyPermission>,1318	) -> DispatchResult {1319		<PalletCommon<T>>::set_token_property_permissions(collection, sender, property_permissions)1320	}13211322	pub fn token_property_permission(collection_id: CollectionId) -> PropertiesPermissionMap {1323		<PalletCommon<T>>::property_permissions(collection_id)1324	}13251326	pub fn set_scoped_token_property_permissions(1327		collection: &RefungibleHandle<T>,1328		sender: &T::CrossAccountId,1329		scope: PropertyScope,1330		property_permissions: Vec<PropertyKeyPermission>,1331	) -> DispatchResult {1332		<PalletCommon<T>>::set_scoped_token_property_permissions(1333			collection,1334			sender,1335			scope,1336			property_permissions,1337		)1338	}13391340	/// Returns 10 token in no particular order.1341	///1342	/// There is no direct way to get token holders in ascending order,1343	/// since `iter_prefix` returns values in no particular order.1344	/// Therefore, getting the 10 largest holders with a large value of holders1345	/// can lead to impact memory allocation + sorting with  `n * log (n)`.1346	pub fn token_owners(1347		collection_id: CollectionId,1348		token: TokenId,1349	) -> Option<Vec<T::CrossAccountId>> {1350		let res: Vec<T::CrossAccountId> = <Balance<T>>::iter_prefix((collection_id, token))1351			.map(|(owner, _amount)| owner)1352			.take(10)1353			.collect();13541355		if res.is_empty() {1356			None1357		} else {1358			Some(res)1359		}1360	}13611362	/// Sets or unsets the approval of a given operator.1363	///1364	/// The `operator` is allowed to transfer all token pieces of the `owner` on their behalf.1365	/// - `owner`: Token owner1366	/// - `operator`: Operator1367	/// - `approve`: Should operator status be granted or revoked?1368	pub fn set_allowance_for_all(1369		collection: &RefungibleHandle<T>,1370		owner: &T::CrossAccountId,1371		spender: &T::CrossAccountId,1372		approve: bool,1373	) -> DispatchResult {1374		<PalletCommon<T>>::set_allowance_for_all(1375			collection,1376			owner,1377			spender,1378			approve,1379			|| <CollectionAllowance<T>>::insert((collection.id, owner, spender), approve),1380			ERC721Events::ApprovalForAll {1381				owner: *owner.as_eth(),1382				operator: *spender.as_eth(),1383				approved: approve,1384			}1385			.to_log(collection_id_to_address(collection.id)),1386		)1387	}13881389	/// Tells whether the given `owner` approves the `operator`.1390	pub fn allowance_for_all(1391		collection: &RefungibleHandle<T>,1392		owner: &T::CrossAccountId,1393		spender: &T::CrossAccountId,1394	) -> bool {1395		<CollectionAllowance<T>>::get((collection.id, owner, spender))1396	}13971398	pub fn repair_item(collection: &RefungibleHandle<T>, token: TokenId) -> DispatchResult {1399		<TokenProperties<T>>::mutate((collection.id, token), |properties| {1400			if let Some(properties) = properties {1401				properties.recompute_consumed_space();1402			}1403		});14041405		Ok(())1406	}1407}
after · pallets/refungible/src/lib.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/>.1617//! # Refungible Pallet18//!19//! The Refungible pallet provides functionality for handling refungible collections and tokens.20//!21//! - [`Config`]22//! - [`RefungibleHandle`]23//! - [`Pallet`]24//! - [`CommonWeights`](common::CommonWeights)25//!26//! ## Overview27//!28//! The Refungible pallet provides functions for:29//!30//! - RFT collection creation and removal31//! - Minting and burning of RFT tokens32//! - Partition and repartition of RFT tokens33//! - Retrieving number of pieces of RFT token34//! - Retrieving account balances35//! - Transfering RFT token pieces36//! - Burning RFT token pieces37//! - Setting and checking allowance for RFT tokens38//!39//! ### Terminology40//!41//! - **RFT token:** Non fungible token that was partitioned to pieces. If an account owns all42//!   of the RFT token pieces than it owns the RFT token and can repartition it.43//!44//! - **RFT Collection:** A collection of RFT tokens. All RFT tokens are part of a collection.45//!   Each collection has its own settings and set of permissions.46//!47//! - **RFT token piece:** A fungible part of an RFT token.48//!49//! - **Balance:** RFT token pieces owned by an account50//!51//! - **Allowance:** Maximum number of RFT token pieces that one account is allowed to52//!   transfer from the balance of another account53//!54//! - **Burning:** The process of “deleting” a token from a collection or removing token pieces from55//!   an account balance.56//!57//! ### Implementations58//!59//! The Refungible pallet provides implementations for the following traits. If these traits provide60//! the functionality that you need, then you can avoid coupling with the Refungible pallet.61//!62//! - [`CommonWeightInfo`](pallet_common::CommonWeightInfo): Functions for retrieval of transaction weight63//! - [`CommonCollectionOperations`](pallet_common::CommonCollectionOperations): Functions for dealing64//!   with collections65//! - [`RefungibleExtensions`](pallet_common::RefungibleExtensions): Functions specific for refungible66//!   collection67//!68//! ## Interface69//!70//! ### Dispatchable Functions71//!72//! - `init_collection` - Create RFT collection. RFT collection can be configured to allow or deny access for73//!   some accounts.74//! - `destroy_collection` - Destroy exising RFT collection. There should be no tokens in the collection.75//! - `burn` - Burn some amount of RFT token pieces owned by account. Burns the RFT token if no pieces left.76//! - `transfer` - Transfer some amount of RFT token pieces. Transfers should be enabled for RFT collection.77//!   Nests the RFT token if RFT token pieces are sent to another token.78//! - `create_item` - Mint RFT token in collection. Sender should have permission to mint tokens.79//! - `set_allowance` - Set allowance for another account to transfer balance from sender's account.80//! - `repartition` - Repartition token to selected number of pieces. Sender should own all existing pieces.81//!82//! ## Assumptions83//!84//! * Total number of pieces for one token shouldn't exceed `up_data_structs::MAX_REFUNGIBLE_PIECES`.85//! * Total number of tokens of all types shouldn't be greater than `up_data_structs::MAX_TOKEN_PREFIX_LENGTH`.86//! * Sender should be in collection's allow list to perform operations on tokens.8788#![cfg_attr(not(feature = "std"), no_std)]8990use core::{cmp::Ordering, ops::Deref};9192use evm_coder::ToLog;93use frame_support::{ensure, storage::with_transaction, transactional};94pub use pallet::*;95use pallet_common::{96	eth::collection_id_to_address, Error as CommonError, Event as CommonEvent,97	Pallet as PalletCommon,98};99use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};100use pallet_evm_coder_substrate::WithRecorder;101use pallet_structure::Pallet as PalletStructure;102use sp_core::{Get, H160};103use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, TransactionOutcome};104use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};105use up_data_structs::{106	budget::Budget, mapping::TokenAddressMapping, AccessMode, CollectionId, CreateCollectionData,107	CreateRefungibleExMultipleOwners, PropertiesPermissionMap, Property, PropertyKey,108	PropertyKeyPermission, PropertyScope, PropertyValue, TokenId, TokenOwnerError,109	TokenProperties as TokenPropertiesT, MAX_REFUNGIBLE_PIECES,110};111112use crate::{erc::ERC721Events, erc_token::ERC20Events};113#[cfg(feature = "runtime-benchmarks")]114pub mod benchmarking;115pub mod common;116pub mod erc;117pub mod erc_token;118pub mod weights;119120pub type CreateItemData<T> =121	CreateRefungibleExMultipleOwners<<T as pallet_evm::Config>::CrossAccountId>;122pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;123124#[frame_support::pallet]125pub mod pallet {126	use frame_support::{127		pallet_prelude::*, storage::Key, traits::StorageVersion, Blake2_128, Blake2_128Concat,128		Twox64Concat,129	};130	use up_data_structs::{CollectionId, TokenId};131132	use super::{weights::WeightInfo, *};133134	#[pallet::error]135	pub enum Error<T> {136		/// Not Refungible item data used to mint in Refungible collection.137		NotRefungibleDataUsedToMintFungibleCollectionToken,138		/// Maximum refungibility exceeded.139		WrongRefungiblePieces,140		/// Refungible token can't be repartitioned by user who isn't owns all pieces.141		RepartitionWhileNotOwningAllPieces,142		/// Refungible token can't nest other tokens.143		RefungibleDisallowsNesting,144		/// Setting item properties is not allowed.145		SettingPropertiesNotAllowed,146	}147148	#[pallet::config]149	pub trait Config:150		frame_system::Config + pallet_common::Config + pallet_structure::Config151	{152		type WeightInfo: WeightInfo;153	}154155	const STORAGE_VERSION: StorageVersion = StorageVersion::new(2);156157	#[pallet::pallet]158	#[pallet::storage_version(STORAGE_VERSION)]159	pub struct Pallet<T>(_);160161	/// Total amount of minted tokens in a collection.162	#[pallet::storage]163	pub type TokensMinted<T: Config> =164		StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;165166	/// Amount of tokens burnt in a collection.167	#[pallet::storage]168	pub type TokensBurnt<T: Config> =169		StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;170171	/// Amount of pieces a refungible token is split into.172	#[pallet::storage]173	#[pallet::getter(fn token_properties)]174	pub type TokenProperties<T: Config> = StorageNMap<175		Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),176		Value = TokenPropertiesT,177		QueryKind = OptionQuery,178	>;179180	/// Total amount of pieces for token181	#[pallet::storage]182	pub type TotalSupply<T: Config> = StorageNMap<183		Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),184		Value = u128,185		QueryKind = ValueQuery,186	>;187188	/// Used to enumerate tokens owned by account.189	#[pallet::storage]190	pub type Owned<T: Config> = StorageNMap<191		Key = (192			Key<Twox64Concat, CollectionId>,193			Key<Blake2_128Concat, T::CrossAccountId>,194			Key<Twox64Concat, TokenId>,195		),196		Value = bool,197		QueryKind = ValueQuery,198	>;199200	/// Amount of tokens (not pieces) partially owned by an account within a collection.201	#[pallet::storage]202	pub type AccountBalance<T: Config> = StorageNMap<203		Key = (204			Key<Twox64Concat, CollectionId>,205			// Owner206			Key<Blake2_128Concat, T::CrossAccountId>,207		),208		Value = u32,209		QueryKind = ValueQuery,210	>;211212	/// Amount of token pieces owned by account.213	#[pallet::storage]214	pub type Balance<T: Config> = StorageNMap<215		Key = (216			Key<Twox64Concat, CollectionId>,217			Key<Twox64Concat, TokenId>,218			// Owner219			Key<Blake2_128Concat, T::CrossAccountId>,220		),221		Value = u128,222		QueryKind = ValueQuery,223	>;224225	/// Allowance set by a token owner for another user to perform one of certain transactions on a number of pieces of a token.226	#[pallet::storage]227	pub type Allowance<T: Config> = StorageNMap<228		Key = (229			Key<Twox64Concat, CollectionId>,230			Key<Twox64Concat, TokenId>,231			// Owner232			Key<Blake2_128, T::CrossAccountId>,233			// Spender234			Key<Blake2_128Concat, T::CrossAccountId>,235		),236		Value = u128,237		QueryKind = ValueQuery,238	>;239240	/// Spender set by a wallet owner that could perform certain transactions on all tokens in the wallet.241	#[pallet::storage]242	pub type CollectionAllowance<T: Config> = StorageNMap<243		Key = (244			Key<Twox64Concat, CollectionId>,245			Key<Blake2_128Concat, T::CrossAccountId>, // Owner246			Key<Blake2_128Concat, T::CrossAccountId>, // Spender247		),248		Value = bool,249		QueryKind = ValueQuery,250	>;251}252253pub struct RefungibleHandle<T: Config>(pallet_common::CollectionHandle<T>);254impl<T: Config> RefungibleHandle<T> {255	pub fn cast(inner: pallet_common::CollectionHandle<T>) -> Self {256		Self(inner)257	}258	pub fn into_inner(self) -> pallet_common::CollectionHandle<T> {259		self.0260	}261	pub fn common_mut(&mut self) -> &mut pallet_common::CollectionHandle<T> {262		&mut self.0263	}264}265266impl<T: Config> Deref for RefungibleHandle<T> {267	type Target = pallet_common::CollectionHandle<T>;268269	fn deref(&self) -> &Self::Target {270		&self.0271	}272}273274impl<T: Config> WithRecorder<T> for RefungibleHandle<T> {275	fn recorder(&self) -> &pallet_evm_coder_substrate::SubstrateRecorder<T> {276		self.0.recorder()277	}278	fn into_recorder(self) -> pallet_evm_coder_substrate::SubstrateRecorder<T> {279		self.0.into_recorder()280	}281}282283impl<T: Config> Pallet<T> {284	/// Get number of RFT tokens in collection285	pub fn total_supply(collection: &RefungibleHandle<T>) -> u32 {286		<TokensMinted<T>>::get(collection.id) - <TokensBurnt<T>>::get(collection.id)287	}288289	/// Check that RFT token exists290	///291	/// - `token`: Token ID.292	pub fn token_exists(collection: &RefungibleHandle<T>, token: TokenId) -> bool {293		<TotalSupply<T>>::contains_key((collection.id, token))294	}295}296297// unchecked calls skips any permission checks298impl<T: Config> Pallet<T> {299	/// Create RFT collection300	///301	/// `init_collection` will take non-refundable deposit for collection creation.302	///303	/// - `data`: Contains settings for collection limits and permissions.304	pub fn init_collection(305		owner: T::CrossAccountId,306		payer: T::CrossAccountId,307		data: CreateCollectionData<T::CrossAccountId>,308	) -> Result<CollectionId, DispatchError> {309		<PalletCommon<T>>::init_collection(owner, payer, data)310	}311312	/// Destroy RFT collection313	///314	/// `destroy_collection` will throw error if collection contains any tokens.315	/// Only owner can destroy collection.316	pub fn destroy_collection(317		collection: RefungibleHandle<T>,318		sender: &T::CrossAccountId,319	) -> DispatchResult {320		let id = collection.id;321322		if Self::collection_has_tokens(id) {323			return Err(<CommonError<T>>::CantDestroyNotEmptyCollection.into());324		}325326		// =========327328		PalletCommon::destroy_collection(collection.0, sender)?;329330		<TokensMinted<T>>::remove(id);331		<TokensBurnt<T>>::remove(id);332		let _ = <TotalSupply<T>>::clear_prefix((id,), u32::MAX, None);333		let _ = <Balance<T>>::clear_prefix((id,), u32::MAX, None);334		let _ = <Allowance<T>>::clear_prefix((id,), u32::MAX, None);335		let _ = <Owned<T>>::clear_prefix((id,), u32::MAX, None);336		let _ = <AccountBalance<T>>::clear_prefix((id,), u32::MAX, None);337		Ok(())338	}339340	fn collection_has_tokens(collection_id: CollectionId) -> bool {341		<TotalSupply<T>>::iter_prefix((collection_id,))342			.next()343			.is_some()344	}345346	pub fn burn_token_unchecked(347		collection: &RefungibleHandle<T>,348		owner: &T::CrossAccountId,349		token_id: TokenId,350	) -> DispatchResult {351		let burnt = <TokensBurnt<T>>::get(collection.id)352			.checked_add(1)353			.ok_or(ArithmeticError::Overflow)?;354355		<TokensBurnt<T>>::insert(collection.id, burnt);356		<TokenProperties<T>>::remove((collection.id, token_id));357		<TotalSupply<T>>::remove((collection.id, token_id));358		let _ = <Balance<T>>::clear_prefix((collection.id, token_id), u32::MAX, None);359		let _ = <Allowance<T>>::clear_prefix((collection.id, token_id), u32::MAX, None);360		<PalletEvm<T>>::deposit_log(361			ERC721Events::Transfer {362				from: *owner.as_eth(),363				to: H160::default(),364				token_id: token_id.into(),365			}366			.to_log(collection_id_to_address(collection.id)),367		);368		Ok(())369	}370371	/// Burn RFT token pieces372	///373	/// `burn` will decrease total amount of token pieces and amount owned by sender.374	/// `burn` can be called even if there are multiple owners of the RFT token.375	/// If sender wouldn't have any pieces left after `burn` than she will stop being376	/// one of the owners of the token. If there is no account that owns any pieces of377	/// the token than token will be burned too.378	///379	/// - `amount`: Amount of token pieces to burn.380	/// - `token`: Token who's pieces should be burned381	/// - `collection`: Collection that contains the token382	pub fn burn(383		collection: &RefungibleHandle<T>,384		owner: &T::CrossAccountId,385		token: TokenId,386		amount: u128,387	) -> DispatchResult {388		if <Balance<T>>::get((collection.id, token, owner)) == 0 {389			return Err(<CommonError<T>>::TokenValueTooLow.into());390		}391392		let total_supply = <TotalSupply<T>>::get((collection.id, token))393			.checked_sub(amount)394			.ok_or(<CommonError<T>>::TokenValueTooLow)?;395396		// This was probally last owner of this token?397		if total_supply == 0 {398			// Ensure user actually owns this amount399			ensure!(400				<Balance<T>>::get((collection.id, token, owner)) == amount,401				<CommonError<T>>::TokenValueTooLow402			);403			let account_balance = <AccountBalance<T>>::get((collection.id, owner))404				.checked_sub(1)405				// Should not occur406				.ok_or(ArithmeticError::Underflow)?;407408			// =========409410			<Owned<T>>::remove((collection.id, owner, token));411			<PalletStructure<T>>::unnest_if_nested(owner, collection.id, token);412			<AccountBalance<T>>::insert((collection.id, owner), account_balance);413			Self::burn_token_unchecked(collection, owner, token)?;414			<PalletEvm<T>>::deposit_log(415				ERC20Events::Transfer {416					from: *owner.as_eth(),417					to: H160::default(),418					value: amount.into(),419				}420				.to_log(collection_id_to_address(collection.id)),421			);422			<PalletCommon<T>>::deposit_event(CommonEvent::ItemDestroyed(423				collection.id,424				token,425				owner.clone(),426				amount,427			));428			return Ok(());429		}430431		let balance = <Balance<T>>::get((collection.id, token, owner))432			.checked_sub(amount)433			.ok_or(<CommonError<T>>::TokenValueTooLow)?;434		let account_balance = if balance == 0 {435			<AccountBalance<T>>::get((collection.id, owner))436				.checked_sub(1)437				// Should not occur438				.ok_or(ArithmeticError::Underflow)?439		} else {440			0441		};442443		// =========444445		if balance == 0 {446			<Owned<T>>::remove((collection.id, owner, token));447			<PalletStructure<T>>::unnest_if_nested(owner, collection.id, token);448			<Balance<T>>::remove((collection.id, token, owner));449			<AccountBalance<T>>::insert((collection.id, owner), account_balance);450451			if let Ok(user) = Self::token_owner(collection.id, token) {452				<PalletEvm<T>>::deposit_log(453					ERC721Events::Transfer {454						from: erc::ADDRESS_FOR_PARTIALLY_OWNED_TOKENS,455						to: *user.as_eth(),456						token_id: token.into(),457					}458					.to_log(collection_id_to_address(collection.id)),459				);460			}461		} else {462			<Balance<T>>::insert((collection.id, token, owner), balance);463		}464		<TotalSupply<T>>::insert((collection.id, token), total_supply);465466		<PalletEvm<T>>::deposit_log(467			ERC20Events::Transfer {468				from: *owner.as_eth(),469				to: H160::default(),470				value: amount.into(),471			}472			.to_log(T::EvmTokenAddressMapping::token_to_address(473				collection.id,474				token,475			)),476		);477		<PalletCommon<T>>::deposit_event(CommonEvent::ItemDestroyed(478			collection.id,479			token,480			owner.clone(),481			amount,482		));483		Ok(())484	}485486	/// A batch operation to add, edit or remove properties for a token.487	/// It sets or removes a token's properties according to488	/// `properties_updates` contents:489	/// * sets a property under the <key> with the value provided `(<key>, Some(<value>))`490	/// * removes a property under the <key> if the value is `None` `(<key>, None)`.491	///492	/// - `nesting_budget`: Limit for searching parents in-depth to check ownership.493	///494	/// All affected properties should have `mutable` permission495	/// to be **deleted** or to be **set more than once**,496	/// and the sender should have permission to edit those properties.497	///498	/// This function fires an event for each property change.499	/// In case of an error, all the changes (including the events) will be reverted500	/// since the function is transactional.501	#[transactional]502	fn modify_token_properties(503		collection: &RefungibleHandle<T>,504		sender: &T::CrossAccountId,505		token_id: TokenId,506		properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,507		nesting_budget: &dyn Budget,508	) -> DispatchResult {509		let mut property_writer =510			pallet_common::ExistingTokenPropertyWriter::new(collection, sender);511512		property_writer.write_token_properties(513			sender,514			token_id,515			properties_updates,516			nesting_budget,517			erc::ERC721TokenEvent::TokenChanged {518				token_id: token_id.into(),519			}520			.to_log(T::ContractAddress::get()),521		)522	}523524	pub fn next_token_id(collection: &RefungibleHandle<T>) -> Result<TokenId, DispatchError> {525		let next_token_id = <TokensMinted<T>>::get(collection.id)526			.checked_add(1)527			.ok_or(<CommonError<T>>::CollectionTokenLimitExceeded)?;528529		ensure!(530			collection.limits.token_limit() >= next_token_id,531			<CommonError<T>>::CollectionTokenLimitExceeded532		);533534		Ok(TokenId(next_token_id))535	}536537	pub fn set_token_properties(538		collection: &RefungibleHandle<T>,539		sender: &T::CrossAccountId,540		token_id: TokenId,541		properties: impl Iterator<Item = Property>,542		nesting_budget: &dyn Budget,543	) -> DispatchResult {544		Self::modify_token_properties(545			collection,546			sender,547			token_id,548			properties.map(|p| (p.key, Some(p.value))),549			nesting_budget,550		)551	}552553	pub fn set_token_property(554		collection: &RefungibleHandle<T>,555		sender: &T::CrossAccountId,556		token_id: TokenId,557		property: Property,558		nesting_budget: &dyn Budget,559	) -> DispatchResult {560		Self::set_token_properties(561			collection,562			sender,563			token_id,564			[property].into_iter(),565			nesting_budget,566		)567	}568569	pub fn delete_token_properties(570		collection: &RefungibleHandle<T>,571		sender: &T::CrossAccountId,572		token_id: TokenId,573		property_keys: impl Iterator<Item = PropertyKey>,574		nesting_budget: &dyn Budget,575	) -> DispatchResult {576		Self::modify_token_properties(577			collection,578			sender,579			token_id,580			property_keys.into_iter().map(|key| (key, None)),581			nesting_budget,582		)583	}584585	pub fn delete_token_property(586		collection: &RefungibleHandle<T>,587		sender: &T::CrossAccountId,588		token_id: TokenId,589		property_key: PropertyKey,590		nesting_budget: &dyn Budget,591	) -> DispatchResult {592		Self::delete_token_properties(593			collection,594			sender,595			token_id,596			[property_key].into_iter(),597			nesting_budget,598		)599	}600601	/// Transfer RFT token pieces from one account to another.602	///603	/// If the sender is no longer owns any pieces after the `transfer` than she stops being an owner of the token.604	///605	/// - `from`: Owner of token pieces to transfer.606	/// - `to`: Recepient of transfered token pieces.607	/// - `amount`: Amount of token pieces to transfer.608	/// - `token`: Token whos pieces should be transfered609	/// - `collection`: Collection that contains the token610	pub fn transfer(611		collection: &RefungibleHandle<T>,612		from: &T::CrossAccountId,613		to: &T::CrossAccountId,614		token: TokenId,615		amount: u128,616		nesting_budget: &dyn Budget,617	) -> DispatchResult {618		ensure!(619			collection.limits.transfers_enabled(),620			<CommonError<T>>::TransferNotAllowed621		);622623		if collection.permissions.access() == AccessMode::AllowList {624			collection.check_allowlist(from)?;625			collection.check_allowlist(to)?;626		}627		<PalletCommon<T>>::ensure_correct_receiver(to)?;628629		let initial_balance_from = <Balance<T>>::get((collection.id, token, from));630631		if initial_balance_from == 0 {632			return Err(<CommonError<T>>::TokenValueTooLow.into());633		}634635		let updated_balance_from = initial_balance_from636			.checked_sub(amount)637			.ok_or(<CommonError<T>>::TokenValueTooLow)?;638		let mut create_target = false;639		let from_to_differ = from != to;640		let updated_balance_to = if from != to && amount != 0 {641			let old_balance = <Balance<T>>::get((collection.id, token, to));642			if old_balance == 0 {643				create_target = true;644			}645			Some(646				old_balance647					.checked_add(amount)648					.ok_or(ArithmeticError::Overflow)?,649			)650		} else {651			None652		};653654		let account_balance_from = if updated_balance_from == 0 {655			Some(656				<AccountBalance<T>>::get((collection.id, from))657					.checked_sub(1)658					// Should not occur659					.ok_or(ArithmeticError::Underflow)?,660			)661		} else {662			None663		};664		// Account data is created in token, AccountBalance should be increased665		// But only if from != to as we shouldn't check overflow in this case666		let account_balance_to = if create_target && from_to_differ {667			let account_balance_to = <AccountBalance<T>>::get((collection.id, to))668				.checked_add(1)669				.ok_or(ArithmeticError::Overflow)?;670			ensure!(671				account_balance_to < collection.limits.account_token_ownership_limit(),672				<CommonError<T>>::AccountTokenLimitExceeded,673			);674675			Some(account_balance_to)676		} else {677			None678		};679680		// =========681682		if let Some(updated_balance_to) = updated_balance_to {683			// from != to && amount != 0684685			<PalletStructure<T>>::nest_if_sent_to_token(686				from.clone(),687				to,688				collection.id,689				token,690				nesting_budget,691			)?;692693			if updated_balance_from == 0 {694				<Balance<T>>::remove((collection.id, token, from));695				<PalletStructure<T>>::unnest_if_nested(from, collection.id, token);696			} else {697				<Balance<T>>::insert((collection.id, token, from), updated_balance_from);698			}699			<Balance<T>>::insert((collection.id, token, to), updated_balance_to);700			if let Some(account_balance_from) = account_balance_from {701				<AccountBalance<T>>::insert((collection.id, from), account_balance_from);702				<Owned<T>>::remove((collection.id, from, token));703			}704			if let Some(account_balance_to) = account_balance_to {705				<AccountBalance<T>>::insert((collection.id, to), account_balance_to);706				<Owned<T>>::insert((collection.id, to, token), true);707			}708		}709710		<PalletEvm<T>>::deposit_log(711			ERC20Events::Transfer {712				from: *from.as_eth(),713				to: *to.as_eth(),714				value: amount.into(),715			}716			.to_log(T::EvmTokenAddressMapping::token_to_address(717				collection.id,718				token,719			)),720		);721722		<PalletCommon<T>>::deposit_event(CommonEvent::Transfer(723			collection.id,724			token,725			from.clone(),726			to.clone(),727			amount,728		));729730		let total_supply = <TotalSupply<T>>::get((collection.id, token));731732		if amount == total_supply {733			// if token was fully owned by `from` and will be fully owned by `to` after transfer734			<PalletEvm<T>>::deposit_log(735				ERC721Events::Transfer {736					from: *from.as_eth(),737					to: *to.as_eth(),738					token_id: token.into(),739				}740				.to_log(collection_id_to_address(collection.id)),741			);742		} else if let Some(updated_balance_to) = updated_balance_to {743			// if `from` not equals `to`. This condition is needed to avoid sending event744			// when `from` fully owns token and sends part of token pieces to itself.745			if initial_balance_from == total_supply {746				// if token was fully owned by `from` and will be only partially owned by `to`747				// and `from` after transfer748				<PalletEvm<T>>::deposit_log(749					ERC721Events::Transfer {750						from: *from.as_eth(),751						to: erc::ADDRESS_FOR_PARTIALLY_OWNED_TOKENS,752						token_id: token.into(),753					}754					.to_log(collection_id_to_address(collection.id)),755				);756			} else if updated_balance_to == total_supply {757				// if token was partially owned by `from` and will be fully owned by `to` after transfer758				<PalletEvm<T>>::deposit_log(759					ERC721Events::Transfer {760						from: erc::ADDRESS_FOR_PARTIALLY_OWNED_TOKENS,761						to: *to.as_eth(),762						token_id: token.into(),763					}764					.to_log(collection_id_to_address(collection.id)),765				);766			}767		}768769		Ok(())770	}771772	/// Batched operation to create multiple RFT tokens.773	///774	/// Same as `create_item` but creates multiple tokens.775	///776	/// - `data`: Same as 'data` in `create_item` but contains data for multiple tokens.777	pub fn create_multiple_items(778		collection: &RefungibleHandle<T>,779		sender: &T::CrossAccountId,780		data: Vec<CreateItemData<T>>,781		nesting_budget: &dyn Budget,782	) -> DispatchResult {783		if !collection.is_owner_or_admin(sender) {784			ensure!(785				collection.permissions.mint_mode(),786				<CommonError<T>>::PublicMintingNotAllowed787			);788			collection.check_allowlist(sender)?;789790			for item in data.iter() {791				for user in item.users.keys() {792					collection.check_allowlist(user)?;793				}794			}795		}796797		for item in data.iter() {798			for (owner, _) in item.users.iter() {799				<PalletCommon<T>>::ensure_correct_receiver(owner)?;800			}801		}802803		// Total pieces per tokens804		let totals = data805			.iter()806			.map(|data| {807				Ok(data808					.users809					.iter()810					.map(|u| u.1)811					.try_fold(0u128, |acc, v| acc.checked_add(*v))812					.ok_or(ArithmeticError::Overflow)?)813			})814			.collect::<Result<Vec<_>, DispatchError>>()?;815		for total in &totals {816			ensure!(817				*total <= MAX_REFUNGIBLE_PIECES,818				<Error<T>>::WrongRefungiblePieces819			);820		}821822		let first_token_id = <TokensMinted<T>>::get(collection.id);823		let tokens_minted = first_token_id824			.checked_add(data.len() as u32)825			.ok_or(ArithmeticError::Overflow)?;826		ensure!(827			tokens_minted < collection.limits.token_limit(),828			<CommonError<T>>::CollectionTokenLimitExceeded829		);830831		let mut balances = BTreeMap::new();832		for data in &data {833			for owner in data.users.keys() {834				let balance = balances835					.entry(owner)836					.or_insert_with(|| <AccountBalance<T>>::get((collection.id, owner)));837				*balance = balance.checked_add(1).ok_or(ArithmeticError::Overflow)?;838839				ensure!(840					*balance <= collection.limits.account_token_ownership_limit(),841					<CommonError<T>>::AccountTokenLimitExceeded,842				);843			}844		}845846		for (i, token) in data.iter().enumerate() {847			let token_id = TokenId(first_token_id + i as u32 + 1);848			for (to, _) in token.users.iter() {849				<PalletStructure<T>>::check_nesting(850					sender.clone(),851					to,852					collection.id,853					token_id,854					nesting_budget,855				)?;856			}857		}858859		// =========860861		let mut property_writer = pallet_common::NewTokenPropertyWriter::new(collection, sender);862863		with_transaction(|| {864			for (i, data) in data.iter().enumerate() {865				let token_id = first_token_id + i as u32 + 1;866				<TotalSupply<T>>::insert((collection.id, token_id), totals[i]);867868				let token = TokenId(token_id);869870				let mut mint_target_is_sender = true;871				for (user, amount) in data.users.iter() {872					if *amount == 0 {873						continue;874					}875876					mint_target_is_sender = mint_target_is_sender && sender.conv_eq(user);877878					<Balance<T>>::insert((collection.id, token_id, &user), amount);879					<Owned<T>>::insert((collection.id, &user, token), true);880					<PalletStructure<T>>::nest_if_sent_to_token_unchecked(881						user,882						collection.id,883						token,884					);885				}886887				if let Err(e) = property_writer.write_token_properties(888					mint_target_is_sender,889					token,890					data.properties.clone().into_iter(),891					erc::ERC721TokenEvent::TokenChanged {892						token_id: token.into(),893					}894					.to_log(T::ContractAddress::get()),895				) {896					return TransactionOutcome::Rollback(Err(e));897				}898			}899			TransactionOutcome::Commit(Ok(()))900		})?;901902		<TokensMinted<T>>::insert(collection.id, tokens_minted);903904		for (account, balance) in balances {905			<AccountBalance<T>>::insert((collection.id, account), balance);906		}907908		for (i, token) in data.into_iter().enumerate() {909			let token_id = first_token_id + i as u32 + 1;910911			let receivers = token912				.users913				.into_iter()914				.filter(|(_, amount)| *amount > 0)915				.collect::<Vec<_>>();916917			if let [(user, _)] = receivers.as_slice() {918				// if there is exactly one receiver919				<PalletEvm<T>>::deposit_log(920					ERC721Events::Transfer {921						from: H160::default(),922						to: *user.as_eth(),923						token_id: token_id.into(),924					}925					.to_log(collection_id_to_address(collection.id)),926				);927			} else if let [_, ..] = receivers.as_slice() {928				// if there is more than one receiver929				<PalletEvm<T>>::deposit_log(930					ERC721Events::Transfer {931						from: H160::default(),932						to: erc::ADDRESS_FOR_PARTIALLY_OWNED_TOKENS,933						token_id: token_id.into(),934					}935					.to_log(collection_id_to_address(collection.id)),936				);937			}938939			for (user, amount) in receivers.into_iter() {940				<PalletEvm<T>>::deposit_log(941					ERC20Events::Transfer {942						from: H160::default(),943						to: *user.as_eth(),944						value: amount.into(),945					}946					.to_log(T::EvmTokenAddressMapping::token_to_address(947						collection.id,948						TokenId(token_id),949					)),950				);951				<PalletCommon<T>>::deposit_event(CommonEvent::ItemCreated(952					collection.id,953					TokenId(token_id),954					user,955					amount,956				));957			}958		}959		Ok(())960	}961962	pub fn set_allowance_unchecked(963		collection: &RefungibleHandle<T>,964		sender: &T::CrossAccountId,965		spender: &T::CrossAccountId,966		token: TokenId,967		amount: u128,968	) {969		if amount == 0 {970			<Allowance<T>>::remove((collection.id, token, sender, spender));971		} else {972			<Allowance<T>>::insert((collection.id, token, sender, spender), amount);973		}974975		<PalletEvm<T>>::deposit_log(976			ERC20Events::Approval {977				owner: *sender.as_eth(),978				spender: *spender.as_eth(),979				value: amount.into(),980			}981			.to_log(T::EvmTokenAddressMapping::token_to_address(982				collection.id,983				token,984			)),985		);986		<PalletCommon<T>>::deposit_event(CommonEvent::Approved(987			collection.id,988			token,989			sender.clone(),990			spender.clone(),991			amount,992		))993	}994995	/// Set allowance for the spender to `transfer` or `burn` sender's token pieces.996	///997	/// - `amount`: Amount of token pieces the spender is allowed to `transfer` or `burn.998	pub fn set_allowance(999		collection: &RefungibleHandle<T>,1000		sender: &T::CrossAccountId,1001		spender: &T::CrossAccountId,1002		token: TokenId,1003		amount: u128,1004	) -> DispatchResult {1005		if collection.permissions.access() == AccessMode::AllowList {1006			collection.check_allowlist(sender)?;1007			collection.check_allowlist(spender)?;1008		}10091010		<PalletCommon<T>>::ensure_correct_receiver(spender)?;10111012		if <Balance<T>>::get((collection.id, token, sender)) < amount {1013			ensure!(1014				collection.ignores_owned_amount(sender) && Self::token_exists(collection, token),1015				<CommonError<T>>::CantApproveMoreThanOwned1016			);1017		}10181019		// =========10201021		Self::set_allowance_unchecked(collection, sender, spender, token, amount);1022		Ok(())1023	}10241025	/// Set allowance to spend from sender's eth mirror1026	///1027	/// - `from`: Address of sender's eth mirror.1028	/// - `to`: Adress of spender.1029	/// - `amount`: Amount of token pieces the spender is allowed to `transfer` or `burn.1030	pub fn set_allowance_from(1031		collection: &RefungibleHandle<T>,1032		sender: &T::CrossAccountId,1033		from: &T::CrossAccountId,1034		to: &T::CrossAccountId,1035		token_id: TokenId,1036		amount: u128,1037	) -> DispatchResult {1038		if collection.permissions.access() == AccessMode::AllowList {1039			collection.check_allowlist(sender)?;1040			collection.check_allowlist(from)?;1041			collection.check_allowlist(to)?;1042		}10431044		<PalletCommon<T>>::ensure_correct_receiver(to)?;10451046		ensure!(1047			sender.conv_eq(from),1048			<CommonError<T>>::AddressIsNotEthMirror1049		);10501051		if <Balance<T>>::get((collection.id, token_id, from)) < amount {1052			ensure!(1053				collection.limits.owner_can_transfer()1054					&& (collection.is_owner_or_admin(sender) || collection.is_owner_or_admin(from))1055					&& Self::token_exists(collection, token_id),1056				<CommonError<T>>::CantApproveMoreThanOwned1057			);1058		}10591060		// =========10611062		Self::set_allowance_unchecked(collection, from, to, token_id, amount);1063		Ok(())1064	}10651066	/// Returns allowance, which should be set after transaction1067	fn check_allowed(1068		collection: &RefungibleHandle<T>,1069		spender: &T::CrossAccountId,1070		from: &T::CrossAccountId,1071		token: TokenId,1072		amount: u128,1073		nesting_budget: &dyn Budget,1074	) -> Result<Option<u128>, DispatchError> {1075		if spender.conv_eq(from) {1076			return Ok(None);1077		}1078		if collection.permissions.access() == AccessMode::AllowList {1079			// `from`, `to` checked in [`transfer`]1080			collection.check_allowlist(spender)?;1081		}10821083		if collection.ignores_token_restrictions(spender) {1084			return Ok(Self::compute_allowance_decrease(1085				collection, token, from, spender, amount,1086			));1087		}10881089		if let Some(source) = T::CrossTokenAddressMapping::address_to_token(from) {1090			// TODO: should collection owner be allowed to perform this transfer?1091			ensure!(1092				<PalletStructure<T>>::check_indirectly_owned(1093					spender.clone(),1094					source.0,1095					source.1,1096					None,1097					nesting_budget1098				)?,1099				<CommonError<T>>::ApprovedValueTooLow,1100			);1101			return Ok(None);1102		}11031104		let allowance = Self::compute_allowance_decrease(collection, token, from, spender, amount);1105		if allowance.is_some() {1106			return Ok(allowance);1107		}11081109		// Allowance (if any) would be reduced if spender is also wallet operator1110		if <CollectionAllowance<T>>::get((collection.id, from, spender)) {1111			return Ok(allowance);1112		}11131114		Err(<CommonError<T>>::ApprovedValueTooLow.into())1115	}11161117	/// Returns `Some(amount)` if the `spender` have allowance to spend this amount.1118	/// Otherwise, it returns `None`.1119	fn compute_allowance_decrease(1120		collection: &RefungibleHandle<T>,1121		token: TokenId,1122		from: &T::CrossAccountId,1123		spender: &T::CrossAccountId,1124		amount: u128,1125	) -> Option<u128> {1126		<Allowance<T>>::get((collection.id, token, from, spender)).checked_sub(amount)1127	}11281129	/// Transfer RFT token pieces from one account to another.1130	///1131	/// Same as the [`transfer`] but spender doesn't needs to be an owner of the token pieces.1132	/// The owner should set allowance for the spender to transfer pieces.1133	///1134	/// [`transfer`]: struct.Pallet.html#method.transfer1135	pub fn transfer_from(1136		collection: &RefungibleHandle<T>,1137		spender: &T::CrossAccountId,1138		from: &T::CrossAccountId,1139		to: &T::CrossAccountId,1140		token: TokenId,1141		amount: u128,1142		nesting_budget: &dyn Budget,1143	) -> DispatchResult {1144		let allowance =1145			Self::check_allowed(collection, spender, from, token, amount, nesting_budget)?;11461147		// =========11481149		Self::transfer(collection, from, to, token, amount, nesting_budget)?;1150		if let Some(allowance) = allowance {1151			Self::set_allowance_unchecked(collection, from, spender, token, allowance);1152		}1153		Ok(())1154	}11551156	/// Burn RFT token pieces from the account.1157	///1158	/// Same as the [`burn`] but spender doesn't need to be an owner of the token pieces. The owner should1159	/// set allowance for the spender to burn pieces1160	///1161	/// [`burn`]: struct.Pallet.html#method.burn1162	pub fn burn_from(1163		collection: &RefungibleHandle<T>,1164		spender: &T::CrossAccountId,1165		from: &T::CrossAccountId,1166		token: TokenId,1167		amount: u128,1168		nesting_budget: &dyn Budget,1169	) -> DispatchResult {1170		let allowance =1171			Self::check_allowed(collection, spender, from, token, amount, nesting_budget)?;11721173		// =========11741175		Self::burn(collection, from, token, amount)?;1176		if let Some(allowance) = allowance {1177			Self::set_allowance_unchecked(collection, from, spender, token, allowance);1178		}1179		Ok(())1180	}11811182	/// Create RFT token.1183	///1184	/// The sender should be the owner/admin of the collection or collection should be configured1185	/// to allow public minting.1186	///1187	/// - `data`: Contains list of users who will become the owners of the token pieces and amount1188	///   of token pieces they will receive.1189	pub fn create_item(1190		collection: &RefungibleHandle<T>,1191		sender: &T::CrossAccountId,1192		data: CreateItemData<T>,1193		nesting_budget: &dyn Budget,1194	) -> DispatchResult {1195		Self::create_multiple_items(collection, sender, vec![data], nesting_budget)1196	}11971198	/// Repartition RFT token.1199	///1200	/// `repartition` will set token balance of the sender and total amount of token pieces.1201	/// Sender should own all of the token pieces. `repartition' could be done even if some1202	/// token pieces were burned before.1203	///1204	/// - `amount`: Total amount of token pieces that the token will have after `repartition`.1205	pub fn repartition(1206		collection: &RefungibleHandle<T>,1207		owner: &T::CrossAccountId,1208		token: TokenId,1209		amount: u128,1210	) -> DispatchResult {1211		ensure!(1212			amount <= MAX_REFUNGIBLE_PIECES,1213			<Error<T>>::WrongRefungiblePieces1214		);1215		ensure!(amount > 0, <CommonError<T>>::TokenValueTooLow);1216		// Ensure user owns all pieces1217		let total_pieces = Self::total_pieces(collection.id, token).unwrap_or(u128::MAX);1218		let balance = <Balance<T>>::get((collection.id, token, owner));1219		ensure!(1220			total_pieces == balance,1221			<Error<T>>::RepartitionWhileNotOwningAllPieces1222		);12231224		<Balance<T>>::insert((collection.id, token, owner), amount);1225		<TotalSupply<T>>::insert((collection.id, token), amount);12261227		match total_pieces.cmp(&amount) {1228			Ordering::Less => {1229				let mint_amount = amount - total_pieces;1230				<PalletEvm<T>>::deposit_log(1231					ERC20Events::Transfer {1232						from: H160::default(),1233						to: *owner.as_eth(),1234						value: mint_amount.into(),1235					}1236					.to_log(T::EvmTokenAddressMapping::token_to_address(1237						collection.id,1238						token,1239					)),1240				);1241				<PalletCommon<T>>::deposit_event(CommonEvent::ItemCreated(1242					collection.id,1243					token,1244					owner.clone(),1245					mint_amount,1246				));1247			}1248			Ordering::Greater => {1249				let burn_amount = total_pieces - amount;1250				<PalletEvm<T>>::deposit_log(1251					ERC20Events::Transfer {1252						from: *owner.as_eth(),1253						to: H160::default(),1254						value: burn_amount.into(),1255					}1256					.to_log(T::EvmTokenAddressMapping::token_to_address(1257						collection.id,1258						token,1259					)),1260				);1261				<PalletCommon<T>>::deposit_event(CommonEvent::ItemDestroyed(1262					collection.id,1263					token,1264					owner.clone(),1265					burn_amount,1266				));1267			}1268			Ordering::Equal => {}1269		}12701271		Ok(())1272	}12731274	fn token_owner(1275		collection_id: CollectionId,1276		token_id: TokenId,1277	) -> Result<T::CrossAccountId, TokenOwnerError> {1278		let mut owner = None;1279		let mut count = 0;1280		for key in Balance::<T>::iter_key_prefix((collection_id, token_id)) {1281			count += 1;1282			if count > 1 {1283				return Err(TokenOwnerError::MultipleOwners);1284			}1285			owner = Some(key);1286		}1287		owner.ok_or(TokenOwnerError::NotFound)1288	}12891290	fn total_pieces(collection_id: CollectionId, token_id: TokenId) -> Option<u128> {1291		<TotalSupply<T>>::try_get((collection_id, token_id)).ok()1292	}12931294	pub fn set_collection_properties(1295		collection: &RefungibleHandle<T>,1296		sender: &T::CrossAccountId,1297		properties: Vec<Property>,1298	) -> DispatchResult {1299		<PalletCommon<T>>::set_collection_properties(collection, sender, properties.into_iter())1300	}13011302	pub fn delete_collection_properties(1303		collection: &RefungibleHandle<T>,1304		sender: &T::CrossAccountId,1305		property_keys: Vec<PropertyKey>,1306	) -> DispatchResult {1307		<PalletCommon<T>>::delete_collection_properties(1308			collection,1309			sender,1310			property_keys.into_iter(),1311		)1312	}13131314	pub fn set_token_property_permissions(1315		collection: &RefungibleHandle<T>,1316		sender: &T::CrossAccountId,1317		property_permissions: Vec<PropertyKeyPermission>,1318	) -> DispatchResult {1319		<PalletCommon<T>>::set_token_property_permissions(collection, sender, property_permissions)1320	}13211322	pub fn token_property_permission(collection_id: CollectionId) -> PropertiesPermissionMap {1323		<PalletCommon<T>>::property_permissions(collection_id)1324	}13251326	pub fn set_scoped_token_property_permissions(1327		collection: &RefungibleHandle<T>,1328		sender: &T::CrossAccountId,1329		scope: PropertyScope,1330		property_permissions: Vec<PropertyKeyPermission>,1331	) -> DispatchResult {1332		<PalletCommon<T>>::set_scoped_token_property_permissions(1333			collection,1334			sender,1335			scope,1336			property_permissions,1337		)1338	}13391340	/// Returns 10 token in no particular order.1341	///1342	/// There is no direct way to get token holders in ascending order,1343	/// since `iter_prefix` returns values in no particular order.1344	/// Therefore, getting the 10 largest holders with a large value of holders1345	/// can lead to impact memory allocation + sorting with  `n * log (n)`.1346	pub fn token_owners(1347		collection_id: CollectionId,1348		token: TokenId,1349	) -> Option<Vec<T::CrossAccountId>> {1350		let res: Vec<T::CrossAccountId> = <Balance<T>>::iter_prefix((collection_id, token))1351			.map(|(owner, _amount)| owner)1352			.take(10)1353			.collect();13541355		if res.is_empty() {1356			None1357		} else {1358			Some(res)1359		}1360	}13611362	/// Sets or unsets the approval of a given operator.1363	///1364	/// The `operator` is allowed to transfer all token pieces of the `owner` on their behalf.1365	/// - `owner`: Token owner1366	/// - `operator`: Operator1367	/// - `approve`: Should operator status be granted or revoked?1368	pub fn set_allowance_for_all(1369		collection: &RefungibleHandle<T>,1370		owner: &T::CrossAccountId,1371		spender: &T::CrossAccountId,1372		approve: bool,1373	) -> DispatchResult {1374		<PalletCommon<T>>::set_allowance_for_all(1375			collection,1376			owner,1377			spender,1378			approve,1379			|| <CollectionAllowance<T>>::insert((collection.id, owner, spender), approve),1380			ERC721Events::ApprovalForAll {1381				owner: *owner.as_eth(),1382				operator: *spender.as_eth(),1383				approved: approve,1384			}1385			.to_log(collection_id_to_address(collection.id)),1386		)1387	}13881389	/// Tells whether the given `owner` approves the `operator`.1390	pub fn allowance_for_all(1391		collection: &RefungibleHandle<T>,1392		owner: &T::CrossAccountId,1393		spender: &T::CrossAccountId,1394	) -> bool {1395		<CollectionAllowance<T>>::get((collection.id, owner, spender))1396	}13971398	pub fn repair_item(collection: &RefungibleHandle<T>, token: TokenId) -> DispatchResult {1399		<TokenProperties<T>>::mutate((collection.id, token), |properties| {1400			if let Some(properties) = properties {1401				properties.recompute_consumed_space();1402			}1403		});14041405		Ok(())1406	}1407}
modifiedpallets/refungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/refungible/src/weights.rs
+++ b/pallets/refungible/src/weights.rs
@@ -3,13 +3,13 @@
 //! Autogenerated weights for pallet_refungible
 //!
 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-09-30, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-10-13, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
 //! WORST CASE MAP SIZE: `1000000`
-//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
-//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
+//! HOSTNAME: `hearthstone`, CPU: `AMD Ryzen 9 7950X3D 16-Core Processor`
+//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
 
 // Executed Command:
-// target/production/unique-collator
+// ./target/production/unique-collator
 // benchmark
 // pallet
 // --pallet
@@ -20,7 +20,7 @@
 // *
 // --template=.maintain/frame-weight-template.hbs
 // --steps=50
-// --repeat=400
+// --repeat=80
 // --heap-pages=4096
 // --output=./pallets/refungible/src/weights.rs
 
@@ -50,12 +50,10 @@
 	fn transfer_from_removing() -> Weight;
 	fn transfer_from_creating_removing() -> Weight;
 	fn burn_from() -> Weight;
+	fn load_token_properties() -> Weight;
+	fn write_token_properties(b: u32, ) -> Weight;
 	fn set_token_property_permissions(b: u32, ) -> Weight;
-	fn set_token_properties(b: u32, ) -> Weight;
-	fn init_token_properties(b: u32, ) -> Weight;
-	fn delete_token_properties(b: u32, ) -> Weight;
 	fn repartition_item() -> Weight;
-	fn token_owner() -> Weight;
 	fn set_allowance_for_all() -> Weight;
 	fn allowance_for_all() -> Weight;
 	fn repair_item() -> Weight;
@@ -64,435 +62,399 @@
 /// Weights for pallet_refungible using the Substrate node and recommended hardware.
 pub struct SubstrateWeight<T>(PhantomData<T>);
 impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
-	/// Storage: Refungible TokensMinted (r:1 w:1)
-	/// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:0 w:1)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:0 w:1)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:1)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::TokensMinted` (r:1 w:1)
+	/// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:0 w:1)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:0 w:1)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:1)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn create_item() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `4`
 		//  Estimated: `3530`
-		// Minimum execution time: 11_341_000 picoseconds.
-		Weight::from_parts(11_741_000, 3530)
+		// Minimum execution time: 19_400_000 picoseconds.
+		Weight::from_parts(19_890_000, 3530)
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 			.saturating_add(T::DbWeight::get().writes(5_u64))
 	}
-	/// Storage: Refungible TokensMinted (r:1 w:1)
-	/// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:0 w:200)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:0 w:200)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:200)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::TokensMinted` (r:1 w:1)
+	/// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:0 w:200)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:0 w:200)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:200)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 200]`.
 	fn create_multiple_items(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `4`
 		//  Estimated: `3530`
-		// Minimum execution time: 2_665_000 picoseconds.
-		Weight::from_parts(2_791_000, 3530)
-			// Standard Error: 996
-			.saturating_add(Weight::from_parts(4_343_736, 0).saturating_mul(b.into()))
+		// Minimum execution time: 3_120_000 picoseconds.
+		Weight::from_parts(3_310_000, 3530)
+			// Standard Error: 2_748
+			.saturating_add(Weight::from_parts(11_489_631, 0).saturating_mul(b.into()))
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 			.saturating_add(T::DbWeight::get().writes(2_u64))
 			.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))
 	}
-	/// Storage: Refungible TokensMinted (r:1 w:1)
-	/// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:200 w:200)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:0 w:200)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:0 w:200)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:200)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::TokensMinted` (r:1 w:1)
+	/// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:200 w:200)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:0 w:200)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:0 w:200)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:200)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 200]`.
 	fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `4`
 		//  Estimated: `3481 + b * (2540 ±0)`
-		// Minimum execution time: 2_616_000 picoseconds.
-		Weight::from_parts(2_726_000, 3481)
-			// Standard Error: 665
-			.saturating_add(Weight::from_parts(5_554_066, 0).saturating_mul(b.into()))
+		// Minimum execution time: 3_180_000 picoseconds.
+		Weight::from_parts(2_015_490, 3481)
+			// Standard Error: 6_052
+			.saturating_add(Weight::from_parts(14_837_077, 0).saturating_mul(b.into()))
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 			.saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(b.into())))
 			.saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))
 	}
-	/// Storage: Refungible TokensMinted (r:1 w:1)
-	/// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:200 w:200)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:0 w:200)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:0 w:1)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:200)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::TokensMinted` (r:1 w:1)
+	/// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:200 w:200)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:0 w:200)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:0 w:1)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:200)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 200]`.
 	fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `4`
 		//  Estimated: `3481 + b * (2540 ±0)`
-		// Minimum execution time: 3_697_000 picoseconds.
-		Weight::from_parts(2_136_481, 3481)
-			// Standard Error: 567
-			.saturating_add(Weight::from_parts(4_390_621, 0).saturating_mul(b.into()))
+		// Minimum execution time: 5_200_000 picoseconds.
+		Weight::from_parts(25_301_631, 3481)
+			// Standard Error: 6_177
+			.saturating_add(Weight::from_parts(11_197_931, 0).saturating_mul(b.into()))
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))
 			.saturating_add(T::DbWeight::get().writes(2_u64))
 			.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))
 			.saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))
 	}
-	/// Storage: Refungible Balance (r:3 w:1)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:1)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:1)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Balance` (r:3 w:1)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:1)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:1)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn burn_item_partial() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `456`
 		//  Estimated: `8682`
-		// Minimum execution time: 22_859_000 picoseconds.
-		Weight::from_parts(23_295_000, 8682)
+		// Minimum execution time: 29_540_000 picoseconds.
+		Weight::from_parts(30_190_000, 8682)
 			.saturating_add(T::DbWeight::get().reads(5_u64))
 			.saturating_add(T::DbWeight::get().writes(4_u64))
 	}
-	/// Storage: Refungible Balance (r:1 w:1)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:1)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible TokensBurnt (r:1 w:1)
-	/// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:1)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
-	/// Storage: Refungible TokenProperties (r:0 w:1)
-	/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Balance` (r:1 w:1)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:1)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TokensBurnt` (r:1 w:1)
+	/// Proof: `Refungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:1)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TokenProperties` (r:0 w:1)
+	/// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
 	fn burn_item_fully() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `341`
 		//  Estimated: `3554`
-		// Minimum execution time: 21_477_000 picoseconds.
-		Weight::from_parts(22_037_000, 3554)
+		// Minimum execution time: 30_650_000 picoseconds.
+		Weight::from_parts(31_370_000, 3554)
 			.saturating_add(T::DbWeight::get().reads(4_u64))
 			.saturating_add(T::DbWeight::get().writes(6_u64))
 	}
-	/// Storage: Refungible Balance (r:2 w:2)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Balance` (r:2 w:2)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:0)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
 	fn transfer_normal() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `365`
 		//  Estimated: `6118`
-		// Minimum execution time: 13_714_000 picoseconds.
-		Weight::from_parts(14_050_000, 6118)
+		// Minimum execution time: 18_530_000 picoseconds.
+		Weight::from_parts(19_010_000, 6118)
 			.saturating_add(T::DbWeight::get().reads(3_u64))
 			.saturating_add(T::DbWeight::get().writes(2_u64))
 	}
-	/// Storage: Refungible Balance (r:2 w:2)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:1)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Balance` (r:2 w:2)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:0)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:1)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn transfer_creating() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `341`
 		//  Estimated: `6118`
-		// Minimum execution time: 15_879_000 picoseconds.
-		Weight::from_parts(16_266_000, 6118)
+		// Minimum execution time: 24_240_000 picoseconds.
+		Weight::from_parts(24_760_000, 6118)
 			.saturating_add(T::DbWeight::get().reads(4_u64))
 			.saturating_add(T::DbWeight::get().writes(4_u64))
 	}
-	/// Storage: Refungible Balance (r:2 w:2)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:1)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Balance` (r:2 w:2)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:0)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:1)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn transfer_removing() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `456`
 		//  Estimated: `6118`
-		// Minimum execution time: 18_186_000 picoseconds.
-		Weight::from_parts(18_682_000, 6118)
+		// Minimum execution time: 25_990_000 picoseconds.
+		Weight::from_parts(26_650_000, 6118)
 			.saturating_add(T::DbWeight::get().reads(4_u64))
 			.saturating_add(T::DbWeight::get().writes(4_u64))
 	}
-	/// Storage: Refungible Balance (r:2 w:2)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:2 w:2)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:2)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Balance` (r:2 w:2)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:2 w:2)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:0)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:2)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn transfer_creating_removing() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `341`
 		//  Estimated: `6118`
-		// Minimum execution time: 17_943_000 picoseconds.
-		Weight::from_parts(18_333_000, 6118)
+		// Minimum execution time: 29_550_000 picoseconds.
+		Weight::from_parts(30_530_000, 6118)
 			.saturating_add(T::DbWeight::get().reads(5_u64))
 			.saturating_add(T::DbWeight::get().writes(6_u64))
 	}
-	/// Storage: Refungible Balance (r:1 w:0)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible Allowance (r:0 w:1)
-	/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Balance` (r:1 w:0)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Allowance` (r:0 w:1)
+	/// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
 	fn approve() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `223`
 		//  Estimated: `3554`
-		// Minimum execution time: 8_391_000 picoseconds.
-		Weight::from_parts(8_637_000, 3554)
+		// Minimum execution time: 11_420_000 picoseconds.
+		Weight::from_parts(11_810_000, 3554)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: Refungible Balance (r:1 w:0)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible Allowance (r:0 w:1)
-	/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Balance` (r:1 w:0)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Allowance` (r:0 w:1)
+	/// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
 	fn approve_from() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `211`
 		//  Estimated: `3554`
-		// Minimum execution time: 8_519_000 picoseconds.
-		Weight::from_parts(8_760_000, 3554)
+		// Minimum execution time: 11_610_000 picoseconds.
+		Weight::from_parts(11_950_000, 3554)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: Refungible Allowance (r:1 w:1)
-	/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:2 w:2)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Allowance` (r:1 w:1)
+	/// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:2 w:2)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:0)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
 	fn transfer_from_normal() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `495`
 		//  Estimated: `6118`
-		// Minimum execution time: 19_554_000 picoseconds.
-		Weight::from_parts(20_031_000, 6118)
+		// Minimum execution time: 28_510_000 picoseconds.
+		Weight::from_parts(29_180_000, 6118)
 			.saturating_add(T::DbWeight::get().reads(4_u64))
 			.saturating_add(T::DbWeight::get().writes(3_u64))
 	}
-	/// Storage: Refungible Allowance (r:1 w:1)
-	/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:2 w:2)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:1)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Allowance` (r:1 w:1)
+	/// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:2 w:2)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:0)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:1)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn transfer_from_creating() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `471`
 		//  Estimated: `6118`
-		// Minimum execution time: 21_338_000 picoseconds.
-		Weight::from_parts(21_803_000, 6118)
+		// Minimum execution time: 34_370_000 picoseconds.
+		Weight::from_parts(35_270_000, 6118)
 			.saturating_add(T::DbWeight::get().reads(5_u64))
 			.saturating_add(T::DbWeight::get().writes(5_u64))
 	}
-	/// Storage: Refungible Allowance (r:1 w:1)
-	/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:2 w:2)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:1)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Allowance` (r:1 w:1)
+	/// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:2 w:2)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:0)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:1)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn transfer_from_removing() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `586`
 		//  Estimated: `6118`
-		// Minimum execution time: 24_179_000 picoseconds.
-		Weight::from_parts(24_647_000, 6118)
+		// Minimum execution time: 36_490_000 picoseconds.
+		Weight::from_parts(37_160_000, 6118)
 			.saturating_add(T::DbWeight::get().reads(5_u64))
 			.saturating_add(T::DbWeight::get().writes(5_u64))
 	}
-	/// Storage: Refungible Allowance (r:1 w:1)
-	/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:2 w:2)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:2 w:2)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:2)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Allowance` (r:1 w:1)
+	/// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:2 w:2)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:2 w:2)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:0)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:2)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn transfer_from_creating_removing() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `471`
 		//  Estimated: `6118`
-		// Minimum execution time: 24_008_000 picoseconds.
-		Weight::from_parts(24_545_000, 6118)
+		// Minimum execution time: 40_080_000 picoseconds.
+		Weight::from_parts(48_310_000, 6118)
 			.saturating_add(T::DbWeight::get().reads(6_u64))
 			.saturating_add(T::DbWeight::get().writes(7_u64))
 	}
-	/// Storage: Refungible Allowance (r:1 w:1)
-	/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:1 w:1)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:1)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible TokensBurnt (r:1 w:1)
-	/// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:1)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
-	/// Storage: Refungible TokenProperties (r:0 w:1)
-	/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Allowance` (r:1 w:1)
+	/// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:1 w:1)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:1)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TokensBurnt` (r:1 w:1)
+	/// Proof: `Refungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:1)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TokenProperties` (r:0 w:1)
+	/// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
 	fn burn_from() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `471`
 		//  Estimated: `3570`
-		// Minimum execution time: 27_907_000 picoseconds.
-		Weight::from_parts(28_489_000, 3570)
+		// Minimum execution time: 41_100_000 picoseconds.
+		Weight::from_parts(42_060_000, 3570)
 			.saturating_add(T::DbWeight::get().reads(5_u64))
 			.saturating_add(T::DbWeight::get().writes(7_u64))
-	}
-	/// Storage: Common CollectionPropertyPermissions (r:1 w:1)
-	/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
-	/// The range of component `b` is `[0, 64]`.
-	fn set_token_property_permissions(b: u32, ) -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `314`
-		//  Estimated: `20191`
-		// Minimum execution time: 1_460_000 picoseconds.
-		Weight::from_parts(1_564_000, 20191)
-			// Standard Error: 14_117
-			.saturating_add(Weight::from_parts(8_196_214, 0).saturating_mul(b.into()))
-			.saturating_add(T::DbWeight::get().reads(1_u64))
-			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
-	/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
-	/// Storage: Refungible TokenProperties (r:1 w:1)
-	/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// The range of component `b` is `[0, 64]`.
-	fn set_token_properties(b: u32, ) -> Weight {
+	/// Storage: `Refungible::TokenProperties` (r:1 w:0)
+	/// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
+	fn load_token_properties() -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `502 + b * (261 ±0)`
+		//  Measured:  `120`
 		//  Estimated: `36269`
-		// Minimum execution time: 1_012_000 picoseconds.
-		Weight::from_parts(1_081_000, 36269)
-			// Standard Error: 6_838
-			.saturating_add(Weight::from_parts(5_801_181, 0).saturating_mul(b.into()))
-			.saturating_add(T::DbWeight::get().reads(3_u64))
-			.saturating_add(T::DbWeight::get().writes(1_u64))
+		// Minimum execution time: 2_520_000 picoseconds.
+		Weight::from_parts(2_670_000, 36269)
+			.saturating_add(T::DbWeight::get().reads(1_u64))
 	}
-	/// Storage: Refungible TokenProperties (r:0 w:1)
-	/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Refungible::TokenProperties` (r:0 w:1)
+	/// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 64]`.
-	fn init_token_properties(b: u32, ) -> Weight {
+	fn write_token_properties(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `0`
 		//  Estimated: `0`
-		// Minimum execution time: 229_000 picoseconds.
-		Weight::from_parts(253_000, 0)
-			// Standard Error: 100_218
-			.saturating_add(Weight::from_parts(12_632_221, 0).saturating_mul(b.into()))
+		// Minimum execution time: 490_000 picoseconds.
+		Weight::from_parts(3_457_547, 0)
+			// Standard Error: 24_239
+			.saturating_add(Weight::from_parts(19_382_722, 0).saturating_mul(b.into()))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
-	/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible TokenProperties (r:1 w:1)
-	/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Common::CollectionPropertyPermissions` (r:1 w:1)
+	/// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 64]`.
-	fn delete_token_properties(b: u32, ) -> Weight {
+	fn set_token_property_permissions(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `561 + b * (33291 ±0)`
-		//  Estimated: `36269`
-		// Minimum execution time: 1_014_000 picoseconds.
-		Weight::from_parts(1_065_000, 36269)
-			// Standard Error: 39_536
-			.saturating_add(Weight::from_parts(24_125_838, 0).saturating_mul(b.into()))
-			.saturating_add(T::DbWeight::get().reads(3_u64))
+		//  Measured:  `314`
+		//  Estimated: `20191`
+		// Minimum execution time: 1_500_000 picoseconds.
+		Weight::from_parts(1_590_000, 20191)
+			// Standard Error: 123_927
+			.saturating_add(Weight::from_parts(27_355_093, 0).saturating_mul(b.into()))
+			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: Refungible TotalSupply (r:1 w:1)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:1 w:1)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:1)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:1 w:1)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
 	fn repartition_item() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `288`
 		//  Estimated: `3554`
-		// Minimum execution time: 10_315_000 picoseconds.
-		Weight::from_parts(10_601_000, 3554)
+		// Minimum execution time: 14_340_000 picoseconds.
+		Weight::from_parts(14_590_000, 3554)
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 			.saturating_add(T::DbWeight::get().writes(2_u64))
-	}
-	/// Storage: Refungible Balance (r:2 w:0)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	fn token_owner() -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `288`
-		//  Estimated: `6118`
-		// Minimum execution time: 4_898_000 picoseconds.
-		Weight::from_parts(5_136_000, 6118)
-			.saturating_add(T::DbWeight::get().reads(2_u64))
 	}
-	/// Storage: Refungible CollectionAllowance (r:0 w:1)
-	/// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
+	/// Storage: `Refungible::CollectionAllowance` (r:0 w:1)
+	/// Proof: `Refungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)
 	fn set_allowance_for_all() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `0`
 		//  Estimated: `0`
-		// Minimum execution time: 4_146_000 picoseconds.
-		Weight::from_parts(4_337_000, 0)
+		// Minimum execution time: 6_390_000 picoseconds.
+		Weight::from_parts(6_650_000, 0)
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: Refungible CollectionAllowance (r:1 w:0)
-	/// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
+	/// Storage: `Refungible::CollectionAllowance` (r:1 w:0)
+	/// Proof: `Refungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)
 	fn allowance_for_all() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `4`
 		//  Estimated: `3576`
-		// Minimum execution time: 2_170_000 picoseconds.
-		Weight::from_parts(2_301_000, 3576)
+		// Minimum execution time: 3_060_000 picoseconds.
+		Weight::from_parts(3_210_000, 3576)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 	}
-	/// Storage: Refungible TokenProperties (r:1 w:1)
-	/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Refungible::TokenProperties` (r:1 w:1)
+	/// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
 	fn repair_item() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `120`
 		//  Estimated: `36269`
-		// Minimum execution time: 2_098_000 picoseconds.
-		Weight::from_parts(2_251_000, 36269)
+		// Minimum execution time: 2_480_000 picoseconds.
+		Weight::from_parts(2_620_000, 36269)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
@@ -500,435 +462,399 @@
 
 // For backwards compatibility and tests
 impl WeightInfo for () {
-	/// Storage: Refungible TokensMinted (r:1 w:1)
-	/// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:0 w:1)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:0 w:1)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:1)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::TokensMinted` (r:1 w:1)
+	/// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:0 w:1)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:0 w:1)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:1)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn create_item() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `4`
 		//  Estimated: `3530`
-		// Minimum execution time: 11_341_000 picoseconds.
-		Weight::from_parts(11_741_000, 3530)
+		// Minimum execution time: 19_400_000 picoseconds.
+		Weight::from_parts(19_890_000, 3530)
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 			.saturating_add(RocksDbWeight::get().writes(5_u64))
 	}
-	/// Storage: Refungible TokensMinted (r:1 w:1)
-	/// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:0 w:200)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:0 w:200)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:200)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::TokensMinted` (r:1 w:1)
+	/// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:0 w:200)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:0 w:200)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:200)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 200]`.
 	fn create_multiple_items(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `4`
 		//  Estimated: `3530`
-		// Minimum execution time: 2_665_000 picoseconds.
-		Weight::from_parts(2_791_000, 3530)
-			// Standard Error: 996
-			.saturating_add(Weight::from_parts(4_343_736, 0).saturating_mul(b.into()))
+		// Minimum execution time: 3_120_000 picoseconds.
+		Weight::from_parts(3_310_000, 3530)
+			// Standard Error: 2_748
+			.saturating_add(Weight::from_parts(11_489_631, 0).saturating_mul(b.into()))
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 			.saturating_add(RocksDbWeight::get().writes(2_u64))
 			.saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))
 	}
-	/// Storage: Refungible TokensMinted (r:1 w:1)
-	/// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:200 w:200)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:0 w:200)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:0 w:200)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:200)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::TokensMinted` (r:1 w:1)
+	/// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:200 w:200)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:0 w:200)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:0 w:200)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:200)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 200]`.
 	fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `4`
 		//  Estimated: `3481 + b * (2540 ±0)`
-		// Minimum execution time: 2_616_000 picoseconds.
-		Weight::from_parts(2_726_000, 3481)
-			// Standard Error: 665
-			.saturating_add(Weight::from_parts(5_554_066, 0).saturating_mul(b.into()))
+		// Minimum execution time: 3_180_000 picoseconds.
+		Weight::from_parts(2_015_490, 3481)
+			// Standard Error: 6_052
+			.saturating_add(Weight::from_parts(14_837_077, 0).saturating_mul(b.into()))
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 			.saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(b.into())))
 			.saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))
 	}
-	/// Storage: Refungible TokensMinted (r:1 w:1)
-	/// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:200 w:200)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:0 w:200)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:0 w:1)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:200)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::TokensMinted` (r:1 w:1)
+	/// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:200 w:200)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:0 w:200)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:0 w:1)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:200)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 200]`.
 	fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `4`
 		//  Estimated: `3481 + b * (2540 ±0)`
-		// Minimum execution time: 3_697_000 picoseconds.
-		Weight::from_parts(2_136_481, 3481)
-			// Standard Error: 567
-			.saturating_add(Weight::from_parts(4_390_621, 0).saturating_mul(b.into()))
+		// Minimum execution time: 5_200_000 picoseconds.
+		Weight::from_parts(25_301_631, 3481)
+			// Standard Error: 6_177
+			.saturating_add(Weight::from_parts(11_197_931, 0).saturating_mul(b.into()))
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))
 			.saturating_add(RocksDbWeight::get().writes(2_u64))
 			.saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))
 			.saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))
 	}
-	/// Storage: Refungible Balance (r:3 w:1)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:1)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:1)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Balance` (r:3 w:1)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:1)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:1)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn burn_item_partial() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `456`
 		//  Estimated: `8682`
-		// Minimum execution time: 22_859_000 picoseconds.
-		Weight::from_parts(23_295_000, 8682)
+		// Minimum execution time: 29_540_000 picoseconds.
+		Weight::from_parts(30_190_000, 8682)
 			.saturating_add(RocksDbWeight::get().reads(5_u64))
 			.saturating_add(RocksDbWeight::get().writes(4_u64))
 	}
-	/// Storage: Refungible Balance (r:1 w:1)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:1)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible TokensBurnt (r:1 w:1)
-	/// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:1)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
-	/// Storage: Refungible TokenProperties (r:0 w:1)
-	/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Balance` (r:1 w:1)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:1)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TokensBurnt` (r:1 w:1)
+	/// Proof: `Refungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:1)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TokenProperties` (r:0 w:1)
+	/// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
 	fn burn_item_fully() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `341`
 		//  Estimated: `3554`
-		// Minimum execution time: 21_477_000 picoseconds.
-		Weight::from_parts(22_037_000, 3554)
+		// Minimum execution time: 30_650_000 picoseconds.
+		Weight::from_parts(31_370_000, 3554)
 			.saturating_add(RocksDbWeight::get().reads(4_u64))
 			.saturating_add(RocksDbWeight::get().writes(6_u64))
 	}
-	/// Storage: Refungible Balance (r:2 w:2)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Balance` (r:2 w:2)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:0)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
 	fn transfer_normal() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `365`
 		//  Estimated: `6118`
-		// Minimum execution time: 13_714_000 picoseconds.
-		Weight::from_parts(14_050_000, 6118)
+		// Minimum execution time: 18_530_000 picoseconds.
+		Weight::from_parts(19_010_000, 6118)
 			.saturating_add(RocksDbWeight::get().reads(3_u64))
 			.saturating_add(RocksDbWeight::get().writes(2_u64))
 	}
-	/// Storage: Refungible Balance (r:2 w:2)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:1)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Balance` (r:2 w:2)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:0)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:1)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn transfer_creating() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `341`
 		//  Estimated: `6118`
-		// Minimum execution time: 15_879_000 picoseconds.
-		Weight::from_parts(16_266_000, 6118)
+		// Minimum execution time: 24_240_000 picoseconds.
+		Weight::from_parts(24_760_000, 6118)
 			.saturating_add(RocksDbWeight::get().reads(4_u64))
 			.saturating_add(RocksDbWeight::get().writes(4_u64))
 	}
-	/// Storage: Refungible Balance (r:2 w:2)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:1)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Balance` (r:2 w:2)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:0)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:1)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn transfer_removing() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `456`
 		//  Estimated: `6118`
-		// Minimum execution time: 18_186_000 picoseconds.
-		Weight::from_parts(18_682_000, 6118)
+		// Minimum execution time: 25_990_000 picoseconds.
+		Weight::from_parts(26_650_000, 6118)
 			.saturating_add(RocksDbWeight::get().reads(4_u64))
 			.saturating_add(RocksDbWeight::get().writes(4_u64))
 	}
-	/// Storage: Refungible Balance (r:2 w:2)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:2 w:2)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:2)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Balance` (r:2 w:2)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:2 w:2)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:0)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:2)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn transfer_creating_removing() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `341`
 		//  Estimated: `6118`
-		// Minimum execution time: 17_943_000 picoseconds.
-		Weight::from_parts(18_333_000, 6118)
+		// Minimum execution time: 29_550_000 picoseconds.
+		Weight::from_parts(30_530_000, 6118)
 			.saturating_add(RocksDbWeight::get().reads(5_u64))
 			.saturating_add(RocksDbWeight::get().writes(6_u64))
 	}
-	/// Storage: Refungible Balance (r:1 w:0)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible Allowance (r:0 w:1)
-	/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Balance` (r:1 w:0)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Allowance` (r:0 w:1)
+	/// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
 	fn approve() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `223`
 		//  Estimated: `3554`
-		// Minimum execution time: 8_391_000 picoseconds.
-		Weight::from_parts(8_637_000, 3554)
+		// Minimum execution time: 11_420_000 picoseconds.
+		Weight::from_parts(11_810_000, 3554)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: Refungible Balance (r:1 w:0)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible Allowance (r:0 w:1)
-	/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Balance` (r:1 w:0)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Allowance` (r:0 w:1)
+	/// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
 	fn approve_from() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `211`
 		//  Estimated: `3554`
-		// Minimum execution time: 8_519_000 picoseconds.
-		Weight::from_parts(8_760_000, 3554)
+		// Minimum execution time: 11_610_000 picoseconds.
+		Weight::from_parts(11_950_000, 3554)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: Refungible Allowance (r:1 w:1)
-	/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:2 w:2)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Allowance` (r:1 w:1)
+	/// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:2 w:2)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:0)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
 	fn transfer_from_normal() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `495`
 		//  Estimated: `6118`
-		// Minimum execution time: 19_554_000 picoseconds.
-		Weight::from_parts(20_031_000, 6118)
+		// Minimum execution time: 28_510_000 picoseconds.
+		Weight::from_parts(29_180_000, 6118)
 			.saturating_add(RocksDbWeight::get().reads(4_u64))
 			.saturating_add(RocksDbWeight::get().writes(3_u64))
 	}
-	/// Storage: Refungible Allowance (r:1 w:1)
-	/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:2 w:2)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:1)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Allowance` (r:1 w:1)
+	/// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:2 w:2)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:0)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:1)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn transfer_from_creating() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `471`
 		//  Estimated: `6118`
-		// Minimum execution time: 21_338_000 picoseconds.
-		Weight::from_parts(21_803_000, 6118)
+		// Minimum execution time: 34_370_000 picoseconds.
+		Weight::from_parts(35_270_000, 6118)
 			.saturating_add(RocksDbWeight::get().reads(5_u64))
 			.saturating_add(RocksDbWeight::get().writes(5_u64))
 	}
-	/// Storage: Refungible Allowance (r:1 w:1)
-	/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:2 w:2)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:1)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Allowance` (r:1 w:1)
+	/// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:2 w:2)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:0)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:1)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn transfer_from_removing() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `586`
 		//  Estimated: `6118`
-		// Minimum execution time: 24_179_000 picoseconds.
-		Weight::from_parts(24_647_000, 6118)
+		// Minimum execution time: 36_490_000 picoseconds.
+		Weight::from_parts(37_160_000, 6118)
 			.saturating_add(RocksDbWeight::get().reads(5_u64))
 			.saturating_add(RocksDbWeight::get().writes(5_u64))
 	}
-	/// Storage: Refungible Allowance (r:1 w:1)
-	/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:2 w:2)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:2 w:2)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:2)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Allowance` (r:1 w:1)
+	/// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:2 w:2)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:2 w:2)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:0)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:2)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
 	fn transfer_from_creating_removing() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `471`
 		//  Estimated: `6118`
-		// Minimum execution time: 24_008_000 picoseconds.
-		Weight::from_parts(24_545_000, 6118)
+		// Minimum execution time: 40_080_000 picoseconds.
+		Weight::from_parts(48_310_000, 6118)
 			.saturating_add(RocksDbWeight::get().reads(6_u64))
 			.saturating_add(RocksDbWeight::get().writes(7_u64))
 	}
-	/// Storage: Refungible Allowance (r:1 w:1)
-	/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:1 w:1)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:1)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible AccountBalance (r:1 w:1)
-	/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
-	/// Storage: Refungible TokensBurnt (r:1 w:1)
-	/// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
-	/// Storage: Refungible Owned (r:0 w:1)
-	/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
-	/// Storage: Refungible TokenProperties (r:0 w:1)
-	/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Refungible::Allowance` (r:1 w:1)
+	/// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:1 w:1)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:1)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::AccountBalance` (r:1 w:1)
+	/// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TokensBurnt` (r:1 w:1)
+	/// Proof: `Refungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Owned` (r:0 w:1)
+	/// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::TokenProperties` (r:0 w:1)
+	/// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
 	fn burn_from() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `471`
 		//  Estimated: `3570`
-		// Minimum execution time: 27_907_000 picoseconds.
-		Weight::from_parts(28_489_000, 3570)
+		// Minimum execution time: 41_100_000 picoseconds.
+		Weight::from_parts(42_060_000, 3570)
 			.saturating_add(RocksDbWeight::get().reads(5_u64))
 			.saturating_add(RocksDbWeight::get().writes(7_u64))
 	}
-	/// Storage: Common CollectionPropertyPermissions (r:1 w:1)
-	/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
-	/// The range of component `b` is `[0, 64]`.
-	fn set_token_property_permissions(b: u32, ) -> Weight {
+	/// Storage: `Refungible::TokenProperties` (r:1 w:0)
+	/// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
+	fn load_token_properties() -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `314`
-		//  Estimated: `20191`
-		// Minimum execution time: 1_460_000 picoseconds.
-		Weight::from_parts(1_564_000, 20191)
-			// Standard Error: 14_117
-			.saturating_add(Weight::from_parts(8_196_214, 0).saturating_mul(b.into()))
-			.saturating_add(RocksDbWeight::get().reads(1_u64))
-			.saturating_add(RocksDbWeight::get().writes(1_u64))
-	}
-	/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
-	/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
-	/// Storage: Refungible TokenProperties (r:1 w:1)
-	/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// The range of component `b` is `[0, 64]`.
-	fn set_token_properties(b: u32, ) -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `502 + b * (261 ±0)`
+		//  Measured:  `120`
 		//  Estimated: `36269`
-		// Minimum execution time: 1_012_000 picoseconds.
-		Weight::from_parts(1_081_000, 36269)
-			// Standard Error: 6_838
-			.saturating_add(Weight::from_parts(5_801_181, 0).saturating_mul(b.into()))
-			.saturating_add(RocksDbWeight::get().reads(3_u64))
-			.saturating_add(RocksDbWeight::get().writes(1_u64))
+		// Minimum execution time: 2_520_000 picoseconds.
+		Weight::from_parts(2_670_000, 36269)
+			.saturating_add(RocksDbWeight::get().reads(1_u64))
 	}
-	/// Storage: Refungible TokenProperties (r:0 w:1)
-	/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Refungible::TokenProperties` (r:0 w:1)
+	/// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 64]`.
-	fn init_token_properties(b: u32, ) -> Weight {
+	fn write_token_properties(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `0`
 		//  Estimated: `0`
-		// Minimum execution time: 229_000 picoseconds.
-		Weight::from_parts(253_000, 0)
-			// Standard Error: 100_218
-			.saturating_add(Weight::from_parts(12_632_221, 0).saturating_mul(b.into()))
+		// Minimum execution time: 490_000 picoseconds.
+		Weight::from_parts(3_457_547, 0)
+			// Standard Error: 24_239
+			.saturating_add(Weight::from_parts(19_382_722, 0).saturating_mul(b.into()))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
-	/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
-	/// Storage: Refungible TotalSupply (r:1 w:0)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible TokenProperties (r:1 w:1)
-	/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Common::CollectionPropertyPermissions` (r:1 w:1)
+	/// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 64]`.
-	fn delete_token_properties(b: u32, ) -> Weight {
+	fn set_token_property_permissions(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `561 + b * (33291 ±0)`
-		//  Estimated: `36269`
-		// Minimum execution time: 1_014_000 picoseconds.
-		Weight::from_parts(1_065_000, 36269)
-			// Standard Error: 39_536
-			.saturating_add(Weight::from_parts(24_125_838, 0).saturating_mul(b.into()))
-			.saturating_add(RocksDbWeight::get().reads(3_u64))
+		//  Measured:  `314`
+		//  Estimated: `20191`
+		// Minimum execution time: 1_500_000 picoseconds.
+		Weight::from_parts(1_590_000, 20191)
+			// Standard Error: 123_927
+			.saturating_add(Weight::from_parts(27_355_093, 0).saturating_mul(b.into()))
+			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: Refungible TotalSupply (r:1 w:1)
-	/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
-	/// Storage: Refungible Balance (r:1 w:1)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
+	/// Storage: `Refungible::TotalSupply` (r:1 w:1)
+	/// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+	/// Storage: `Refungible::Balance` (r:1 w:1)
+	/// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
 	fn repartition_item() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `288`
 		//  Estimated: `3554`
-		// Minimum execution time: 10_315_000 picoseconds.
-		Weight::from_parts(10_601_000, 3554)
+		// Minimum execution time: 14_340_000 picoseconds.
+		Weight::from_parts(14_590_000, 3554)
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 			.saturating_add(RocksDbWeight::get().writes(2_u64))
 	}
-	/// Storage: Refungible Balance (r:2 w:0)
-	/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
-	fn token_owner() -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `288`
-		//  Estimated: `6118`
-		// Minimum execution time: 4_898_000 picoseconds.
-		Weight::from_parts(5_136_000, 6118)
-			.saturating_add(RocksDbWeight::get().reads(2_u64))
-	}
-	/// Storage: Refungible CollectionAllowance (r:0 w:1)
-	/// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
+	/// Storage: `Refungible::CollectionAllowance` (r:0 w:1)
+	/// Proof: `Refungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)
 	fn set_allowance_for_all() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `0`
 		//  Estimated: `0`
-		// Minimum execution time: 4_146_000 picoseconds.
-		Weight::from_parts(4_337_000, 0)
+		// Minimum execution time: 6_390_000 picoseconds.
+		Weight::from_parts(6_650_000, 0)
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: Refungible CollectionAllowance (r:1 w:0)
-	/// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
+	/// Storage: `Refungible::CollectionAllowance` (r:1 w:0)
+	/// Proof: `Refungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)
 	fn allowance_for_all() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `4`
 		//  Estimated: `3576`
-		// Minimum execution time: 2_170_000 picoseconds.
-		Weight::from_parts(2_301_000, 3576)
+		// Minimum execution time: 3_060_000 picoseconds.
+		Weight::from_parts(3_210_000, 3576)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 	}
-	/// Storage: Refungible TokenProperties (r:1 w:1)
-	/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+	/// Storage: `Refungible::TokenProperties` (r:1 w:1)
+	/// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
 	fn repair_item() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `120`
 		//  Estimated: `36269`
-		// Minimum execution time: 2_098_000 picoseconds.
-		Weight::from_parts(2_251_000, 36269)
+		// Minimum execution time: 2_480_000 picoseconds.
+		Weight::from_parts(2_620_000, 36269)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
modifiedpallets/structure/src/lib.rsdiffbeforeafterboth
--- a/pallets/structure/src/lib.rs
+++ b/pallets/structure/src/lib.rs
@@ -53,11 +53,7 @@
 
 #![cfg_attr(not(feature = "std"), no_std)]
 
-use frame_support::{
-	dispatch::{DispatchResult, DispatchResultWithPostInfo},
-	fail,
-	pallet_prelude::*,
-};
+use frame_support::{dispatch::DispatchResult, fail, pallet_prelude::*};
 use pallet_common::{
 	dispatch::CollectionDispatch, erc::CrossAccountId, eth::is_collection,
 	CommonCollectionOperations,
@@ -267,22 +263,6 @@
 		}
 
 		Err(<Error<T>>::DepthLimit.into())
-	}
-
-	/// Burn token and all of it's nested tokens
-	///
-	/// - `self_budget`: Limit for searching children in depth.
-	/// - `breadth_budget`: Limit of breadth of searching children.
-	pub fn burn_item_recursively(
-		from: T::CrossAccountId,
-		collection: CollectionId,
-		token: TokenId,
-		self_budget: &dyn Budget,
-		breadth_budget: &dyn Budget,
-	) -> DispatchResultWithPostInfo {
-		let dispatch = T::CollectionDispatch::dispatch(collection)?;
-		let dispatch = dispatch.as_dyn();
-		dispatch.burn_item_recursively(from, token, self_budget, breadth_budget)
 	}
 
 	/// Check if `token` indirectly owned by `user`
modifiedpallets/unique/Cargo.tomldiffbeforeafterboth
--- a/pallets/unique/Cargo.toml
+++ b/pallets/unique/Cargo.toml
@@ -31,7 +31,9 @@
 	'parity-scale-codec/std',
 	'sp-runtime/std',
 	'sp-std/std',
+	'up-common/std',
 	'up-data-structs/std',
+	'pallet-structure/std',
 ]
 stubgen = ["evm-coder/stubgen", "pallet-common/stubgen"]
 try-runtime = ["frame-support/try-runtime"]
@@ -53,9 +55,11 @@
 pallet-evm-coder-substrate = { workspace = true }
 pallet-nonfungible = { workspace = true }
 pallet-refungible = { workspace = true }
+pallet-structure = { workspace = true }
 scale-info = { workspace = true }
 sp-core = { workspace = true }
 sp-io = { workspace = true }
 sp-runtime = { workspace = true }
 sp-std = { workspace = true }
+up-common = { workspace = true }
 up-data-structs = { workspace = true }
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -84,13 +84,19 @@
 
 #[frame_support::pallet]
 pub mod pallet {
-	use frame_support::{dispatch::DispatchResult, ensure, fail, storage::Key, BoundedVec};
+	use frame_support::{
+		dispatch::{DispatchErrorWithPostInfo, DispatchResult, PostDispatchInfo},
+		ensure, fail,
+		storage::Key,
+		BoundedVec,
+	};
 	use frame_system::{ensure_root, ensure_signed};
 	use pallet_common::{
 		dispatch::{dispatch_tx, CollectionDispatch},
 		CollectionHandle, CommonWeightInfo, Pallet as PalletCommon, RefungibleExtensionsWeightInfo,
 	};
 	use pallet_evm::account::CrossAccountId;
+	use pallet_structure::weights::WeightInfo as StructureWeightInfo;
 	use scale_info::TypeInfo;
 	use sp_std::{vec, vec::Vec};
 	use up_data_structs::{
@@ -104,9 +110,6 @@
 	use weights::WeightInfo;
 
 	use super::*;
-
-	/// A maximum number of levels of depth in the token nesting tree.
-	pub const NESTING_BUDGET: u32 = 5;
 
 	/// Errors for the common Unique transactions.
 	#[pallet::error]
@@ -128,6 +131,8 @@
 		/// Weight information for common pallet operations.
 		type CommonWeightInfo: CommonWeightInfo<Self::CrossAccountId>;
 
+		type StructureWeightInfo: StructureWeightInfo;
+
 		/// Weight info information for extra refungible pallet operations.
 		type RefungibleExtensionsWeightInfo: RefungibleExtensionsWeightInfo;
 	}
@@ -264,7 +269,7 @@
 	impl<T: Config> Pallet<T> {
 		/// A maximum number of levels of depth in the token nesting tree.
 		fn nesting_budget() -> u32 {
-			NESTING_BUDGET
+			5
 		}
 
 		/// Maximal length of a collection name.
@@ -666,7 +671,7 @@
 		/// * `owner`: Address of the initial owner of the item.
 		/// * `data`: Token data describing the item to store on chain.
 		#[pallet::call_index(11)]
-		#[pallet::weight(T::CommonWeightInfo::create_item(data))]
+		#[pallet::weight(T::CommonWeightInfo::create_item(data) + <Pallet<T>>::nesting_budget_predispatch_weight())]
 		pub fn create_item(
 			origin: OriginFor<T>,
 			collection_id: CollectionId,
@@ -674,11 +679,14 @@
 			data: CreateItemData,
 		) -> DispatchResultWithPostInfo {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-			let budget = budget::Value::new(NESTING_BUDGET);
+			let budget = Self::structure_nesting_budget();
 
-			dispatch_tx::<T, _>(collection_id, |d| {
-				d.create_item(sender, owner, data, &budget)
-			})
+			Self::refund_nesting_budget(
+				dispatch_tx::<T, _>(collection_id, |d| {
+					d.create_item(sender, owner, data, &budget)
+				}),
+				budget,
+			)
 		}
 
 		/// Create multiple items within a collection.
@@ -700,7 +708,7 @@
 		/// * `owner`: Address of the initial owner of the tokens.
 		/// * `items_data`: Vector of data describing each item to be created.
 		#[pallet::call_index(12)]
-		#[pallet::weight(T::CommonWeightInfo::create_multiple_items(items_data))]
+		#[pallet::weight(T::CommonWeightInfo::create_multiple_items(items_data) + <Pallet<T>>::nesting_budget_predispatch_weight())]
 		pub fn create_multiple_items(
 			origin: OriginFor<T>,
 			collection_id: CollectionId,
@@ -709,11 +717,14 @@
 		) -> DispatchResultWithPostInfo {
 			ensure!(!items_data.is_empty(), Error::<T>::EmptyArgument);
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-			let budget = budget::Value::new(NESTING_BUDGET);
+			let budget = Self::structure_nesting_budget();
 
-			dispatch_tx::<T, _>(collection_id, |d| {
-				d.create_multiple_items(sender, owner, items_data, &budget)
-			})
+			Self::refund_nesting_budget(
+				dispatch_tx::<T, _>(collection_id, |d| {
+					d.create_multiple_items(sender, owner, items_data, &budget)
+				}),
+				budget,
+			)
 		}
 
 		/// Add or change collection properties.
@@ -791,7 +802,7 @@
 		/// * `properties`: Vector of key-value pairs stored as the token's metadata.
 		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.
 		#[pallet::call_index(15)]
-		#[pallet::weight(T::CommonWeightInfo::set_token_properties(properties.len() as u32))]
+		#[pallet::weight(T::CommonWeightInfo::set_token_properties(properties.len() as u32) + <Pallet<T>>::nesting_budget_predispatch_weight())]
 		pub fn set_token_properties(
 			origin: OriginFor<T>,
 			collection_id: CollectionId,
@@ -801,11 +812,14 @@
 			ensure!(!properties.is_empty(), Error::<T>::EmptyArgument);
 
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-			let budget = budget::Value::new(NESTING_BUDGET);
+			let budget = Self::structure_nesting_budget();
 
-			dispatch_tx::<T, _>(collection_id, |d| {
-				d.set_token_properties(sender, token_id, properties, &budget)
-			})
+			Self::refund_nesting_budget(
+				dispatch_tx::<T, _>(collection_id, |d| {
+					d.set_token_properties(sender, token_id, properties, &budget)
+				}),
+				budget,
+			)
 		}
 
 		/// Delete specified token properties. Currently properties only work with NFTs.
@@ -824,7 +838,7 @@
 		/// * `property_keys`: Vector of keys of the properties to be deleted.
 		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.
 		#[pallet::call_index(16)]
-		#[pallet::weight(T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32))]
+		#[pallet::weight(T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32) + <Pallet<T>>::nesting_budget_predispatch_weight())]
 		pub fn delete_token_properties(
 			origin: OriginFor<T>,
 			collection_id: CollectionId,
@@ -834,11 +848,14 @@
 			ensure!(!property_keys.is_empty(), Error::<T>::EmptyArgument);
 
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-			let budget = budget::Value::new(NESTING_BUDGET);
+			let budget = Self::structure_nesting_budget();
 
-			dispatch_tx::<T, _>(collection_id, |d| {
-				d.delete_token_properties(sender, token_id, property_keys, &budget)
-			})
+			Self::refund_nesting_budget(
+				dispatch_tx::<T, _>(collection_id, |d| {
+					d.delete_token_properties(sender, token_id, property_keys, &budget)
+				}),
+				budget,
+			)
 		}
 
 		/// Add or change token property permissions of a collection.
@@ -888,18 +905,21 @@
 		/// * `collection_id`: ID of the collection to which the tokens would belong.
 		/// * `data`: Explicit item creation data.
 		#[pallet::call_index(18)]
-		#[pallet::weight(T::CommonWeightInfo::create_multiple_items_ex(data))]
+		#[pallet::weight(T::CommonWeightInfo::create_multiple_items_ex(data) + <Pallet<T>>::nesting_budget_predispatch_weight())]
 		pub fn create_multiple_items_ex(
 			origin: OriginFor<T>,
 			collection_id: CollectionId,
 			data: CreateItemExData<T::CrossAccountId>,
 		) -> DispatchResultWithPostInfo {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-			let budget = budget::Value::new(NESTING_BUDGET);
+			let budget = Self::structure_nesting_budget();
 
-			dispatch_tx::<T, _>(collection_id, |d| {
-				d.create_multiple_items_ex(sender, data, &budget)
-			})
+			Self::refund_nesting_budget(
+				dispatch_tx::<T, _>(collection_id, |d| {
+					d.create_multiple_items_ex(sender, data, &budget)
+				}),
+				budget,
+			)
 		}
 
 		/// Completely allow or disallow transfers for a particular collection.
@@ -995,7 +1015,7 @@
 		///     * Fungible Mode: The desired number of pieces to burn.
 		///     * Re-Fungible Mode: The desired number of pieces to burn.
 		#[pallet::call_index(21)]
-		#[pallet::weight(T::CommonWeightInfo::burn_from())]
+		#[pallet::weight(T::CommonWeightInfo::burn_from() + <Pallet<T>>::nesting_budget_predispatch_weight())]
 		pub fn burn_from(
 			origin: OriginFor<T>,
 			collection_id: CollectionId,
@@ -1004,11 +1024,14 @@
 			value: u128,
 		) -> DispatchResultWithPostInfo {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-			let budget = budget::Value::new(NESTING_BUDGET);
+			let budget = Self::structure_nesting_budget();
 
-			dispatch_tx::<T, _>(collection_id, |d| {
-				d.burn_from(sender, from, item_id, value, &budget)
-			})
+			Self::refund_nesting_budget(
+				dispatch_tx::<T, _>(collection_id, |d| {
+					d.burn_from(sender, from, item_id, value, &budget)
+				}),
+				budget,
+			)
 		}
 
 		/// Change ownership of the token.
@@ -1033,7 +1056,7 @@
 		///     * Fungible Mode: The desired number of pieces to transfer.
 		///     * Re-Fungible Mode: The desired number of pieces to transfer.
 		#[pallet::call_index(22)]
-		#[pallet::weight(T::CommonWeightInfo::transfer())]
+		#[pallet::weight(T::CommonWeightInfo::transfer() + <Pallet<T>>::nesting_budget_predispatch_weight())]
 		pub fn transfer(
 			origin: OriginFor<T>,
 			recipient: T::CrossAccountId,
@@ -1042,11 +1065,14 @@
 			value: u128,
 		) -> DispatchResultWithPostInfo {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-			let budget = budget::Value::new(NESTING_BUDGET);
+			let budget = Self::structure_nesting_budget();
 
-			dispatch_tx::<T, _>(collection_id, |d| {
-				d.transfer(sender, recipient, item_id, value, &budget)
-			})
+			Self::refund_nesting_budget(
+				dispatch_tx::<T, _>(collection_id, |d| {
+					d.transfer(sender, recipient, item_id, value, &budget)
+				}),
+				budget,
+			)
 		}
 
 		/// Allow a non-permissioned address to transfer or burn an item.
@@ -1138,7 +1164,7 @@
 		///     * Fungible Mode: The desired number of pieces to transfer.
 		///     * Re-Fungible Mode: The desired number of pieces to transfer.
 		#[pallet::call_index(25)]
-		#[pallet::weight(T::CommonWeightInfo::transfer_from())]
+		#[pallet::weight(T::CommonWeightInfo::transfer_from() + <Pallet<T>>::nesting_budget_predispatch_weight())]
 		pub fn transfer_from(
 			origin: OriginFor<T>,
 			from: T::CrossAccountId,
@@ -1148,11 +1174,14 @@
 			value: u128,
 		) -> DispatchResultWithPostInfo {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-			let budget = budget::Value::new(NESTING_BUDGET);
+			let budget = Self::structure_nesting_budget();
 
-			dispatch_tx::<T, _>(collection_id, |d| {
-				d.transfer_from(sender, from, recipient, item_id, value, &budget)
-			})
+			Self::refund_nesting_budget(
+				dispatch_tx::<T, _>(collection_id, |d| {
+					d.transfer_from(sender, from, recipient, item_id, value, &budget)
+				}),
+				budget,
+			)
 		}
 
 		/// Set specific limits of a collection. Empty, or None fields mean chain default.
@@ -1348,5 +1377,40 @@
 
 			Ok(())
 		}
+
+		fn structure_nesting_budget() -> budget::Value {
+			budget::Value::new(Self::nesting_budget())
+		}
+
+		fn nesting_budget_predispatch_weight() -> Weight {
+			T::StructureWeightInfo::find_parent().saturating_mul(Self::nesting_budget() as u64)
+		}
+
+		pub fn refund_nesting_budget(
+			mut result: DispatchResultWithPostInfo,
+			budget: budget::Value,
+		) -> DispatchResultWithPostInfo {
+			let refund_amount = budget.refund_amount();
+			let consumed = Self::nesting_budget() - refund_amount;
+
+			match &mut result {
+				Ok(PostDispatchInfo {
+					actual_weight: Some(weight),
+					..
+				})
+				| Err(DispatchErrorWithPostInfo {
+					post_info: PostDispatchInfo {
+						actual_weight: Some(weight),
+						..
+					},
+					..
+				}) => {
+					*weight += T::StructureWeightInfo::find_parent().saturating_mul(consumed as u64)
+				}
+				_ => {}
+			}
+
+			result
+		}
 	}
 }
modifiedprimitives/common/src/constants.rsdiffbeforeafterboth
--- a/primitives/common/src/constants.rs
+++ b/primitives/common/src/constants.rs
@@ -45,6 +45,7 @@
 
 /// Minimum balance required to create or keep an account open.
 pub const EXISTENTIAL_DEPOSIT: u128 = 0;
+
 /// Amount of Balance reserved for candidate registration.
 pub const GENESIS_LICENSE_BOND: u128 = 1_000_000_000_000 * UNIQUE;
 /// Amount of maximum collators for Collator Selection.
modifiedprimitives/data-structs/src/budget.rsdiffbeforeafterboth
--- a/primitives/data-structs/src/budget.rs
+++ b/primitives/data-structs/src/budget.rs
@@ -1,4 +1,4 @@
-use core::cell::Cell;
+use sp_std::cell::Cell;
 
 pub trait Budget {
 	/// Returns true while not exceeded
@@ -22,7 +22,7 @@
 	pub fn new(v: u32) -> Self {
 		Self(Cell::new(v))
 	}
-	pub fn refund(self) -> u32 {
+	pub fn refund_amount(self) -> u32 {
 		self.0.get()
 	}
 }
modifiedruntime/common/config/pallets/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -116,6 +116,7 @@
 impl pallet_unique::Config for Runtime {
 	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
 	type CommonWeightInfo = CommonWeights<Self>;
+	type StructureWeightInfo = pallet_structure::weights::SubstrateWeight<Self>;
 	type RefungibleExtensionsWeightInfo = CommonWeights<Self>;
 }
 
modifiedruntime/common/runtime_apis.rsdiffbeforeafterboth
--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -84,7 +84,7 @@
 				}
 
 				fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {
-					let budget = up_data_structs::budget::Value::new(10);
+					let budget = budget::Value::new(10);
 
 					<pallet_structure::Pallet<Runtime>>::find_topmost_owner(collection, token, &budget)
 				}
modifiedruntime/common/weights/mod.rsdiffbeforeafterboth
--- a/runtime/common/weights/mod.rs
+++ b/runtime/common/weights/mod.rs
@@ -98,10 +98,6 @@
 		dispatch_weight::<T>() + max_weight_of!(set_token_properties(amount))
 	}
 
-	fn delete_token_properties(amount: u32) -> Weight {
-		dispatch_weight::<T>() + max_weight_of!(delete_token_properties(amount))
-	}
-
 	fn set_token_property_permissions(amount: u32) -> Weight {
 		dispatch_weight::<T>() + max_weight_of!(set_token_property_permissions(amount))
 	}
@@ -124,26 +120,14 @@
 
 	fn burn_from() -> Weight {
 		dispatch_weight::<T>() + max_weight_of!(burn_from())
-	}
-
-	fn burn_recursively_self_raw() -> Weight {
-		max_weight_of!(burn_recursively_self_raw())
-	}
-
-	fn burn_recursively_breadth_raw(amount: u32) -> Weight {
-		max_weight_of!(burn_recursively_breadth_raw(amount))
-	}
-
-	fn token_owner() -> Weight {
-		max_weight_of!(token_owner())
 	}
 
 	fn set_allowance_for_all() -> Weight {
-		max_weight_of!(set_allowance_for_all())
+		dispatch_weight::<T>() + max_weight_of!(set_allowance_for_all())
 	}
 
 	fn force_repair_item() -> Weight {
-		max_weight_of!(force_repair_item())
+		dispatch_weight::<T>() + max_weight_of!(force_repair_item())
 	}
 }
 
modifiedruntime/tests/src/lib.rsdiffbeforeafterboth
--- a/runtime/tests/src/lib.rs
+++ b/runtime/tests/src/lib.rs
@@ -292,6 +292,7 @@
 	type WeightInfo = ();
 	type CommonWeightInfo = CommonWeights<Self>;
 	type RefungibleExtensionsWeightInfo = CommonWeights<Self>;
+	type StructureWeightInfo = pallet_structure::weights::SubstrateWeight<Self>;
 }
 
 // Build genesis storage according to the mock runtime.
modifiedruntime/tests/src/tests.rsdiffbeforeafterboth
--- a/runtime/tests/src/tests.rs
+++ b/runtime/tests/src/tests.rs
@@ -2624,10 +2624,10 @@
 
 	use super::*;
 
-	fn test<FTE: FnOnce() -> bool>(
+	fn test(
 		i: usize,
 		test_case: &pallet_common::tests::TestCase,
-		check_token_existence: &mut LazyValue<bool, FTE>,
+		check_token_existence: &mut LazyValue<bool>,
 	) {
 		let collection_admin = test_case.collection_admin;
 		let mut is_collection_admin = LazyValue::new(|| test_case.is_collection_admin);
@@ -2635,7 +2635,7 @@
 		let mut is_token_owner = LazyValue::new(|| Ok(test_case.is_token_owner));
 		let is_no_permission = test_case.no_permission;
 
-		let result = pallet_common::tests::check_token_permissions::<Test, _, _, FTE>(
+		let result = pallet_common::tests::check_token_permissions::<Test>(
 			collection_admin,
 			token_owner,
 			&mut is_collection_admin,
modifiedtests/src/eth/nativeFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/nativeFungible.test.ts
+++ b/tests/src/eth/nativeFungible.test.ts
@@ -33,7 +33,7 @@
     const collectionAddress = helper.ethAddress.fromCollectionId(0);
     const contract = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner);
 
-    await expect(contract.methods.approve(spender, 100).call({from: owner})).to.be.rejectedWith('Approve not supported');
+    await expect(contract.methods.approve(spender, 100).call({from: owner})).to.be.rejectedWith('approve not supported');
   });
 
   itEth('balanceOf()', async ({helper}) => {
@@ -170,4 +170,4 @@
 
     await expect(contract.methods.transferFromCross(receiver, receiver, 50).call({from: owner.eth})).to.be.rejectedWith('no permission');
   });
-});
\ No newline at end of file
+});
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -3119,9 +3119,9 @@
 
   async getTokenPropertiesConsumedSpace(tokenId: number): Promise<number> {
     const api = this.helper.getApi();
-    const props = (await api.query.nonfungible.tokenProperties(this.collectionId, tokenId)).toJSON();
+    const props = (await api.query.nonfungible.tokenProperties(this.collectionId, tokenId)).toJSON() as any;
 
-    return (props! as any).consumedSpace;
+    return props?.consumedSpace ?? 0;
   }
 
   async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId) {
@@ -3224,9 +3224,9 @@
 
   async getTokenPropertiesConsumedSpace(tokenId: number): Promise<number> {
     const api = this.helper.getApi();
-    const props = (await api.query.refungible.tokenProperties(this.collectionId, tokenId)).toJSON();
+    const props = (await api.query.refungible.tokenProperties(this.collectionId, tokenId)).toJSON() as any;
 
-    return (props! as any).consumedSpace;
+    return props?.consumedSpace ?? 0;
   }
 
   async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId, amount = 1n) {