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
before · pallets/common/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//! # Common pallet18//!19//! The Common pallet provides functionality for handling collections.20//!21//! ## Overview22//!23//! The Common pallet provides an interface for common collection operations for different collection types24//! (see [CommonCollectionOperations]), as well as a generic dispatcher for these, see [dispatch] module.25//! It also provides this functionality to EVM, see [erc] and [eth] modules.26//!27//! The Common pallet provides functions for:28//!29//! - Setting and approving collection sponsor.30//! - Get\set\delete allow list.31//! - Get\set\delete collection properties.32//! - Get\set\delete collection property permissions.33//! - Get\set\delete token property permissions.34//! - Get\set\delete collection administrators.35//! - Checking access permissions.36//!37//! ### Terminology38//! **Collection sponsor** - For the collection, you can set a sponsor, at whose expense it will39//! be possible to mint tokens.40//!41//! **Allow list** - List of users who have the right to minting tokens.42//!43//! **Collection properties** - Collection properties are simply key-value stores where various44//! metadata can be placed.45//!46//! **Permissions on token properties** - For each property in the token can be set permission47//! to change, see [`PropertyPermission`].48//!49//! **Collection administrator** - For a collection, you can set administrators who have the right50//! to most actions on the collection.5152#![warn(missing_docs)]53#![cfg_attr(not(feature = "std"), no_std)]54extern crate alloc;5556use core::{57	marker::PhantomData,58	ops::{Deref, DerefMut},59	slice::from_ref,60};6162use evm_coder::ToLog;63use frame_support::{64	dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, Pays, PostDispatchInfo},65	ensure, fail,66	traits::{67		fungible::{Balanced, Debt, Inspect},68		tokens::{Imbalance, Precision, Preservation},69		Get,70	},71	transactional,72};73pub use pallet::*;74use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};75use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};76use sp_core::H160;77use sp_runtime::{traits::Zero, ArithmeticError, DispatchError, DispatchResult};78use sp_std::vec::Vec;79use sp_weights::Weight;80use up_data_structs::{81	budget::Budget, AccessMode, Collection, CollectionId, CollectionLimits, CollectionMode,82	CollectionPermissions, CollectionProperties as CollectionPropertiesT, CollectionStats,83	CreateCollectionData, CreateItemData, CreateItemExData, PhantomType, PropertiesError,84	PropertiesPermissionMap, Property, PropertyKey, PropertyKeyPermission, PropertyPermission,85	PropertyScope, PropertyValue, RpcCollection, RpcCollectionFlags, SponsoringRateLimit,86	SponsorshipState, TokenChild, TokenData, TokenId, TokenOwnerError, TokenProperties,87	TrySetProperty, COLLECTION_ADMINS_LIMIT, COLLECTION_NUMBER_LIMIT, CUSTOM_DATA_LIMIT,88	FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MAX_SPONSOR_TIMEOUT, MAX_TOKEN_OWNERSHIP,89	MAX_TOKEN_PREFIX_LENGTH, NFT_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,90};91use up_pov_estimate_rpc::PovInfo;9293#[cfg(feature = "runtime-benchmarks")]94pub mod benchmarking;95pub mod dispatch;96pub mod erc;97pub mod eth;98pub mod helpers;99#[allow(missing_docs)]100pub mod weights;101102use weights::WeightInfo;103104/// Weight info.105pub type SelfWeightOf<T> = <T as Config>::WeightInfo;106107/// Collection handle contains information about collection data and id.108/// Also provides functionality to count consumed gas.109///110/// CollectionHandle is used as a generic wrapper for collections of all types (except native fungible).111/// It allows to perform common operations and queries on any collection type,112/// both completely general for all, as well as their respective implementations of [`CommonCollectionOperations`].113#[must_use = "Should call submit_logs or save, otherwise some data will be lost for evm side"]114pub struct CollectionHandle<T: Config> {115	/// Collection id116	pub id: CollectionId,117	collection: Collection<T::AccountId>,118	/// Substrate recorder for counting consumed gas119	pub recorder: SubstrateRecorder<T>,120}121122impl<T: Config> WithRecorder<T> for CollectionHandle<T> {123	fn recorder(&self) -> &SubstrateRecorder<T> {124		&self.recorder125	}126	fn into_recorder(self) -> SubstrateRecorder<T> {127		self.recorder128	}129}130131impl<T: Config> CollectionHandle<T> {132	/// Same as [CollectionHandle::new] but with an explicit gas limit.133	pub fn new_with_gas_limit(id: CollectionId, gas_limit: u64) -> Option<Self> {134		Self::new_with_recorder(id, SubstrateRecorder::new(gas_limit))135	}136137	/// Same as [CollectionHandle::new] but with an existed [`SubstrateRecorder`].138	pub fn new_with_recorder(id: CollectionId, recorder: SubstrateRecorder<T>) -> Option<Self> {139		<CollectionById<T>>::get(id).map(|collection| Self {140			id,141			collection,142			recorder,143		})144	}145146	/// Retrives collection data from storage and creates collection handle with default parameters.147	/// If collection not found return `None`148	pub fn new(id: CollectionId) -> Option<Self> {149		Self::new_with_gas_limit(id, u64::MAX)150	}151152	/// Same as [`CollectionHandle::new`] but if collection not found [CollectionNotFound](Error::CollectionNotFound) returned.153	pub fn try_get(id: CollectionId) -> Result<Self, DispatchError> {154		Ok(Self::new(id).ok_or(<Error<T>>::CollectionNotFound)?)155	}156157	/// Consume gas for reading.158	pub fn consume_store_reads(159		&self,160		reads: u64,161	) -> pallet_evm_coder_substrate::execution::Result<()> {162		self.recorder().consume_store_reads(reads)163	}164165	/// Consume gas for writing.166	pub fn consume_store_writes(167		&self,168		writes: u64,169	) -> pallet_evm_coder_substrate::execution::Result<()> {170		self.recorder().consume_store_writes(writes)171	}172173	/// Consume gas for reading and writing.174	pub fn consume_store_reads_and_writes(175		&self,176		reads: u64,177		writes: u64,178	) -> pallet_evm_coder_substrate::execution::Result<()> {179		self.recorder()180			.consume_store_reads_and_writes(reads, writes)181	}182183	/// Save collection to storage.184	pub fn save(&self) -> DispatchResult {185		<CollectionById<T>>::insert(self.id, &self.collection);186		Ok(())187	}188189	/// Set collection sponsor.190	///191	/// Unique collections allows sponsoring for certain actions.192	/// This method allows you to set the sponsor of the collection.193	/// In order for sponsorship to become active, it must be confirmed through [`Self::confirm_sponsorship`].194	pub fn set_sponsor(195		&mut self,196		sender: &T::CrossAccountId,197		sponsor: T::AccountId,198	) -> DispatchResult {199		self.check_is_internal()?;200		self.check_is_owner_or_admin(sender)?;201202		self.collection.sponsorship = SponsorshipState::Unconfirmed(sponsor.clone());203204		<Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorSet(self.id, sponsor));205		<PalletEvm<T>>::deposit_log(206			erc::CollectionHelpersEvents::CollectionChanged {207				collection_id: eth::collection_id_to_address(self.id),208			}209			.to_log(T::ContractAddress::get()),210		);211212		self.save()213	}214215	/// Force set `sponsor`.216	///217	/// Differs from [`set_sponsor`][`Self::set_sponsor`] in that confirmation218	/// from the `sponsor` is not required.219	///220	/// # Arguments221	///222	/// * `sponsor`: ID of the account of the sponsor-to-be.223	pub fn force_set_sponsor(&mut self, sponsor: T::AccountId) -> DispatchResult {224		self.check_is_internal()?;225226		self.collection.sponsorship = SponsorshipState::Confirmed(sponsor.clone());227228		<Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorSet(self.id, sponsor.clone()));229		<Pallet<T>>::deposit_event(Event::<T>::SponsorshipConfirmed(self.id, sponsor));230		<PalletEvm<T>>::deposit_log(231			erc::CollectionHelpersEvents::CollectionChanged {232				collection_id: eth::collection_id_to_address(self.id),233			}234			.to_log(T::ContractAddress::get()),235		);236237		self.save()238	}239240	/// Confirm sponsorship241	///242	/// In order for the sponsorship to become active, the user set as the sponsor must confirm their participation.243	/// Before confirming sponsorship, the user must be specified as the sponsor of the collection via [`Self::set_sponsor`].244	pub fn confirm_sponsorship(&mut self, sender: &T::AccountId) -> DispatchResult {245		self.check_is_internal()?;246		ensure!(247			self.collection.sponsorship.pending_sponsor() == Some(sender),248			Error::<T>::ConfirmSponsorshipFail249		);250251		self.collection.sponsorship = SponsorshipState::Confirmed(sender.clone());252253		<Pallet<T>>::deposit_event(Event::<T>::SponsorshipConfirmed(self.id, sender.clone()));254		<PalletEvm<T>>::deposit_log(255			erc::CollectionHelpersEvents::CollectionChanged {256				collection_id: eth::collection_id_to_address(self.id),257			}258			.to_log(T::ContractAddress::get()),259		);260261		self.save()262	}263264	/// Remove collection sponsor.265	pub fn remove_sponsor(&mut self, sender: &T::CrossAccountId) -> DispatchResult {266		self.check_is_internal()?;267		self.check_is_owner_or_admin(sender)?;268269		self.collection.sponsorship = SponsorshipState::Disabled;270271		<Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorRemoved(self.id));272		<PalletEvm<T>>::deposit_log(273			erc::CollectionHelpersEvents::CollectionChanged {274				collection_id: eth::collection_id_to_address(self.id),275			}276			.to_log(T::ContractAddress::get()),277		);278		self.save()279	}280281	/// Force remove `sponsor`.282	///283	/// Differs from `remove_sponsor` in that284	/// it doesn't require consent from the `owner` of the collection.285	pub fn force_remove_sponsor(&mut self) -> DispatchResult {286		self.check_is_internal()?;287288		self.collection.sponsorship = SponsorshipState::Disabled;289290		<Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorRemoved(self.id));291		<PalletEvm<T>>::deposit_log(292			erc::CollectionHelpersEvents::CollectionChanged {293				collection_id: eth::collection_id_to_address(self.id),294			}295			.to_log(T::ContractAddress::get()),296		);297		self.save()298	}299300	/// Checks that the collection was created with, and must be operated upon through **Unique API**.301	/// Now check only the `external` flag and if it's **true**, then return [`Error::CollectionIsExternal`] error.302	pub fn check_is_internal(&self) -> DispatchResult {303		if self.flags.external {304			return Err(<Error<T>>::CollectionIsExternal)?;305		}306307		Ok(())308	}309310	/// Checks that the collection was created with, and must be operated upon through an **assimilated API**.311	/// Now check only the `external` flag and if it's **false**, then return [`Error::CollectionIsInternal`] error.312	pub fn check_is_external(&self) -> DispatchResult {313		if !self.flags.external {314			return Err(<Error<T>>::CollectionIsInternal)?;315		}316317		Ok(())318	}319}320321impl<T: Config> Deref for CollectionHandle<T> {322	type Target = Collection<T::AccountId>;323324	fn deref(&self) -> &Self::Target {325		&self.collection326	}327}328329impl<T: Config> DerefMut for CollectionHandle<T> {330	fn deref_mut(&mut self) -> &mut Self::Target {331		&mut self.collection332	}333}334335impl<T: Config> CollectionHandle<T> {336	/// Checks if the `user` is the owner of the collection.337	pub fn check_is_owner(&self, user: &T::CrossAccountId) -> DispatchResult {338		ensure!(*user.as_sub() == self.owner, <Error<T>>::NoPermission);339		Ok(())340	}341342	/// Returns **true** if the `user` is the owner or administrator of the collection.343	pub fn is_owner_or_admin(&self, user: &T::CrossAccountId) -> bool {344		*user.as_sub() == self.owner || <IsAdmin<T>>::get((self.id, user))345	}346347	/// Checks if the `user` is the owner or administrator of the collection.348	pub fn check_is_owner_or_admin(&self, user: &T::CrossAccountId) -> DispatchResult {349		ensure!(self.is_owner_or_admin(user), <Error<T>>::NoPermission);350		Ok(())351	}352353	/// Returns **true** if354	/// * the `user`is a collection owner or admin355	/// * the collection limits allow the owner/admins to transfer/burn any collection token356	pub fn ignores_token_restrictions(&self, user: &T::CrossAccountId) -> bool {357		self.limits.owner_can_transfer() && self.is_owner_or_admin(user)358	}359360	/// Return **true** if `user` does not have enough token parts, and he can ignore such restrictions.361	pub fn ignores_owned_amount(&self, user: &T::CrossAccountId) -> bool {362		self.limits.owner_can_transfer() && self.is_owner_or_admin(user)363	}364365	/// Checks if the user is in the allow list. If not [Error::AddressNotInAllowlist] returns.366	pub fn check_allowlist(&self, user: &T::CrossAccountId) -> DispatchResult {367		ensure!(368			<Allowlist<T>>::get((self.id, user)),369			<Error<T>>::AddressNotInAllowlist370		);371		Ok(())372	}373374	/// Changes collection owner to another account375	/// #### Store read/writes376	/// 1 writes377	pub fn change_owner(378		&mut self,379		caller: T::CrossAccountId,380		new_owner: T::CrossAccountId,381	) -> DispatchResult {382		self.check_is_internal()?;383		self.check_is_owner(&caller)?;384		self.collection.owner = new_owner.as_sub().clone();385386		<Pallet<T>>::deposit_event(Event::<T>::CollectionOwnerChanged(387			self.id,388			new_owner.as_sub().clone(),389		));390		<PalletEvm<T>>::deposit_log(391			erc::CollectionHelpersEvents::CollectionChanged {392				collection_id: eth::collection_id_to_address(self.id),393			}394			.to_log(T::ContractAddress::get()),395		);396397		self.save()398	}399}400401#[frame_support::pallet]402pub mod pallet {403404	use dispatch::CollectionDispatch;405	use frame_support::{406		pallet_prelude::*, storage::Key, traits::StorageVersion, Blake2_128Concat,407	};408	use scale_info::TypeInfo;409	use up_data_structs::{mapping::TokenAddressMapping, TokenId};410	use weights::WeightInfo;411412	use super::*;413414	#[pallet::config]415	pub trait Config:416		frame_system::Config + pallet_evm_coder_substrate::Config + pallet_evm::Config + TypeInfo417	{418		/// Weight information for functions of this pallet.419		type WeightInfo: WeightInfo;420421		/// Events compatible with [`frame_system::Config::Event`].422		type RuntimeEvent: IsType<<Self as frame_system::Config>::RuntimeEvent> + From<Event<Self>>;423424		/// Handler of accounts and payment.425		type Currency: Balanced<Self::AccountId> + Inspect<Self::AccountId>;426427		/// Set price to create a collection.428		#[pallet::constant]429		type CollectionCreationPrice: Get<430			<<Self as Config>::Currency as Inspect<Self::AccountId>>::Balance,431		>;432433		/// Dispatcher of operations on collections.434		type CollectionDispatch: CollectionDispatch<Self>;435436		/// Account which holds the chain's treasury.437		type TreasuryAccountId: Get<Self::AccountId>;438439		/// Address under which the CollectionHelper contract would be available.440		#[pallet::constant]441		type ContractAddress: Get<H160>;442443		/// Mapper for token addresses to Ethereum addresses.444		type EvmTokenAddressMapping: TokenAddressMapping<H160>;445446		/// Mapper for token addresses to [`CrossAccountId`].447		type CrossTokenAddressMapping: TokenAddressMapping<Self::CrossAccountId>;448	}449450	const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);451	/// Collection id for native fungible collction.452	pub const NATIVE_FUNGIBLE_COLLECTION_ID: CollectionId = CollectionId(0);453454	#[pallet::pallet]455	#[pallet::storage_version(STORAGE_VERSION)]456	pub struct Pallet<T>(_);457458	#[pallet::extra_constants]459	impl<T: Config> Pallet<T> {460		/// Maximum admins per collection.461		pub fn collection_admins_limit() -> u32 {462			COLLECTION_ADMINS_LIMIT463		}464	}465466	#[pallet::genesis_config]467	pub struct GenesisConfig<T>(PhantomData<T>);468469	impl<T: Config> Default for GenesisConfig<T> {470		fn default() -> Self {471			Self(Default::default())472		}473	}474475	#[pallet::genesis_build]476	impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {477		fn build(&self) {478			StorageVersion::new(1).put::<Pallet<T>>();479		}480	}481482	impl<T: Config> Pallet<T> {483		/// Helper function that handles deposit events484		pub fn deposit_event(event: Event<T>) {485			let event = <T as Config>::RuntimeEvent::from(event);486			let event = event.into();487			<frame_system::Pallet<T>>::deposit_event(event)488		}489	}490491	#[pallet::event]492	pub enum Event<T: Config> {493		/// New collection was created494		CollectionCreated(495			/// Globally unique identifier of newly created collection.496			CollectionId,497			/// [`CollectionMode`] converted into _u8_.498			u8,499			/// Collection owner.500			T::AccountId,501		),502503		/// New collection was destroyed504		CollectionDestroyed(505			/// Globally unique identifier of collection.506			CollectionId,507		),508509		/// New item was created.510		ItemCreated(511			/// Id of the collection where item was created.512			CollectionId,513			/// Id of an item. Unique within the collection.514			TokenId,515			/// Owner of newly created item516			T::CrossAccountId,517			/// Always 1 for NFT518			u128,519		),520521		/// Collection item was burned.522		ItemDestroyed(523			/// Id of the collection where item was destroyed.524			CollectionId,525			/// Identifier of burned NFT.526			TokenId,527			/// Which user has destroyed its tokens.528			T::CrossAccountId,529			/// Amount of token pieces destroed. Always 1 for NFT.530			u128,531		),532533		/// Item was transferred534		Transfer(535			/// Id of collection to which item is belong.536			CollectionId,537			/// Id of an item.538			TokenId,539			/// Original owner of item.540			T::CrossAccountId,541			/// New owner of item.542			T::CrossAccountId,543			/// Amount of token pieces transfered. Always 1 for NFT.544			u128,545		),546547		/// Amount pieces of token owned by `sender` was approved for `spender`.548		Approved(549			/// Id of collection to which item is belong.550			CollectionId,551			/// Id of an item.552			TokenId,553			/// Original owner of item.554			T::CrossAccountId,555			/// Id for which the approval was granted.556			T::CrossAccountId,557			/// Amount of token pieces transfered. Always 1 for NFT.558			u128,559		),560561		/// A `sender` approves operations on all owned tokens for `spender`.562		ApprovedForAll(563			/// Id of collection to which item is belong.564			CollectionId,565			/// Owner of a wallet.566			T::CrossAccountId,567			/// Id for which operator status was granted or rewoked.568			T::CrossAccountId,569			/// Is operator status granted or revoked?570			bool,571		),572573		/// The colletion property has been added or edited.574		CollectionPropertySet(575			/// Id of collection to which property has been set.576			CollectionId,577			/// The property that was set.578			PropertyKey,579		),580581		/// The property has been deleted.582		CollectionPropertyDeleted(583			/// Id of collection to which property has been deleted.584			CollectionId,585			/// The property that was deleted.586			PropertyKey,587		),588589		/// The token property has been added or edited.590		TokenPropertySet(591			/// Identifier of the collection whose token has the property set.592			CollectionId,593			/// The token for which the property was set.594			TokenId,595			/// The property that was set.596			PropertyKey,597		),598599		/// The token property has been deleted.600		TokenPropertyDeleted(601			/// Identifier of the collection whose token has the property deleted.602			CollectionId,603			/// The token for which the property was deleted.604			TokenId,605			/// The property that was deleted.606			PropertyKey,607		),608609		/// The token property permission of a collection has been set.610		PropertyPermissionSet(611			/// ID of collection to which property permission has been set.612			CollectionId,613			/// The property permission that was set.614			PropertyKey,615		),616617		/// Address was added to the allow list.618		AllowListAddressAdded(619			/// ID of the affected collection.620			CollectionId,621			/// Address of the added account.622			T::CrossAccountId,623		),624625		/// Address was removed from the allow list.626		AllowListAddressRemoved(627			/// ID of the affected collection.628			CollectionId,629			/// Address of the removed account.630			T::CrossAccountId,631		),632633		/// Collection admin was added.634		CollectionAdminAdded(635			/// ID of the affected collection.636			CollectionId,637			/// Admin address.638			T::CrossAccountId,639		),640641		/// Collection admin was removed.642		CollectionAdminRemoved(643			/// ID of the affected collection.644			CollectionId,645			/// Removed admin address.646			T::CrossAccountId,647		),648649		/// Collection limits were set.650		CollectionLimitSet(651			/// ID of the affected collection.652			CollectionId,653		),654655		/// Collection owned was changed.656		CollectionOwnerChanged(657			/// ID of the affected collection.658			CollectionId,659			/// New owner address.660			T::AccountId,661		),662663		/// Collection permissions were set.664		CollectionPermissionSet(665			/// ID of the affected collection.666			CollectionId,667		),668669		/// Collection sponsor was set.670		CollectionSponsorSet(671			/// ID of the affected collection.672			CollectionId,673			/// New sponsor address.674			T::AccountId,675		),676677		/// New sponsor was confirm.678		SponsorshipConfirmed(679			/// ID of the affected collection.680			CollectionId,681			/// New sponsor address.682			T::AccountId,683		),684685		/// Collection sponsor was removed.686		CollectionSponsorRemoved(687			/// ID of the affected collection.688			CollectionId,689		),690	}691692	#[pallet::error]693	pub enum Error<T> {694		/// This collection does not exist.695		CollectionNotFound,696		/// Sender parameter and item owner must be equal.697		MustBeTokenOwner,698		/// No permission to perform action699		NoPermission,700		/// Destroying only empty collections is allowed701		CantDestroyNotEmptyCollection,702		/// Collection is not in mint mode.703		PublicMintingNotAllowed,704		/// Address is not in allow list.705		AddressNotInAllowlist,706707		/// Collection name can not be longer than 63 char.708		CollectionNameLimitExceeded,709		/// Collection description can not be longer than 255 char.710		CollectionDescriptionLimitExceeded,711		/// Token prefix can not be longer than 15 char.712		CollectionTokenPrefixLimitExceeded,713		/// Total collections bound exceeded.714		TotalCollectionsLimitExceeded,715		/// Exceeded max admin count716		CollectionAdminCountExceeded,717		/// Collection limit bounds per collection exceeded718		CollectionLimitBoundsExceeded,719		/// Tried to enable permissions which are only permitted to be disabled720		OwnerPermissionsCantBeReverted,721		/// Collection settings not allowing items transferring722		TransferNotAllowed,723		/// Account token limit exceeded per collection724		AccountTokenLimitExceeded,725		/// Collection token limit exceeded726		CollectionTokenLimitExceeded,727		/// Metadata flag frozen728		MetadataFlagFrozen,729730		/// Item does not exist731		TokenNotFound,732		/// Item is balance not enough733		TokenValueTooLow,734		/// Requested value is more than the approved735		ApprovedValueTooLow,736		/// Tried to approve more than owned737		CantApproveMoreThanOwned,738		/// Only spending from eth mirror could be approved739		AddressIsNotEthMirror,740741		/// Can't transfer tokens to ethereum zero address742		AddressIsZero,743744		/// The operation is not supported745		UnsupportedOperation,746747		/// Insufficient funds to perform an action748		NotSufficientFounds,749750		/// User does not satisfy the nesting rule751		UserIsNotAllowedToNest,752		/// Only tokens from specific collections may nest tokens under this one753		SourceCollectionIsNotAllowedToNest,754755		/// Tried to store more data than allowed in collection field756		CollectionFieldSizeExceeded,757758		/// Tried to store more property data than allowed759		NoSpaceForProperty,760761		/// Tried to store more property keys than allowed762		PropertyLimitReached,763764		/// Property key is too long765		PropertyKeyIsTooLong,766767		/// Only ASCII letters, digits, and symbols `_`, `-`, and `.` are allowed768		InvalidCharacterInPropertyKey,769770		/// Empty property keys are forbidden771		EmptyPropertyKey,772773		/// Tried to access an external collection with an internal API774		CollectionIsExternal,775776		/// Tried to access an internal collection with an external API777		CollectionIsInternal,778779		/// This address is not set as sponsor, use setCollectionSponsor first.780		ConfirmSponsorshipFail,781782		/// The user is not an administrator.783		UserIsNotCollectionAdmin,784	}785786	/// Storage of the count of created collections. Essentially contains the last collection ID.787	#[pallet::storage]788	pub type CreatedCollectionCount<T> = StorageValue<Value = CollectionId, QueryKind = ValueQuery>;789790	/// Storage of the count of deleted collections.791	#[pallet::storage]792	pub type DestroyedCollectionCount<T> =793		StorageValue<Value = CollectionId, QueryKind = ValueQuery>;794795	/// Storage of collection info.796	#[pallet::storage]797	pub type CollectionById<T> = StorageMap<798		Hasher = Blake2_128Concat,799		Key = CollectionId,800		Value = Collection<<T as frame_system::Config>::AccountId>,801		QueryKind = OptionQuery,802	>;803804	/// Storage of collection properties.805	#[pallet::storage]806	#[pallet::getter(fn collection_properties)]807	pub type CollectionProperties<T> = StorageMap<808		Hasher = Blake2_128Concat,809		Key = CollectionId,810		Value = CollectionPropertiesT,811		QueryKind = ValueQuery,812	>;813814	/// Storage of token property permissions of a collection.815	#[pallet::storage]816	#[pallet::getter(fn property_permissions)]817	pub type CollectionPropertyPermissions<T> = StorageMap<818		Hasher = Blake2_128Concat,819		Key = CollectionId,820		Value = PropertiesPermissionMap,821		QueryKind = ValueQuery,822	>;823824	/// Storage of the amount of collection admins.825	#[pallet::storage]826	pub type AdminAmount<T> = StorageMap<827		Hasher = Blake2_128Concat,828		Key = CollectionId,829		Value = u32,830		QueryKind = ValueQuery,831	>;832833	/// List of collection admins.834	#[pallet::storage]835	pub type IsAdmin<T: Config> = StorageNMap<836		Key = (837			Key<Blake2_128Concat, CollectionId>,838			Key<Blake2_128Concat, T::CrossAccountId>,839		),840		Value = bool,841		QueryKind = ValueQuery,842	>;843844	/// Allowlisted collection users.845	#[pallet::storage]846	pub type Allowlist<T: Config> = StorageNMap<847		Key = (848			Key<Blake2_128Concat, CollectionId>,849			Key<Blake2_128Concat, T::CrossAccountId>,850		),851		Value = bool,852		QueryKind = ValueQuery,853	>;854855	/// Not used by code, exists only to provide some types to metadata.856	#[pallet::storage]857	pub type DummyStorageValue<T: Config> = StorageValue<858		Value = (859			CollectionStats,860			CollectionId,861			TokenId,862			TokenChild,863			PhantomType<(864				TokenData<T::CrossAccountId>,865				RpcCollection<T::AccountId>,866				// PoV Estimate Info867				PovInfo,868			)>,869		),870		QueryKind = OptionQuery,871	>;872}873874/// Value representation with delayed initialization time.875pub struct LazyValue<T, F: FnOnce() -> T> {876	value: Option<T>,877	f: Option<F>,878}879880impl<T, F: FnOnce() -> T> LazyValue<T, F> {881	/// Create a new LazyValue.882	pub fn new(f: F) -> Self {883		Self {884			value: None,885			f: Some(f),886		}887	}888889	/// Get the value. If it is called the first time, the value will be initialized.890	pub fn value(&mut self) -> &T {891		self.force_value();892		self.value.as_ref().unwrap()893	}894895	/// Get the value. If it is called the first time, the value will be initialized.896	pub fn value_mut(&mut self) -> &mut T {897		self.force_value();898		self.value.as_mut().unwrap()899	}900901	fn into_inner(mut self) -> T {902		self.force_value();903		self.value.unwrap()904	}905906	/// Is value initialized?907	pub fn has_value(&self) -> bool {908		self.value.is_some()909	}910911	fn force_value(&mut self) {912		if self.value.is_none() {913			self.value = Some(self.f.take().unwrap()())914		}915	}916}917918fn check_token_permissions<T, FCA, FTO, FTE>(919	collection_admin_permitted: bool,920	token_owner_permitted: bool,921	is_collection_admin: &mut LazyValue<bool, FCA>,922	is_token_owner: &mut LazyValue<Result<bool, DispatchError>, FTO>,923	is_token_exist: &mut LazyValue<bool, FTE>,924) -> DispatchResult925where926	T: Config,927	FCA: FnOnce() -> bool,928	FTO: FnOnce() -> Result<bool, DispatchError>,929	FTE: FnOnce() -> bool,930{931	if !(collection_admin_permitted && *is_collection_admin.value()932		|| token_owner_permitted && (*is_token_owner.value())?)933	{934		fail!(<Error<T>>::NoPermission);935	}936937	let token_exist_due_to_owner_check_success =938		is_token_owner.has_value() && (*is_token_owner.value())?;939940	// If the token owner check has occurred and succeeded,941	// we know the token exists (otherwise, the owner check must fail).942	if !token_exist_due_to_owner_check_success {943		// If the token owner check didn't occur,944		// we must check the token's existence ourselves.945		if !is_token_exist.value() {946			fail!(<Error<T>>::TokenNotFound);947		}948	}949950	Ok(())951}952953impl<T: Config> Pallet<T> {954	/// Enshure that receiver address is correct.955	///956	/// Ethereum receiver 0x0000000000000000000000000000000000000000 is reserved, and shouldn't own tokens.957	pub fn ensure_correct_receiver(receiver: &T::CrossAccountId) -> DispatchResult {958		ensure!(959			&T::CrossAccountId::from_eth(H160([0; 20])) != receiver,960			<Error<T>>::AddressIsZero961		);962		Ok(())963	}964965	/// Get a vector of collection admins.966	pub fn adminlist(collection: CollectionId) -> Vec<T::CrossAccountId> {967		<IsAdmin<T>>::iter_prefix((collection,))968			.map(|(a, _)| a)969			.collect()970	}971972	/// Get a vector of users allowed to mint tokens.973	pub fn allowlist(collection: CollectionId) -> Vec<T::CrossAccountId> {974		<Allowlist<T>>::iter_prefix((collection,))975			.map(|(a, _)| a)976			.collect()977	}978979	/// Is `user` allowed to mint token in `collection`.980	pub fn allowed(collection: CollectionId, user: T::CrossAccountId) -> bool {981		<Allowlist<T>>::get((collection, user))982	}983984	/// Get statistics of collections.985	pub fn collection_stats() -> CollectionStats {986		let created = <CreatedCollectionCount<T>>::get();987		let destroyed = <DestroyedCollectionCount<T>>::get();988		CollectionStats {989			created: created.0,990			destroyed: destroyed.0,991			alive: created.0 - destroyed.0,992		}993	}994995	/// Get the effective limits for the collection.996	pub fn effective_collection_limits(collection: CollectionId) -> Option<CollectionLimits> {997		let collection = <CollectionById<T>>::get(collection)?;998		let limits = collection.limits;999		let effective_limits = CollectionLimits {1000			account_token_ownership_limit: Some(limits.account_token_ownership_limit()),1001			sponsored_data_size: Some(limits.sponsored_data_size()),1002			sponsored_data_rate_limit: Some(1003				limits1004					.sponsored_data_rate_limit1005					.unwrap_or(SponsoringRateLimit::SponsoringDisabled),1006			),1007			token_limit: Some(limits.token_limit()),1008			sponsor_transfer_timeout: Some(limits.sponsor_transfer_timeout(1009				match collection.mode {1010					CollectionMode::NFT => NFT_SPONSOR_TRANSFER_TIMEOUT,1011					CollectionMode::Fungible(_) => FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,1012					CollectionMode::ReFungible => REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,1013				},1014			)),1015			sponsor_approve_timeout: Some(limits.sponsor_approve_timeout()),1016			owner_can_transfer: Some(limits.owner_can_transfer()),1017			owner_can_destroy: Some(limits.owner_can_destroy()),1018			transfers_enabled: Some(limits.transfers_enabled()),1019		};10201021		Some(effective_limits)1022	}10231024	/// Returns information about the `collection` adapted for rpc.1025	pub fn rpc_collection(collection: CollectionId) -> Option<RpcCollection<T::AccountId>> {1026		let Collection {1027			name,1028			description,1029			owner,1030			mode,1031			token_prefix,1032			sponsorship,1033			limits,1034			permissions,1035			flags,1036		} = <CollectionById<T>>::get(collection)?;10371038		let token_property_permissions = <CollectionPropertyPermissions<T>>::get(collection)1039			.into_iter()1040			.map(|(key, permission)| PropertyKeyPermission { key, permission })1041			.collect();10421043		let properties = <CollectionProperties<T>>::get(collection)1044			.into_iter()1045			.map(|(key, value)| Property { key, value })1046			.collect();10471048		let permissions = CollectionPermissions {1049			access: Some(permissions.access()),1050			mint_mode: Some(permissions.mint_mode()),1051			nesting: Some(permissions.nesting().clone()),1052		};10531054		Some(RpcCollection {1055			name: name.into_inner(),1056			description: description.into_inner(),1057			owner,1058			mode,1059			token_prefix: token_prefix.into_inner(),1060			sponsorship,1061			limits,1062			permissions,1063			token_property_permissions,1064			properties,1065			read_only: flags.external,10661067			flags: RpcCollectionFlags {1068				foreign: flags.foreign,1069				erc721metadata: flags.erc721metadata,1070			},1071		})1072	}1073}10741075macro_rules! limit_default {1076	($old:ident, $new:ident, $($field:ident $(($arg:expr))? => $check:expr),* $(,)?) => {{1077		$(1078			if let Some($new) = $new.$field {1079				let $old = $old.$field($($arg)?);1080				let _ = $new;1081				let _ = $old;1082				$check1083			} else {1084				$new.$field = $old.$field1085			}1086		)*1087	}};1088}1089macro_rules! limit_default_clone {1090	($old:ident, $new:ident, $($field:ident $(($arg:expr))? => $check:expr),* $(,)?) => {{1091		$(1092			if let Some($new) = $new.$field.clone() {1093				let $old = $old.$field($($arg)?);1094				let _ = $new;1095				let _ = $old;1096				$check1097			} else {1098				$new.$field = $old.$field.clone()1099			}1100		)*1101	}};1102}11031104impl<T: Config> Pallet<T> {1105	/// Create new collection.1106	///1107	/// * `owner` - The owner of the collection.1108	/// * `data` - Description of the created collection.1109	/// * `flags` - Extra flags to store.1110	pub fn init_collection(1111		owner: T::CrossAccountId,1112		payer: T::CrossAccountId,1113		data: CreateCollectionData<T::CrossAccountId>,1114	) -> Result<CollectionId, DispatchError> {1115		ensure!(data.flags.is_allowed_for_user(), <Error<T>>::NoPermission);1116		Self::init_collection_internal(owner, payer, data)1117	}11181119	/// Initializes the collection with ForeignCollection flag. Returns [CollectionId] on success, [DispatchError] otherwise.1120	pub fn init_foreign_collection(1121		owner: T::CrossAccountId,1122		payer: T::CrossAccountId,1123		mut data: CreateCollectionData<T::CrossAccountId>,1124	) -> Result<CollectionId, DispatchError> {1125		data.flags.foreign = true;1126		let id = Self::init_collection_internal(owner, payer, data)?;1127		Ok(id)1128	}11291130	fn init_collection_internal(1131		owner: T::CrossAccountId,1132		payer: T::CrossAccountId,1133		data: CreateCollectionData<T::CrossAccountId>,1134	) -> Result<CollectionId, DispatchError> {1135		{1136			ensure!(1137				data.token_prefix.len() <= MAX_TOKEN_PREFIX_LENGTH as usize,1138				Error::<T>::CollectionTokenPrefixLimitExceeded1139			);1140		}11411142		let created_count = <CreatedCollectionCount<T>>::get()1143			.01144			.checked_add(1)1145			.ok_or(ArithmeticError::Overflow)?;1146		let destroyed_count = <DestroyedCollectionCount<T>>::get().0;1147		let id = CollectionId(created_count);11481149		// bound Total number of collections1150		ensure!(1151			created_count - destroyed_count <= COLLECTION_NUMBER_LIMIT,1152			<Error<T>>::TotalCollectionsLimitExceeded1153		);11541155		// =========11561157		let collection = Collection {1158			owner: owner.as_sub().clone(),1159			name: data.name,1160			mode: data.mode.clone(),1161			description: data.description,1162			token_prefix: data.token_prefix,1163			sponsorship: data1164				.pending_sponsor1165				.map(|sponsor| SponsorshipState::Unconfirmed(sponsor.as_sub().clone()))1166				.unwrap_or_default(),1167			limits: data1168				.limits1169				.map(|limits| Self::clamp_limits(data.mode.clone(), &Default::default(), limits))1170				.unwrap_or_else(|| Ok(CollectionLimits::default()))?,1171			permissions: data1172				.permissions1173				.map(|permissions| {1174					Self::clamp_permissions(data.mode.clone(), &Default::default(), permissions)1175				})1176				.unwrap_or_else(|| Ok(CollectionPermissions::default()))?,1177			flags: data.flags,1178		};11791180		let mut collection_properties = CollectionPropertiesT::new();1181		collection_properties1182			.try_set_from_iter(data.properties.into_iter())1183			.map_err(<Error<T>>::from)?;11841185		CollectionProperties::<T>::insert(id, collection_properties);11861187		let mut token_props_permissions = PropertiesPermissionMap::new();1188		token_props_permissions1189			.try_set_from_iter(data.token_property_permissions.into_iter())1190			.map_err(<Error<T>>::from)?;11911192		CollectionPropertyPermissions::<T>::insert(id, token_props_permissions);11931194		let mut admin_amount = 0u32;1195		for admin in data.admin_list.iter() {1196			if !<IsAdmin<T>>::get((id, admin)) {1197				<IsAdmin<T>>::insert((id, admin), true);1198				admin_amount = admin_amount1199					.checked_add(1)1200					.ok_or(<Error<T>>::CollectionAdminCountExceeded)?;1201			}1202		}1203		ensure!(1204			admin_amount <= Self::collection_admins_limit(),1205			<Error<T>>::CollectionAdminCountExceeded,1206		);1207		<AdminAmount<T>>::insert(id, admin_amount);12081209		// Take a (non-refundable) deposit of collection creation1210		{1211			let mut imbalance = <Debt<T::AccountId, <T as Config>::Currency>>::zero();1212			imbalance.subsume(<T as Config>::Currency::deposit(1213				&T::TreasuryAccountId::get(),1214				T::CollectionCreationPrice::get(),1215				Precision::Exact,1216			)?);1217			let credit =1218				<T as Config>::Currency::settle(payer.as_sub(), imbalance, Preservation::Preserve)1219					.map_err(|_| Error::<T>::NotSufficientFounds)?;12201221			debug_assert!(credit.peek().is_zero())1222		}12231224		<CreatedCollectionCount<T>>::put(created_count);1225		<Pallet<T>>::deposit_event(Event::CollectionCreated(1226			id,1227			data.mode.id(),1228			owner.as_sub().clone(),1229		));1230		<PalletEvm<T>>::deposit_log(1231			erc::CollectionHelpersEvents::CollectionCreated {1232				owner: *owner.as_eth(),1233				collection_id: eth::collection_id_to_address(id),1234			}1235			.to_log(T::ContractAddress::get()),1236		);1237		<CollectionById<T>>::insert(id, collection);1238		Ok(id)1239	}12401241	/// Destroy collection.1242	///1243	/// * `collection` - Collection handler.1244	/// * `sender` - The owner or administrator of the collection.1245	pub fn destroy_collection(1246		collection: CollectionHandle<T>,1247		sender: &T::CrossAccountId,1248	) -> DispatchResult {1249		ensure!(1250			collection.limits.owner_can_destroy(),1251			<Error<T>>::NoPermission,1252		);1253		collection.check_is_owner(sender)?;12541255		let destroyed_collections = <DestroyedCollectionCount<T>>::get()1256			.01257			.checked_add(1)1258			.ok_or(ArithmeticError::Overflow)?;12591260		// =========12611262		<DestroyedCollectionCount<T>>::put(destroyed_collections);1263		<CollectionById<T>>::remove(collection.id);1264		<AdminAmount<T>>::remove(collection.id);1265		let _ = <IsAdmin<T>>::clear_prefix((collection.id,), u32::MAX, None);1266		let _ = <Allowlist<T>>::clear_prefix((collection.id,), u32::MAX, None);1267		<CollectionProperties<T>>::remove(collection.id);12681269		<Pallet<T>>::deposit_event(Event::CollectionDestroyed(collection.id));12701271		<PalletEvm<T>>::deposit_log(1272			erc::CollectionHelpersEvents::CollectionDestroyed {1273				collection_id: eth::collection_id_to_address(collection.id),1274			}1275			.to_log(T::ContractAddress::get()),1276		);1277		Ok(())1278	}12791280	/// This function sets or removes a collection properties according to1281	/// `properties_updates` contents:1282	/// * sets a property under the <key> with the value provided `(<key>, Some(<value>))`1283	/// * removes a property under the <key> if the value is `None` `(<key>, None)`.1284	///1285	/// This function fires an event for each property change.1286	/// In case of an error, all the changes (including the events) will be reverted1287	/// since the function is transactional.1288	#[transactional]1289	fn modify_collection_properties(1290		collection: &CollectionHandle<T>,1291		sender: &T::CrossAccountId,1292		properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,1293	) -> DispatchResult {1294		collection.check_is_owner_or_admin(sender)?;12951296		let mut stored_properties = <CollectionProperties<T>>::get(collection.id);12971298		for (key, value) in properties_updates {1299			match value {1300				Some(value) => {1301					stored_properties1302						.try_set(key.clone(), value)1303						.map_err(<Error<T>>::from)?;13041305					Self::deposit_event(Event::CollectionPropertySet(collection.id, key));1306					<PalletEvm<T>>::deposit_log(1307						erc::CollectionHelpersEvents::CollectionChanged {1308							collection_id: eth::collection_id_to_address(collection.id),1309						}1310						.to_log(T::ContractAddress::get()),1311					);1312				}1313				None => {1314					stored_properties.remove(&key).map_err(<Error<T>>::from)?;13151316					Self::deposit_event(Event::CollectionPropertyDeleted(collection.id, key));1317					<PalletEvm<T>>::deposit_log(1318						erc::CollectionHelpersEvents::CollectionChanged {1319							collection_id: eth::collection_id_to_address(collection.id),1320						}1321						.to_log(T::ContractAddress::get()),1322					);1323				}1324			}1325		}13261327		<CollectionProperties<T>>::set(collection.id, stored_properties);13281329		Ok(())1330	}13311332	/// Sets or unsets the approval of a given operator.1333	///1334	/// The `operator` is allowed to transfer all token pieces of the `owner` on their behalf.1335	/// - `owner`: Token owner1336	/// - `operator`: Operator1337	/// - `approve`: Should operator status be granted or revoked?1338	pub fn set_allowance_for_all(1339		collection: &CollectionHandle<T>,1340		owner: &T::CrossAccountId,1341		operator: &T::CrossAccountId,1342		approve: bool,1343		set_allowance: impl FnOnce(),1344		log: evm_coder::ethereum::Log,1345	) -> DispatchResult {1346		if collection.permissions.access() == AccessMode::AllowList {1347			collection.check_allowlist(owner)?;1348			collection.check_allowlist(operator)?;1349		}13501351		Self::ensure_correct_receiver(operator)?;13521353		set_allowance();13541355		<PalletEvm<T>>::deposit_log(log);1356		Self::deposit_event(Event::ApprovedForAll(1357			collection.id,1358			owner.clone(),1359			operator.clone(),1360			approve,1361		));1362		Ok(())1363	}13641365	/// Set collection property.1366	///1367	/// * `collection` - Collection handler.1368	/// * `sender` - The owner or administrator of the collection.1369	/// * `property` - The property to set.1370	pub fn set_collection_property(1371		collection: &CollectionHandle<T>,1372		sender: &T::CrossAccountId,1373		property: Property,1374	) -> DispatchResult {1375		Self::set_collection_properties(collection, sender, [property].into_iter())1376	}13771378	/// Set a scoped collection property, where the scope is a special prefix1379	/// prohibiting a user access to change the property directly.1380	///1381	/// * `collection_id` - ID of the collection for which the property is being set.1382	/// * `scope` - Property scope.1383	/// * `property` - The property to set.1384	pub fn set_scoped_collection_property(1385		collection_id: CollectionId,1386		scope: PropertyScope,1387		property: Property,1388	) -> DispatchResult {1389		CollectionProperties::<T>::try_mutate(collection_id, |properties| {1390			properties.try_scoped_set(scope, property.key, property.value)1391		})1392		.map_err(<Error<T>>::from)?;13931394		Ok(())1395	}13961397	/// Set scoped collection properties, where the scope is a special prefix1398	/// prohibiting a user access to change the properties directly.1399	///1400	/// * `collection_id` - ID of the collection for which the properties is being set.1401	/// * `scope` - Property scope.1402	/// * `properties` - The properties to set.1403	pub fn set_scoped_collection_properties(1404		collection_id: CollectionId,1405		scope: PropertyScope,1406		properties: impl Iterator<Item = Property>,1407	) -> DispatchResult {1408		CollectionProperties::<T>::try_mutate(collection_id, |stored_properties| {1409			stored_properties.try_scoped_set_from_iter(scope, properties)1410		})1411		.map_err(<Error<T>>::from)?;14121413		Ok(())1414	}14151416	/// Set collection properties.1417	///1418	/// * `collection` - Collection handler.1419	/// * `sender` - The owner or administrator of the collection.1420	/// * `properties` - The properties to set.1421	pub fn set_collection_properties(1422		collection: &CollectionHandle<T>,1423		sender: &T::CrossAccountId,1424		properties: impl Iterator<Item = Property>,1425	) -> DispatchResult {1426		Self::modify_collection_properties(1427			collection,1428			sender,1429			properties.map(|property| (property.key, Some(property.value))),1430		)1431	}14321433	/// Delete collection property.1434	///1435	/// * `collection` - Collection handler.1436	/// * `sender` - The owner or administrator of the collection.1437	/// * `property` - The property to delete.1438	pub fn delete_collection_property(1439		collection: &CollectionHandle<T>,1440		sender: &T::CrossAccountId,1441		property_key: PropertyKey,1442	) -> DispatchResult {1443		Self::delete_collection_properties(collection, sender, [property_key].into_iter())1444	}14451446	/// Delete collection properties.1447	///1448	/// * `collection` - Collection handler.1449	/// * `sender` - The owner or administrator of the collection.1450	/// * `properties` - The properties to delete.1451	pub fn delete_collection_properties(1452		collection: &CollectionHandle<T>,1453		sender: &T::CrossAccountId,1454		property_keys: impl Iterator<Item = PropertyKey>,1455	) -> DispatchResult {1456		Self::modify_collection_properties(collection, sender, property_keys.map(|key| (key, None)))1457	}14581459	/// Set collection propetry permission without any checks.1460	///1461	/// Used for migrations.1462	///1463	/// * `collection` - Collection handler.1464	/// * `property_permissions` - Property permissions.1465	pub fn set_property_permission_unchecked(1466		collection: CollectionId,1467		property_permission: PropertyKeyPermission,1468	) -> DispatchResult {1469		<CollectionPropertyPermissions<T>>::try_mutate(collection, |permissions| {1470			permissions.try_set(property_permission.key, property_permission.permission)1471		})1472		.map_err(<Error<T>>::from)?;1473		Ok(())1474	}14751476	/// Set collection property permission.1477	///1478	/// * `collection` - Collection handler.1479	/// * `sender` - The owner or administrator of the collection.1480	/// * `property_permission` - Property permission.1481	pub fn set_property_permission(1482		collection: &CollectionHandle<T>,1483		sender: &T::CrossAccountId,1484		property_permission: PropertyKeyPermission,1485	) -> DispatchResult {1486		Self::set_scoped_property_permission(1487			collection,1488			sender,1489			PropertyScope::None,1490			property_permission,1491		)1492	}14931494	/// Set collection property permission with scope.1495	///1496	/// * `collection` - Collection handler.1497	/// * `sender` - The owner or administrator of the collection.1498	/// * `scope` - Property scope.1499	/// * `property_permission` - Property permission.1500	pub fn set_scoped_property_permission(1501		collection: &CollectionHandle<T>,1502		sender: &T::CrossAccountId,1503		scope: PropertyScope,1504		property_permission: PropertyKeyPermission,1505	) -> DispatchResult {1506		collection.check_is_owner_or_admin(sender)?;15071508		let all_permissions = CollectionPropertyPermissions::<T>::get(collection.id);1509		let current_permission = all_permissions.get(&property_permission.key);1510		if matches![1511			current_permission,1512			Some(PropertyPermission { mutable: false, .. })1513		] {1514			return Err(<Error<T>>::NoPermission.into());1515		}15161517		CollectionPropertyPermissions::<T>::try_mutate(collection.id, |permissions| {1518			let property_permission = property_permission.clone();1519			permissions.try_scoped_set(1520				scope,1521				property_permission.key,1522				property_permission.permission,1523			)1524		})1525		.map_err(<Error<T>>::from)?;15261527		Self::deposit_event(Event::PropertyPermissionSet(1528			collection.id,1529			property_permission.key,1530		));1531		<PalletEvm<T>>::deposit_log(1532			erc::CollectionHelpersEvents::CollectionChanged {1533				collection_id: eth::collection_id_to_address(collection.id),1534			}1535			.to_log(T::ContractAddress::get()),1536		);15371538		Ok(())1539	}15401541	/// Set token property permission.1542	///1543	/// * `collection` - Collection handler.1544	/// * `sender` - The owner or administrator of the collection.1545	/// * `property_permissions` - Property permissions.1546	#[transactional]1547	pub fn set_token_property_permissions(1548		collection: &CollectionHandle<T>,1549		sender: &T::CrossAccountId,1550		property_permissions: Vec<PropertyKeyPermission>,1551	) -> DispatchResult {1552		Self::set_scoped_token_property_permissions(1553			collection,1554			sender,1555			PropertyScope::None,1556			property_permissions,1557		)1558	}15591560	/// Set token property permission with scope.1561	///1562	/// * `collection` - Collection handler.1563	/// * `sender` - The owner or administrator of the collection.1564	/// * `scope` - Property scope.1565	/// * `property_permissions` - Property permissions.1566	#[transactional]1567	pub fn set_scoped_token_property_permissions(1568		collection: &CollectionHandle<T>,1569		sender: &T::CrossAccountId,1570		scope: PropertyScope,1571		property_permissions: Vec<PropertyKeyPermission>,1572	) -> DispatchResult {1573		for prop_pemission in property_permissions {1574			Self::set_scoped_property_permission(collection, sender, scope, prop_pemission)?;1575		}15761577		Ok(())1578	}15791580	/// Get collection property.1581	pub fn get_collection_property(1582		collection_id: CollectionId,1583		key: &PropertyKey,1584	) -> Option<PropertyValue> {1585		Self::collection_properties(collection_id).get(key).cloned()1586	}15871588	/// Convert byte vector to property key vector.1589	pub fn bytes_keys_to_property_keys(1590		keys: Vec<Vec<u8>>,1591	) -> Result<Vec<PropertyKey>, DispatchError> {1592		keys.into_iter()1593			.map(|key| -> Result<PropertyKey, DispatchError> {1594				key.try_into()1595					.map_err(|_| <Error<T>>::PropertyKeyIsTooLong.into())1596			})1597			.collect::<Result<Vec<PropertyKey>, DispatchError>>()1598	}15991600	/// Get properties according to given keys.1601	pub fn filter_collection_properties(1602		collection_id: CollectionId,1603		keys: Option<Vec<PropertyKey>>,1604	) -> Result<Vec<Property>, DispatchError> {1605		let properties = Self::collection_properties(collection_id);16061607		let properties = keys1608			.map(|keys| {1609				keys.into_iter()1610					.filter_map(|key| {1611						properties.get(&key).map(|value| Property {1612							key,1613							value: value.clone(),1614						})1615					})1616					.collect()1617			})1618			.unwrap_or_else(|| {1619				properties1620					.into_iter()1621					.map(|(key, value)| Property { key, value })1622					.collect()1623			});16241625		Ok(properties)1626	}16271628	/// Get property permissions according to given keys.1629	pub fn filter_property_permissions(1630		collection_id: CollectionId,1631		keys: Option<Vec<PropertyKey>>,1632	) -> Result<Vec<PropertyKeyPermission>, DispatchError> {1633		let permissions = Self::property_permissions(collection_id);16341635		let key_permissions = keys1636			.map(|keys| {1637				keys.into_iter()1638					.filter_map(|key| {1639						permissions1640							.get(&key)1641							.map(|permission| PropertyKeyPermission {1642								key,1643								permission: permission.clone(),1644							})1645					})1646					.collect()1647			})1648			.unwrap_or_else(|| {1649				permissions1650					.into_iter()1651					.map(|(key, permission)| PropertyKeyPermission { key, permission })1652					.collect()1653			});16541655		Ok(key_permissions)1656	}16571658	/// Toggle `user` participation in the `collection`'s allow list.1659	/// #### Store read/writes1660	/// 1 writes1661	pub fn toggle_allowlist(1662		collection: &CollectionHandle<T>,1663		sender: &T::CrossAccountId,1664		user: &T::CrossAccountId,1665		allowed: bool,1666	) -> DispatchResult {1667		collection.check_is_owner_or_admin(sender)?;16681669		// =========16701671		if allowed {1672			<Allowlist<T>>::insert((collection.id, user), true);1673			Self::deposit_event(Event::<T>::AllowListAddressAdded(1674				collection.id,1675				user.clone(),1676			));1677		} else {1678			<Allowlist<T>>::remove((collection.id, user));1679			Self::deposit_event(Event::<T>::AllowListAddressRemoved(1680				collection.id,1681				user.clone(),1682			));1683		}16841685		<PalletEvm<T>>::deposit_log(1686			erc::CollectionHelpersEvents::CollectionChanged {1687				collection_id: eth::collection_id_to_address(collection.id),1688			}1689			.to_log(T::ContractAddress::get()),1690		);16911692		Ok(())1693	}16941695	/// Toggle `user` participation in the `collection`'s admin list.1696	/// #### Store read/writes1697	/// 2 reads, 2 writes1698	pub fn toggle_admin(1699		collection: &CollectionHandle<T>,1700		sender: &T::CrossAccountId,1701		user: &T::CrossAccountId,1702		admin: bool,1703	) -> DispatchResult {1704		collection.check_is_internal()?;1705		collection.check_is_owner(sender)?;17061707		let is_admin = <IsAdmin<T>>::get((collection.id, user));1708		if is_admin == admin {1709			if admin {1710				return Ok(());1711			} else {1712				return Err(Error::<T>::UserIsNotCollectionAdmin.into());1713			}1714		}1715		let amount = <AdminAmount<T>>::get(collection.id);17161717		// =========17181719		if admin {1720			let amount = amount1721				.checked_add(1)1722				.ok_or(<Error<T>>::CollectionAdminCountExceeded)?;1723			ensure!(1724				amount <= Self::collection_admins_limit(),1725				<Error<T>>::CollectionAdminCountExceeded,1726			);17271728			<AdminAmount<T>>::insert(collection.id, amount);1729			<IsAdmin<T>>::insert((collection.id, user), true);17301731			Self::deposit_event(Event::<T>::CollectionAdminAdded(1732				collection.id,1733				user.clone(),1734			));1735		} else {1736			<AdminAmount<T>>::insert(collection.id, amount.saturating_sub(1));1737			<IsAdmin<T>>::remove((collection.id, user));17381739			Self::deposit_event(Event::<T>::CollectionAdminRemoved(1740				collection.id,1741				user.clone(),1742			));1743		}17441745		<PalletEvm<T>>::deposit_log(1746			erc::CollectionHelpersEvents::CollectionChanged {1747				collection_id: eth::collection_id_to_address(collection.id),1748			}1749			.to_log(T::ContractAddress::get()),1750		);17511752		Ok(())1753	}17541755	/// Update collection limits.1756	pub fn update_limits(1757		user: &T::CrossAccountId,1758		collection: &mut CollectionHandle<T>,1759		new_limit: CollectionLimits,1760	) -> DispatchResult {1761		collection.check_is_internal()?;1762		collection.check_is_owner_or_admin(user)?;17631764		collection.limits =1765			Self::clamp_limits(collection.mode.clone(), &collection.limits, new_limit)?;17661767		Self::deposit_event(Event::<T>::CollectionLimitSet(collection.id));1768		<PalletEvm<T>>::deposit_log(1769			erc::CollectionHelpersEvents::CollectionChanged {1770				collection_id: eth::collection_id_to_address(collection.id),1771			}1772			.to_log(T::ContractAddress::get()),1773		);17741775		collection.save()1776	}17771778	/// Merge set fields from `new_limit` to `old_limit`.1779	fn clamp_limits(1780		mode: CollectionMode,1781		old_limit: &CollectionLimits,1782		mut new_limit: CollectionLimits,1783	) -> Result<CollectionLimits, DispatchError> {1784		let limits = old_limit;1785		limit_default!(old_limit, new_limit,1786			account_token_ownership_limit => ensure!(1787				new_limit <= MAX_TOKEN_OWNERSHIP,1788				<Error<T>>::CollectionLimitBoundsExceeded,1789			),1790			sponsored_data_size => ensure!(1791				new_limit <= CUSTOM_DATA_LIMIT,1792				<Error<T>>::CollectionLimitBoundsExceeded,1793			),17941795			sponsored_data_rate_limit => {},1796			token_limit => ensure!(1797				old_limit >= new_limit && new_limit > 0,1798				<Error<T>>::CollectionTokenLimitExceeded1799			),18001801			sponsor_transfer_timeout(match mode {1802				CollectionMode::NFT => NFT_SPONSOR_TRANSFER_TIMEOUT,1803				CollectionMode::Fungible(_) => FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,1804				CollectionMode::ReFungible => REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,1805			}) => ensure!(1806				new_limit <= MAX_SPONSOR_TIMEOUT,1807				<Error<T>>::CollectionLimitBoundsExceeded,1808			),1809			sponsor_approve_timeout => {},1810			owner_can_transfer => ensure!(1811				!limits.owner_can_transfer_instaled() ||1812				old_limit || !new_limit,1813				<Error<T>>::OwnerPermissionsCantBeReverted,1814			),1815			owner_can_destroy => ensure!(1816				old_limit || !new_limit,1817				<Error<T>>::OwnerPermissionsCantBeReverted,1818			),1819			transfers_enabled => {},1820		);1821		Ok(new_limit)1822	}18231824	/// Update collection permissions.1825	pub fn update_permissions(1826		user: &T::CrossAccountId,1827		collection: &mut CollectionHandle<T>,1828		new_permission: CollectionPermissions,1829	) -> DispatchResult {1830		collection.check_is_internal()?;1831		collection.check_is_owner_or_admin(user)?;1832		collection.permissions = Self::clamp_permissions(1833			collection.mode.clone(),1834			&collection.permissions,1835			new_permission,1836		)?;18371838		Self::deposit_event(Event::<T>::CollectionPermissionSet(collection.id));1839		<PalletEvm<T>>::deposit_log(1840			erc::CollectionHelpersEvents::CollectionChanged {1841				collection_id: eth::collection_id_to_address(collection.id),1842			}1843			.to_log(T::ContractAddress::get()),1844		);18451846		collection.save()1847	}18481849	/// Merge set fields from `new_permission` to `old_permission`.1850	fn clamp_permissions(1851		_mode: CollectionMode,1852		old_permission: &CollectionPermissions,1853		mut new_permission: CollectionPermissions,1854	) -> Result<CollectionPermissions, DispatchError> {1855		limit_default_clone!(old_permission, new_permission,1856			access => {},1857			mint_mode => {},1858			nesting => { /* todo check for permissive, if only it gets out of benchmarks */ },1859		);1860		Ok(new_permission)1861	}18621863	/// Repair possibly broken properties of a collection.1864	pub fn repair_collection(collection_id: CollectionId) -> DispatchResult {1865		CollectionProperties::<T>::mutate(collection_id, |properties| {1866			properties.recompute_consumed_space();1867		});18681869		Ok(())1870	}1871}18721873/// Indicates unsupported methods by returning [Error::UnsupportedOperation].1874#[macro_export]1875macro_rules! unsupported {1876	($runtime:path) => {1877		Err($crate::Error::<$runtime>::UnsupportedOperation.into())1878	};1879}18801881/// Return weights for various worst-case operations.1882pub trait CommonWeightInfo<CrossAccountId> {1883	/// Weight of item creation.1884	fn create_item(data: &CreateItemData) -> Weight {1885		Self::create_multiple_items(from_ref(data))1886	}18871888	/// Weight of items creation.1889	fn create_multiple_items(amount: &[CreateItemData]) -> Weight;18901891	/// Weight of items creation.1892	fn create_multiple_items_ex(cost: &CreateItemExData<CrossAccountId>) -> Weight;18931894	/// The weight of the burning item.1895	fn burn_item() -> Weight;18961897	/// Property setting weight.1898	///1899	/// * `amount`- The number of properties to set.1900	fn set_collection_properties(amount: u32) -> Weight;19011902	/// Collection property deletion weight.1903	///1904	/// * `amount`- The number of properties to set.1905	fn delete_collection_properties(amount: u32) -> Weight;19061907	/// Token property setting weight.1908	///1909	/// * `amount`- The number of properties to set.1910	fn set_token_properties(amount: u32) -> Weight;19111912	/// Token property deletion weight.1913	///1914	/// * `amount`- The number of properties to delete.1915	fn delete_token_properties(amount: u32) -> Weight;19161917	/// Token property permissions set weight.1918	///1919	/// * `amount`- The number of property permissions to set.1920	fn set_token_property_permissions(amount: u32) -> Weight;19211922	/// Transfer price of the token or its parts.1923	fn transfer() -> Weight;19241925	/// The price of setting the permission of the operation from another user.1926	fn approve() -> Weight;19271928	/// The price of setting the permission of the operation from another user for eth mirror.1929	fn approve_from() -> Weight;19301931	/// Transfer price from another user.1932	fn transfer_from() -> Weight;19331934	/// The price of burning a token from another user.1935	fn burn_from() -> Weight;19361937	/// Differs from burn_item in case of Fungible and Refungible, as it should burn1938	/// whole users's balance.1939	///1940	/// This method shouldn't be used directly, as it doesn't count breadth price, use [burn_recursively](CommonWeightInfo::burn_recursively) instead1941	fn burn_recursively_self_raw() -> Weight;19421943	/// Cost of iterating over `amount` children while burning, without counting child burning itself.1944	///1945	/// This method shouldn't be used directly, as it doesn't count depth price, use [burn_recursively](CommonWeightInfo::burn_recursively) instead1946	fn burn_recursively_breadth_raw(amount: u32) -> Weight;19471948	/// The price of recursive burning a token.1949	///1950	/// `max_selfs` - The maximum burning weight of the token itself.1951	/// `max_breadth` - The maximum number of nested tokens to burn.1952	fn burn_recursively(max_selfs: u32, max_breadth: u32) -> Weight {1953		Self::burn_recursively_self_raw()1954			.saturating_mul(max_selfs.max(1) as u64)1955			.saturating_add(Self::burn_recursively_breadth_raw(max_breadth))1956	}19571958	/// The price of retrieving token owner1959	fn token_owner() -> Weight;19601961	/// The price of setting approval for all1962	fn set_allowance_for_all() -> Weight;19631964	/// The price of repairing an item.1965	fn force_repair_item() -> Weight;1966}19671968/// Weight info extension trait for refungible pallet.1969pub trait RefungibleExtensionsWeightInfo {1970	/// Weight of token repartition.1971	fn repartition() -> Weight;1972}19731974/// Common collection operations.1975///1976/// It wraps methods in Fungible, Nonfungible and Refungible pallets1977/// and adds weight info.1978pub trait CommonCollectionOperations<T: Config> {1979	/// Create token.1980	///1981	/// * `sender` - The user who mint the token and pays for the transaction.1982	/// * `to` - The user who will own the token.1983	/// * `data` - Token data.1984	/// * `nesting_budget` - A budget that can be spent on nesting tokens.1985	fn create_item(1986		&self,1987		sender: T::CrossAccountId,1988		to: T::CrossAccountId,1989		data: CreateItemData,1990		nesting_budget: &dyn Budget,1991	) -> DispatchResultWithPostInfo;19921993	/// Create multiple tokens.1994	///1995	/// * `sender` - The user who mint the token and pays for the transaction.1996	/// * `to` - The user who will own the token.1997	/// * `data` - Token data.1998	/// * `nesting_budget` - A budget that can be spent on nesting tokens.1999	fn create_multiple_items(2000		&self,2001		sender: T::CrossAccountId,2002		to: T::CrossAccountId,2003		data: Vec<CreateItemData>,2004		nesting_budget: &dyn Budget,2005	) -> DispatchResultWithPostInfo;20062007	/// Create multiple tokens.2008	///2009	/// * `sender` - The user who mint the token and pays for the transaction.2010	/// * `to` - The user who will own the token.2011	/// * `data` - Token data.2012	/// * `nesting_budget` - A budget that can be spent on nesting tokens.2013	fn create_multiple_items_ex(2014		&self,2015		sender: T::CrossAccountId,2016		data: CreateItemExData<T::CrossAccountId>,2017		nesting_budget: &dyn Budget,2018	) -> DispatchResultWithPostInfo;20192020	/// Burn token.2021	///2022	/// * `sender` - The user who owns the token.2023	/// * `token` - Token id that will burned.2024	/// * `amount` - The number of parts of the token that will be burned.2025	fn burn_item(2026		&self,2027		sender: T::CrossAccountId,2028		token: TokenId,2029		amount: u128,2030	) -> DispatchResultWithPostInfo;20312032	/// Burn token and all nested tokens recursievly.2033	///2034	/// * `sender` - The user who owns the token.2035	/// * `token` - Token id that will burned.2036	/// * `self_budget` - The budget that can be spent on burning tokens.2037	/// * `breadth_budget` - The budget that can be spent on burning nested tokens.2038	fn burn_item_recursively(2039		&self,2040		sender: T::CrossAccountId,2041		token: TokenId,2042		self_budget: &dyn Budget,2043		breadth_budget: &dyn Budget,2044	) -> DispatchResultWithPostInfo;20452046	/// Set collection properties.2047	///2048	/// * `sender` - Must be either the owner of the collection or its admin.2049	/// * `properties` - Properties to be set.2050	fn set_collection_properties(2051		&self,2052		sender: T::CrossAccountId,2053		properties: Vec<Property>,2054	) -> DispatchResultWithPostInfo;20552056	/// Delete collection properties.2057	///2058	/// * `sender` - Must be either the owner of the collection or its admin.2059	/// * `properties` - The properties to be removed.2060	fn delete_collection_properties(2061		&self,2062		sender: &T::CrossAccountId,2063		property_keys: Vec<PropertyKey>,2064	) -> DispatchResultWithPostInfo;20652066	/// Set token properties.2067	///2068	/// The appropriate [`PropertyPermission`] for the token property2069	/// must be set with [`Self::set_token_property_permissions`].2070	///2071	/// * `sender` - Must be either the owner of the token or its admin.2072	/// * `token_id` - The token for which the properties are being set.2073	/// * `properties` - Properties to be set.2074	/// * `budget` - Budget for setting properties.2075	fn set_token_properties(2076		&self,2077		sender: T::CrossAccountId,2078		token_id: TokenId,2079		properties: Vec<Property>,2080		budget: &dyn Budget,2081	) -> DispatchResultWithPostInfo;20822083	/// Remove token properties.2084	///2085	/// The appropriate [`PropertyPermission`] for the token property2086	/// must be set with [`Self::set_token_property_permissions`].2087	///2088	/// * `sender` - Must be either the owner of the token or its admin.2089	/// * `token_id` - The token for which the properties are being remove.2090	/// * `property_keys` - Keys to remove corresponding properties.2091	/// * `budget` - Budget for removing properties.2092	fn delete_token_properties(2093		&self,2094		sender: T::CrossAccountId,2095		token_id: TokenId,2096		property_keys: Vec<PropertyKey>,2097		budget: &dyn Budget,2098	) -> DispatchResultWithPostInfo;20992100	/// Get token properties raw map.2101	///2102	/// * `token_id` - The token which properties are needed.2103	fn get_token_properties_raw(&self, token_id: TokenId) -> Option<TokenProperties>;21042105	/// Set token properties raw map.2106	///2107	/// * `token_id` - The token for which the properties are being set.2108	/// * `map` - The raw map containing the token's properties.2109	fn set_token_properties_raw(&self, token_id: TokenId, map: TokenProperties);21102111	/// Set token property permissions.2112	///2113	/// * `sender` - Must be either the owner of the token or its admin.2114	/// * `token_id` - The token for which the properties are being set.2115	/// * `property_permissions` - Property permissions to be set.2116	/// * `budget` - Budget for setting properties.2117	fn set_token_property_permissions(2118		&self,2119		sender: &T::CrossAccountId,2120		property_permissions: Vec<PropertyKeyPermission>,2121	) -> DispatchResultWithPostInfo;21222123	/// Transfer amount of token pieces.2124	///2125	/// * `sender` - Donor user.2126	/// * `to` - Recepient user.2127	/// * `token` - The token of which parts are being sent.2128	/// * `amount` - The number of parts of the token that will be transferred.2129	/// * `budget` - The maximum budget that can be spent on the transfer.2130	fn transfer(2131		&self,2132		sender: T::CrossAccountId,2133		to: T::CrossAccountId,2134		token: TokenId,2135		amount: u128,2136		budget: &dyn Budget,2137	) -> DispatchResultWithPostInfo;21382139	/// Grant access to another account to transfer parts of the token owned by the calling user via [Self::transfer_from].2140	///2141	/// * `sender` - The user who grants access to the token.2142	/// * `spender` - The user to whom the rights are granted.2143	/// * `token` - The token to which access is granted.2144	/// * `amount` - The amount of pieces that another user can dispose of.2145	fn approve(2146		&self,2147		sender: T::CrossAccountId,2148		spender: T::CrossAccountId,2149		token: TokenId,2150		amount: u128,2151	) -> DispatchResultWithPostInfo;21522153	/// Grant access to another account to transfer parts of the token owned by the calling user's eth mirror via [Self::transfer_from].2154	///2155	/// * `sender` - The user who grants access to the token.2156	/// * `from` - Spender's eth mirror.2157	/// * `to` - The user to whom the rights are granted.2158	/// * `token` - The token to which access is granted.2159	/// * `amount` - The amount of pieces that another user can dispose of.2160	fn approve_from(2161		&self,2162		sender: T::CrossAccountId,2163		from: T::CrossAccountId,2164		to: T::CrossAccountId,2165		token: TokenId,2166		amount: u128,2167	) -> DispatchResultWithPostInfo;21682169	/// Send parts of a token owned by another user.2170	///2171	/// Before calling this method, you must grant rights to the calling user via [`Self::approve`].2172	///2173	/// * `sender` - The user who must have access to the token (see [`Self::approve`]).2174	/// * `from` - The user who owns the token.2175	/// * `to` - Recepient user.2176	/// * `token` - The token of which parts are being sent.2177	/// * `amount` - The number of parts of the token that will be transferred.2178	/// * `budget` - The maximum budget that can be spent on the transfer.2179	fn transfer_from(2180		&self,2181		sender: T::CrossAccountId,2182		from: T::CrossAccountId,2183		to: T::CrossAccountId,2184		token: TokenId,2185		amount: u128,2186		budget: &dyn Budget,2187	) -> DispatchResultWithPostInfo;21882189	/// Burn parts of a token owned by another user.2190	///2191	/// Before calling this method, you must grant rights to the calling user via [`Self::approve`].2192	///2193	/// * `sender` - The user who must have access to the token (see [`Self::approve`]).2194	/// * `from` - The user who owns the token.2195	/// * `token` - The token of which parts are being sent.2196	/// * `amount` - The number of parts of the token that will be transferred.2197	/// * `budget` - The maximum budget that can be spent on the burn.2198	fn burn_from(2199		&self,2200		sender: T::CrossAccountId,2201		from: T::CrossAccountId,2202		token: TokenId,2203		amount: u128,2204		budget: &dyn Budget,2205	) -> DispatchResultWithPostInfo;22062207	/// Check permission to nest token.2208	///2209	/// * `sender` - The user who initiated the check.2210	/// * `from` - The token that is checked for embedding.2211	/// * `under` - Token under which to check.2212	/// * `budget` - The maximum budget that can be spent on the check.2213	fn check_nesting(2214		&self,2215		sender: T::CrossAccountId,2216		from: (CollectionId, TokenId),2217		under: TokenId,2218		budget: &dyn Budget,2219	) -> DispatchResult;22202221	/// Nest one token into another.2222	///2223	/// * `under` - Token holder.2224	/// * `to_nest` - Nested token.2225	fn nest(&self, under: TokenId, to_nest: (CollectionId, TokenId));22262227	/// Unnest token.2228	///2229	/// * `under` - Token holder.2230	/// * `to_nest` - Token to unnest.2231	fn unnest(&self, under: TokenId, to_nest: (CollectionId, TokenId));22322233	/// Get all user tokens.2234	///2235	/// * `account` - Account for which you need to get tokens.2236	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId>;22372238	/// Get all the tokens in the collection.2239	fn collection_tokens(&self) -> Vec<TokenId>;22402241	/// Check if the token exists.2242	///2243	/// * `token` - Id token to check.2244	fn token_exists(&self, token: TokenId) -> bool;22452246	/// Get the id of the last minted token.2247	fn last_token_id(&self) -> TokenId;22482249	/// Get the owner of the token.2250	///2251	/// * `token` - The token for which you need to find out the owner.2252	fn token_owner(&self, token: TokenId) -> Result<T::CrossAccountId, TokenOwnerError>;22532254	/// Checks if the `maybe_owner` is the indirect owner of the `token`.2255	///2256	/// * `token` - Id token to check.2257	/// * `maybe_owner` - The account to check.2258	/// * `nesting_budget` - A budget that can be spent on nesting tokens.2259	fn check_token_indirect_owner(2260		&self,2261		token: TokenId,2262		maybe_owner: &T::CrossAccountId,2263		nesting_budget: &dyn Budget,2264	) -> Result<bool, DispatchError>;22652266	/// Returns 10 tokens owners in no particular order.2267	///2268	/// * `token` - The token for which you need to find out the owners.2269	fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId>;22702271	/// Get the value of the token property by key.2272	///2273	/// * `token` - Token with the property to get.2274	/// * `key` - Property name.2275	fn token_property(&self, token_id: TokenId, key: &PropertyKey) -> Option<PropertyValue>;22762277	/// Get a set of token properties by key vector.2278	///2279	/// * `token` - Token with the property to get.2280	/// * `keys` - Vector of property keys. If this parameter is [None](sp_std::result::Result),2281	/// then all properties are returned.2282	fn token_properties(&self, token: TokenId, keys: Option<Vec<PropertyKey>>) -> Vec<Property>;22832284	/// Amount of unique collection tokens2285	fn total_supply(&self) -> u32;22862287	/// Amount of different tokens account has.2288	///2289	/// * `account` - The account for which need to get the balance.2290	fn account_balance(&self, account: T::CrossAccountId) -> u32;22912292	/// Amount of specific token account have.2293	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128;22942295	/// Amount of token pieces2296	fn total_pieces(&self, token: TokenId) -> Option<u128>;22972298	/// Get the number of parts of the token that a trusted user can manage.2299	///2300	/// * `sender` - Trusted user.2301	/// * `spender` - Owner of the token.2302	/// * `token` - The token for which to get the value.2303	fn allowance(2304		&self,2305		sender: T::CrossAccountId,2306		spender: T::CrossAccountId,2307		token: TokenId,2308	) -> u128;23092310	/// Get extension for RFT collection.2311	fn refungible_extensions(&self) -> Option<&dyn RefungibleExtensions<T>>;23122313	/// The `operator` is allowed to transfer all tokens of the `owner` on their behalf.2314	/// * `owner` - Token owner2315	/// * `operator` - Operator2316	/// * `approve` - Should operator status be granted or revoked?2317	fn set_allowance_for_all(2318		&self,2319		owner: T::CrossAccountId,2320		operator: T::CrossAccountId,2321		approve: bool,2322	) -> DispatchResultWithPostInfo;23232324	/// Tells whether the given `owner` approves the `operator`.2325	fn allowance_for_all(&self, owner: T::CrossAccountId, operator: T::CrossAccountId) -> bool;23262327	/// Repairs a possibly broken item.2328	fn repair_item(&self, token: TokenId) -> DispatchResultWithPostInfo;2329}23302331/// Extension for RFT collection.2332pub trait RefungibleExtensions<T>2333where2334	T: Config,2335{2336	/// Change the number of parts of the token.2337	///2338	/// When the value changes down, this function is equivalent to burning parts of the token.2339	///2340	/// * `sender` - The user calling the repartition operation. Must be the owner of the token.2341	/// * `token` - The token for which you want to change the number of parts.2342	/// * `amount` - The new value of the parts of the token.2343	fn repartition(2344		&self,2345		sender: &T::CrossAccountId,2346		token: TokenId,2347		amount: u128,2348	) -> DispatchResultWithPostInfo;2349}23502351/// Merge [`DispatchResult`] with [`Weight`] into [`DispatchResultWithPostInfo`].2352///2353/// Used for [`CommonCollectionOperations`] implementations and flexible enough to do so.2354pub fn with_weight(res: DispatchResult, weight: Weight) -> DispatchResultWithPostInfo {2355	let post_info = PostDispatchInfo {2356		actual_weight: Some(weight),2357		pays_fee: Pays::Yes,2358	};2359	match res {2360		Ok(()) => Ok(post_info),2361		Err(error) => Err(DispatchErrorWithPostInfo { post_info, error }),2362	}2363}23642365impl<T: Config> From<PropertiesError> for Error<T> {2366	fn from(error: PropertiesError) -> Self {2367		match error {2368			PropertiesError::NoSpaceForProperty => Self::NoSpaceForProperty,2369			PropertiesError::PropertyLimitReached => Self::PropertyLimitReached,2370			PropertiesError::InvalidCharacterInPropertyKey => Self::InvalidCharacterInPropertyKey,2371			PropertiesError::PropertyKeyIsTooLong => Self::PropertyKeyIsTooLong,2372			PropertiesError::EmptyPropertyKey => Self::EmptyPropertyKey,2373		}2374	}2375}23762377/// A marker structure that enables the writer implementation2378/// to provide the interface to write properties to **newly created** tokens.2379pub struct NewTokenPropertyWriter;23802381/// A marker structure that enables the writer implementation2382/// to provide the interface to write properties to **already existing** tokens.2383pub struct ExistingTokenPropertyWriter;23842385/// The type-safe interface for writing properties (setting or deleting) to tokens.2386/// It has two distinct implementations for newly created tokens and existing ones.2387///2388/// This type utilizes the lazy evaluation to avoid repeating the computation2389/// of several performance-heavy or PoV-heavy tasks,2390/// such as checking the indirect ownership or reading the token property permissions.2391pub struct PropertyWriter<2392	'a,2393	T,2394	Handle,2395	WriterVariant,2396	FIsAdmin,2397	FPropertyPermissions,2398	FCheckTokenExist,2399	FGetProperties,2400> where2401	T: Config,2402	FIsAdmin: FnOnce() -> bool,2403	FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,2404{2405	collection: &'a Handle,2406	is_collection_admin: LazyValue<bool, FIsAdmin>,2407	property_permissions: LazyValue<PropertiesPermissionMap, FPropertyPermissions>,2408	check_token_exist: FCheckTokenExist,2409	get_properties: FGetProperties,2410	_phantom: PhantomData<(T, WriterVariant)>,2411}24122413impl<'a, T, Handle, FIsAdmin, FPropertyPermissions, FCheckTokenExist, FGetProperties>2414	PropertyWriter<2415		'a,2416		T,2417		Handle,2418		NewTokenPropertyWriter,2419		FIsAdmin,2420		FPropertyPermissions,2421		FCheckTokenExist,2422		FGetProperties,2423	> where2424	T: Config,2425	Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2426	FIsAdmin: FnOnce() -> bool,2427	FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,2428	FCheckTokenExist: Copy + FnOnce(TokenId) -> bool,2429	FGetProperties: Copy + FnOnce(TokenId) -> TokenProperties,2430{2431	/// A function to write properties to a **newly created** token.2432	pub fn write_token_properties(2433		&mut self,2434		mint_target_is_sender: bool,2435		token_id: TokenId,2436		properties_updates: impl Iterator<Item = Property>,2437		log: evm_coder::ethereum::Log,2438	) -> DispatchResult {2439		self.internal_write_token_properties(2440			token_id,2441			properties_updates.map(|p| (p.key, Some(p.value))),2442			|_| Ok(mint_target_is_sender),2443			log,2444		)2445	}2446}24472448impl<'a, T, Handle, FIsAdmin, FPropertyPermissions, FCheckTokenExist, FGetProperties>2449	PropertyWriter<2450		'a,2451		T,2452		Handle,2453		ExistingTokenPropertyWriter,2454		FIsAdmin,2455		FPropertyPermissions,2456		FCheckTokenExist,2457		FGetProperties,2458	> where2459	T: Config,2460	Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2461	FIsAdmin: FnOnce() -> bool,2462	FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,2463	FCheckTokenExist: Copy + FnOnce(TokenId) -> bool,2464	FGetProperties: Copy + FnOnce(TokenId) -> TokenProperties,2465{2466	/// A function to write properties to an **already existing** token.2467	pub fn write_token_properties(2468		&mut self,2469		sender: &T::CrossAccountId,2470		token_id: TokenId,2471		properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,2472		nesting_budget: &dyn Budget,2473		log: evm_coder::ethereum::Log,2474	) -> DispatchResult {2475		self.internal_write_token_properties(2476			token_id,2477			properties_updates,2478			|collection| collection.check_token_indirect_owner(token_id, sender, nesting_budget),2479			log,2480		)2481	}2482}24832484impl<2485		'a,2486		T,2487		Handle,2488		WriterVariant,2489		FIsAdmin,2490		FPropertyPermissions,2491		FCheckTokenExist,2492		FGetProperties,2493	>2494	PropertyWriter<2495		'a,2496		T,2497		Handle,2498		WriterVariant,2499		FIsAdmin,2500		FPropertyPermissions,2501		FCheckTokenExist,2502		FGetProperties,2503	> where2504	T: Config,2505	Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2506	FIsAdmin: FnOnce() -> bool,2507	FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,2508	FCheckTokenExist: Copy + FnOnce(TokenId) -> bool,2509	FGetProperties: Copy + FnOnce(TokenId) -> TokenProperties,2510{2511	fn internal_write_token_properties<FCheckTokenOwner>(2512		&mut self,2513		token_id: TokenId,2514		properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,2515		check_token_owner: FCheckTokenOwner,2516		log: evm_coder::ethereum::Log,2517	) -> DispatchResult2518	where2519		FCheckTokenOwner: FnOnce(&Handle) -> Result<bool, DispatchError>,2520	{2521		let get_properties = self.get_properties;2522		let mut stored_properties = LazyValue::new(move || get_properties(token_id));25232524		let mut is_token_owner = LazyValue::new(|| check_token_owner(self.collection));25252526		let check_token_exist = self.check_token_exist;2527		let mut is_token_exist = LazyValue::new(move || check_token_exist(token_id));25282529		for (key, value) in properties_updates {2530			let permission = self2531				.property_permissions2532				.value()2533				.get(&key)2534				.cloned()2535				.unwrap_or_else(PropertyPermission::none);25362537			match permission {2538				PropertyPermission { mutable: false, .. }2539					if stored_properties.value().get(&key).is_some() =>2540				{2541					return Err(<Error<T>>::NoPermission.into());2542				}25432544				PropertyPermission {2545					collection_admin,2546					token_owner,2547					..2548				} => check_token_permissions::<T, _, _, _>(2549					collection_admin,2550					token_owner,2551					&mut self.is_collection_admin,2552					&mut is_token_owner,2553					&mut is_token_exist,2554				)?,2555			}25562557			match value {2558				Some(value) => {2559					stored_properties2560						.value_mut()2561						.try_set(key.clone(), value)2562						.map_err(<Error<T>>::from)?;25632564					<Pallet<T>>::deposit_event(Event::TokenPropertySet(2565						self.collection.id,2566						token_id,2567						key,2568					));2569				}2570				None => {2571					stored_properties2572						.value_mut()2573						.remove(&key)2574						.map_err(<Error<T>>::from)?;25752576					<Pallet<T>>::deposit_event(Event::TokenPropertyDeleted(2577						self.collection.id,2578						token_id,2579						key,2580					));2581				}2582			}2583		}25842585		let properties_changed = stored_properties.has_value();2586		if properties_changed {2587			<PalletEvm<T>>::deposit_log(log);25882589			self.collection2590				.set_token_properties_raw(token_id, stored_properties.into_inner());2591		}25922593		Ok(())2594	}2595}25962597/// Create a [`PropertyWriter`] for newly created tokens.2598pub fn property_writer_for_new_token<'a, T, Handle>(2599	collection: &'a Handle,2600	sender: &'a T::CrossAccountId,2601) -> PropertyWriter<2602	'a,2603	T,2604	Handle,2605	NewTokenPropertyWriter,2606	impl FnOnce() -> bool + 'a,2607	impl FnOnce() -> PropertiesPermissionMap + 'a,2608	impl Copy + FnOnce(TokenId) -> bool + 'a,2609	impl Copy + FnOnce(TokenId) -> TokenProperties + 'a,2610>2611where2612	T: Config,2613	Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2614{2615	PropertyWriter {2616		collection,2617		is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),2618		property_permissions: LazyValue::new(|| <Pallet<T>>::property_permissions(collection.id)),2619		check_token_exist: |token_id| {2620			debug_assert!(collection.token_exists(token_id));2621			true2622		},2623		get_properties: |token_id| {2624			debug_assert!(collection.get_token_properties_raw(token_id).is_none());2625			TokenProperties::new()2626		},2627		_phantom: PhantomData,2628	}2629}26302631#[cfg(feature = "runtime-benchmarks")]2632/// Create a `PropertyWriter` with preloaded `is_collection_admin` and `property_permissions.2633/// Also:2634/// * it will return `true` for the token ownership check.2635/// * it will return empty stored properties without reading them from the storage.2636pub fn collection_info_loaded_property_writer<T, Handle>(2637	collection: &Handle,2638	is_collection_admin: bool,2639	property_permissions: PropertiesPermissionMap,2640) -> PropertyWriter<2641	T,2642	Handle,2643	NewTokenPropertyWriter,2644	impl FnOnce() -> bool,2645	impl FnOnce() -> PropertiesPermissionMap,2646	impl Copy + FnOnce(TokenId) -> bool,2647	impl Copy + FnOnce(TokenId) -> TokenProperties,2648>2649where2650	T: Config,2651	Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2652{2653	PropertyWriter {2654		collection,2655		is_collection_admin: LazyValue::new(move || is_collection_admin),2656		property_permissions: LazyValue::new(move || property_permissions),2657		check_token_exist: |_token_id| true,2658		get_properties: |_token_id| TokenProperties::new(),2659		_phantom: PhantomData,2660	}2661}26622663/// Create a [`PropertyWriter`] for already existing tokens.2664pub fn property_writer_for_existing_token<'a, T, Handle>(2665	collection: &'a Handle,2666	sender: &'a T::CrossAccountId,2667) -> PropertyWriter<2668	'a,2669	T,2670	Handle,2671	ExistingTokenPropertyWriter,2672	impl FnOnce() -> bool + 'a,2673	impl FnOnce() -> PropertiesPermissionMap + 'a,2674	impl Copy + FnOnce(TokenId) -> bool + 'a,2675	impl Copy + FnOnce(TokenId) -> TokenProperties + 'a,2676>2677where2678	T: Config,2679	Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2680{2681	PropertyWriter {2682		collection,2683		is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),2684		property_permissions: LazyValue::new(|| <Pallet<T>>::property_permissions(collection.id)),2685		check_token_exist: |token_id| collection.token_exists(token_id),2686		get_properties: |token_id| {2687			collection2688				.get_token_properties_raw(token_id)2689				.unwrap_or_default()2690		},2691		_phantom: PhantomData,2692	}2693}26942695/// Computes the weight delta for newly created tokens with properties.2696/// * `properties_nums` - The properties num of each created token.2697/// * `init_token_properties` - The function to obtain the weight from a token's properties num.2698pub fn init_token_properties_delta<T: Config, I: Fn(u32) -> Weight>(2699	properties_nums: impl Iterator<Item = u32>,2700	init_token_properties: I,2701) -> Weight {2702	let mut delta = properties_nums2703		.filter_map(|properties_num| {2704			if properties_num > 0 {2705				Some(init_token_properties(properties_num))2706			} else {2707				None2708			}2709		})2710		.fold(Weight::zero(), |a, b| a.saturating_add(b));27112712	// If at least once the `init_token_properties` was called,2713	// it means at least one newly created token has properties.2714	// Becuase of that, some common collection data also was loaded and we need to add this weight.2715	// However, these common data was loaded only once which is guaranteed by the `PropertyWriter`.2716	if !delta.is_zero() {2717		delta = delta.saturating_add(<SelfWeightOf<T>>::init_token_properties_common())2718	}27192720	delta2721}27222723#[cfg(any(feature = "tests", test))]2724#[allow(missing_docs)]2725pub mod tests {2726	use crate::{Config, DispatchError, DispatchResult, LazyValue};27272728	const fn to_bool(u: u8) -> bool {2729		u != 02730	}27312732	#[derive(Debug)]2733	pub struct TestCase {2734		pub collection_admin: bool,2735		pub is_collection_admin: bool,2736		pub token_owner: bool,2737		pub is_token_owner: bool,2738		pub no_permission: bool,2739	}27402741	impl TestCase {2742		const fn new(2743			collection_admin: u8,2744			is_collection_admin: u8,2745			token_owner: u8,2746			is_token_owner: u8,2747			no_permission: u8,2748		) -> Self {2749			Self {2750				collection_admin: to_bool(collection_admin),2751				is_collection_admin: to_bool(is_collection_admin),2752				token_owner: to_bool(token_owner),2753				is_token_owner: to_bool(is_token_owner),2754				no_permission: to_bool(no_permission),2755			}2756		}2757	}27582759	#[rustfmt::skip]2760	pub const TABLE: [TestCase; 16] = [2761		//                    ┌╴collection_admin2762		//                    │  ┌╴is_collection_admin2763		//                    │  │   ┌╴token_owner2764		//                    │  │   │  ┌╴is_token_ownership2765		//                    │  │   │  │   ┌╴no_permission2766		/*  0*/ TestCase::new(0, 0,  0, 0,  1),2767		/*  1*/ TestCase::new(0, 0,  0, 1,  1),2768		/*  2*/ TestCase::new(0, 0,  1, 0,  1),2769		/*  3*/ TestCase::new(0, 0,  1, 1,  0),2770		/*  4*/ TestCase::new(0, 1,  0, 0,  1),2771		/*  5*/ TestCase::new(0, 1,  0, 1,  1),2772		/*  6*/ TestCase::new(0, 1,  1, 0,  1),2773		/*  7*/ TestCase::new(0, 1,  1, 1,  0),2774		/*  8*/ TestCase::new(1, 0,  0, 0,  1),2775		/*  9*/ TestCase::new(1, 0,  0, 1,  1),2776		/* 10*/ TestCase::new(1, 0,  1, 0,  1),2777		/* 11*/ TestCase::new(1, 0,  1, 1,  0),2778		/* 12*/ TestCase::new(1, 1,  0, 0,  0),2779		/* 13*/ TestCase::new(1, 1,  0, 1,  0),2780		/* 14*/ TestCase::new(1, 1,  1, 0,  0),2781		/* 15*/ TestCase::new(1, 1,  1, 1,  0),2782	];27832784	pub fn check_token_permissions<T, FCA, FTO, FTE>(2785		collection_admin_permitted: bool,2786		token_owner_permitted: bool,2787		is_collection_admin: &mut LazyValue<bool, FCA>,2788		check_token_ownership: &mut LazyValue<Result<bool, DispatchError>, FTO>,2789		check_token_existence: &mut LazyValue<bool, FTE>,2790	) -> DispatchResult2791	where2792		T: Config,2793		FCA: FnOnce() -> bool,2794		FTO: FnOnce() -> Result<bool, DispatchError>,2795		FTE: FnOnce() -> bool,2796	{2797		crate::check_token_permissions::<T, FCA, FTO, FTE>(2798			collection_admin_permitted,2799			token_owner_permitted,2800			is_collection_admin,2801			check_token_ownership,2802			check_token_existence,2803		)2804	}2805}
after · pallets/common/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//! # Common pallet18//!19//! The Common pallet provides functionality for handling collections.20//!21//! ## Overview22//!23//! The Common pallet provides an interface for common collection operations for different collection types24//! (see [CommonCollectionOperations]), as well as a generic dispatcher for these, see [dispatch] module.25//! It also provides this functionality to EVM, see [erc] and [eth] modules.26//!27//! The Common pallet provides functions for:28//!29//! - Setting and approving collection sponsor.30//! - Get\set\delete allow list.31//! - Get\set\delete collection properties.32//! - Get\set\delete collection property permissions.33//! - Get\set\delete token property permissions.34//! - Get\set\delete collection administrators.35//! - Checking access permissions.36//!37//! ### Terminology38//! **Collection sponsor** - For the collection, you can set a sponsor, at whose expense it will39//! be possible to mint tokens.40//!41//! **Allow list** - List of users who have the right to minting tokens.42//!43//! **Collection properties** - Collection properties are simply key-value stores where various44//! metadata can be placed.45//!46//! **Permissions on token properties** - For each property in the token can be set permission47//! to change, see [`PropertyPermission`].48//!49//! **Collection administrator** - For a collection, you can set administrators who have the right50//! to most actions on the collection.5152#![warn(missing_docs)]53#![cfg_attr(not(feature = "std"), no_std)]54extern crate alloc;5556use alloc::boxed::Box;57use core::{58	marker::PhantomData,59	ops::{Deref, DerefMut},60	slice::from_ref,61	unreachable,62};6364use evm_coder::ToLog;65use frame_support::{66	dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, Pays, PostDispatchInfo},67	ensure, fail,68	traits::{69		fungible::{Balanced, Debt, Inspect},70		tokens::{Imbalance, Precision, Preservation},71		Get,72	},73	transactional,74};75pub use pallet::*;76use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};77use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};78use sp_core::H160;79use sp_runtime::{traits::Zero, ArithmeticError, DispatchError, DispatchResult};80use sp_std::vec::Vec;81use sp_weights::Weight;82use up_data_structs::{83	budget::Budget, AccessMode, Collection, CollectionId, CollectionLimits, CollectionMode,84	CollectionPermissions, CollectionProperties as CollectionPropertiesT, CollectionStats,85	CreateCollectionData, CreateItemData, CreateItemExData, PhantomType, PropertiesError,86	PropertiesPermissionMap, Property, PropertyKey, PropertyKeyPermission, PropertyPermission,87	PropertyScope, PropertyValue, RpcCollection, RpcCollectionFlags, SponsoringRateLimit,88	SponsorshipState, TokenChild, TokenData, TokenId, TokenOwnerError, TokenProperties,89	TrySetProperty, COLLECTION_ADMINS_LIMIT, COLLECTION_NUMBER_LIMIT, CUSTOM_DATA_LIMIT,90	FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MAX_SPONSOR_TIMEOUT, MAX_TOKEN_OWNERSHIP,91	MAX_TOKEN_PREFIX_LENGTH, NFT_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,92};93use up_pov_estimate_rpc::PovInfo;9495#[cfg(feature = "runtime-benchmarks")]96pub mod benchmarking;97pub mod dispatch;98pub mod erc;99pub mod eth;100pub mod helpers;101#[allow(missing_docs)]102pub mod weights;103104use weights::WeightInfo;105106/// Weight info.107pub type SelfWeightOf<T> = <T as Config>::WeightInfo;108109/// Collection handle contains information about collection data and id.110/// Also provides functionality to count consumed gas.111///112/// CollectionHandle is used as a generic wrapper for collections of all types (except native fungible).113/// It allows to perform common operations and queries on any collection type,114/// both completely general for all, as well as their respective implementations of [`CommonCollectionOperations`].115#[must_use = "Should call submit_logs or save, otherwise some data will be lost for evm side"]116pub struct CollectionHandle<T: Config> {117	/// Collection id118	pub id: CollectionId,119	collection: Collection<T::AccountId>,120	/// Substrate recorder for counting consumed gas121	pub recorder: SubstrateRecorder<T>,122}123124impl<T: Config> WithRecorder<T> for CollectionHandle<T> {125	fn recorder(&self) -> &SubstrateRecorder<T> {126		&self.recorder127	}128	fn into_recorder(self) -> SubstrateRecorder<T> {129		self.recorder130	}131}132133impl<T: Config> CollectionHandle<T> {134	/// Same as [CollectionHandle::new] but with an explicit gas limit.135	pub fn new_with_gas_limit(id: CollectionId, gas_limit: u64) -> Option<Self> {136		Self::new_with_recorder(id, SubstrateRecorder::new(gas_limit))137	}138139	/// Same as [CollectionHandle::new] but with an existed [`SubstrateRecorder`].140	pub fn new_with_recorder(id: CollectionId, recorder: SubstrateRecorder<T>) -> Option<Self> {141		<CollectionById<T>>::get(id).map(|collection| Self {142			id,143			collection,144			recorder,145		})146	}147148	/// Retrives collection data from storage and creates collection handle with default parameters.149	/// If collection not found return `None`150	pub fn new(id: CollectionId) -> Option<Self> {151		Self::new_with_gas_limit(id, u64::MAX)152	}153154	/// Same as [`CollectionHandle::new`] but if collection not found [CollectionNotFound](Error::CollectionNotFound) returned.155	pub fn try_get(id: CollectionId) -> Result<Self, DispatchError> {156		Ok(Self::new(id).ok_or(<Error<T>>::CollectionNotFound)?)157	}158159	/// Consume gas for reading.160	pub fn consume_store_reads(161		&self,162		reads: u64,163	) -> pallet_evm_coder_substrate::execution::Result<()> {164		self.recorder().consume_store_reads(reads)165	}166167	/// Consume gas for writing.168	pub fn consume_store_writes(169		&self,170		writes: u64,171	) -> pallet_evm_coder_substrate::execution::Result<()> {172		self.recorder().consume_store_writes(writes)173	}174175	/// Consume gas for reading and writing.176	pub fn consume_store_reads_and_writes(177		&self,178		reads: u64,179		writes: u64,180	) -> pallet_evm_coder_substrate::execution::Result<()> {181		self.recorder()182			.consume_store_reads_and_writes(reads, writes)183	}184185	/// Save collection to storage.186	pub fn save(&self) -> DispatchResult {187		<CollectionById<T>>::insert(self.id, &self.collection);188		Ok(())189	}190191	/// Set collection sponsor.192	///193	/// Unique collections allows sponsoring for certain actions.194	/// This method allows you to set the sponsor of the collection.195	/// In order for sponsorship to become active, it must be confirmed through [`Self::confirm_sponsorship`].196	pub fn set_sponsor(197		&mut self,198		sender: &T::CrossAccountId,199		sponsor: T::AccountId,200	) -> DispatchResult {201		self.check_is_internal()?;202		self.check_is_owner_or_admin(sender)?;203204		self.collection.sponsorship = SponsorshipState::Unconfirmed(sponsor.clone());205206		<Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorSet(self.id, sponsor));207		<PalletEvm<T>>::deposit_log(208			erc::CollectionHelpersEvents::CollectionChanged {209				collection_id: eth::collection_id_to_address(self.id),210			}211			.to_log(T::ContractAddress::get()),212		);213214		self.save()215	}216217	/// Force set `sponsor`.218	///219	/// Differs from [`set_sponsor`][`Self::set_sponsor`] in that confirmation220	/// from the `sponsor` is not required.221	///222	/// # Arguments223	///224	/// * `sponsor`: ID of the account of the sponsor-to-be.225	pub fn force_set_sponsor(&mut self, sponsor: T::AccountId) -> DispatchResult {226		self.check_is_internal()?;227228		self.collection.sponsorship = SponsorshipState::Confirmed(sponsor.clone());229230		<Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorSet(self.id, sponsor.clone()));231		<Pallet<T>>::deposit_event(Event::<T>::SponsorshipConfirmed(self.id, sponsor));232		<PalletEvm<T>>::deposit_log(233			erc::CollectionHelpersEvents::CollectionChanged {234				collection_id: eth::collection_id_to_address(self.id),235			}236			.to_log(T::ContractAddress::get()),237		);238239		self.save()240	}241242	/// Confirm sponsorship243	///244	/// In order for the sponsorship to become active, the user set as the sponsor must confirm their participation.245	/// Before confirming sponsorship, the user must be specified as the sponsor of the collection via [`Self::set_sponsor`].246	pub fn confirm_sponsorship(&mut self, sender: &T::AccountId) -> DispatchResult {247		self.check_is_internal()?;248		ensure!(249			self.collection.sponsorship.pending_sponsor() == Some(sender),250			Error::<T>::ConfirmSponsorshipFail251		);252253		self.collection.sponsorship = SponsorshipState::Confirmed(sender.clone());254255		<Pallet<T>>::deposit_event(Event::<T>::SponsorshipConfirmed(self.id, sender.clone()));256		<PalletEvm<T>>::deposit_log(257			erc::CollectionHelpersEvents::CollectionChanged {258				collection_id: eth::collection_id_to_address(self.id),259			}260			.to_log(T::ContractAddress::get()),261		);262263		self.save()264	}265266	/// Remove collection sponsor.267	pub fn remove_sponsor(&mut self, sender: &T::CrossAccountId) -> DispatchResult {268		self.check_is_internal()?;269		self.check_is_owner_or_admin(sender)?;270271		self.collection.sponsorship = SponsorshipState::Disabled;272273		<Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorRemoved(self.id));274		<PalletEvm<T>>::deposit_log(275			erc::CollectionHelpersEvents::CollectionChanged {276				collection_id: eth::collection_id_to_address(self.id),277			}278			.to_log(T::ContractAddress::get()),279		);280		self.save()281	}282283	/// Force remove `sponsor`.284	///285	/// Differs from `remove_sponsor` in that286	/// it doesn't require consent from the `owner` of the collection.287	pub fn force_remove_sponsor(&mut self) -> DispatchResult {288		self.check_is_internal()?;289290		self.collection.sponsorship = SponsorshipState::Disabled;291292		<Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorRemoved(self.id));293		<PalletEvm<T>>::deposit_log(294			erc::CollectionHelpersEvents::CollectionChanged {295				collection_id: eth::collection_id_to_address(self.id),296			}297			.to_log(T::ContractAddress::get()),298		);299		self.save()300	}301302	/// Checks that the collection was created with, and must be operated upon through **Unique API**.303	/// Now check only the `external` flag and if it's **true**, then return [`Error::CollectionIsExternal`] error.304	pub fn check_is_internal(&self) -> DispatchResult {305		if self.flags.external {306			return Err(<Error<T>>::CollectionIsExternal)?;307		}308309		Ok(())310	}311312	/// Checks that the collection was created with, and must be operated upon through an **assimilated API**.313	/// Now check only the `external` flag and if it's **false**, then return [`Error::CollectionIsInternal`] error.314	pub fn check_is_external(&self) -> DispatchResult {315		if !self.flags.external {316			return Err(<Error<T>>::CollectionIsInternal)?;317		}318319		Ok(())320	}321}322323impl<T: Config> Deref for CollectionHandle<T> {324	type Target = Collection<T::AccountId>;325326	fn deref(&self) -> &Self::Target {327		&self.collection328	}329}330331impl<T: Config> DerefMut for CollectionHandle<T> {332	fn deref_mut(&mut self) -> &mut Self::Target {333		&mut self.collection334	}335}336337impl<T: Config> CollectionHandle<T> {338	/// Checks if the `user` is the owner of the collection.339	pub fn check_is_owner(&self, user: &T::CrossAccountId) -> DispatchResult {340		ensure!(*user.as_sub() == self.owner, <Error<T>>::NoPermission);341		Ok(())342	}343344	/// Returns **true** if the `user` is the owner or administrator of the collection.345	pub fn is_owner_or_admin(&self, user: &T::CrossAccountId) -> bool {346		*user.as_sub() == self.owner || <IsAdmin<T>>::get((self.id, user))347	}348349	/// Checks if the `user` is the owner or administrator of the collection.350	pub fn check_is_owner_or_admin(&self, user: &T::CrossAccountId) -> DispatchResult {351		ensure!(self.is_owner_or_admin(user), <Error<T>>::NoPermission);352		Ok(())353	}354355	/// Returns **true** if356	/// * the `user`is a collection owner or admin357	/// * the collection limits allow the owner/admins to transfer/burn any collection token358	pub fn ignores_token_restrictions(&self, user: &T::CrossAccountId) -> bool {359		self.limits.owner_can_transfer() && self.is_owner_or_admin(user)360	}361362	/// Return **true** if `user` does not have enough token parts, and he can ignore such restrictions.363	pub fn ignores_owned_amount(&self, user: &T::CrossAccountId) -> bool {364		self.limits.owner_can_transfer() && self.is_owner_or_admin(user)365	}366367	/// Checks if the user is in the allow list. If not [Error::AddressNotInAllowlist] returns.368	pub fn check_allowlist(&self, user: &T::CrossAccountId) -> DispatchResult {369		ensure!(370			<Allowlist<T>>::get((self.id, user)),371			<Error<T>>::AddressNotInAllowlist372		);373		Ok(())374	}375376	/// Changes collection owner to another account377	/// #### Store read/writes378	/// 1 writes379	pub fn change_owner(380		&mut self,381		caller: T::CrossAccountId,382		new_owner: T::CrossAccountId,383	) -> DispatchResult {384		self.check_is_internal()?;385		self.check_is_owner(&caller)?;386		self.collection.owner = new_owner.as_sub().clone();387388		<Pallet<T>>::deposit_event(Event::<T>::CollectionOwnerChanged(389			self.id,390			new_owner.as_sub().clone(),391		));392		<PalletEvm<T>>::deposit_log(393			erc::CollectionHelpersEvents::CollectionChanged {394				collection_id: eth::collection_id_to_address(self.id),395			}396			.to_log(T::ContractAddress::get()),397		);398399		self.save()400	}401}402403#[frame_support::pallet]404pub mod pallet {405406	use dispatch::CollectionDispatch;407	use frame_support::{408		pallet_prelude::*, storage::Key, traits::StorageVersion, Blake2_128Concat,409	};410	use scale_info::TypeInfo;411	use up_data_structs::{mapping::TokenAddressMapping, TokenId};412	use weights::WeightInfo;413414	use super::*;415416	#[pallet::config]417	pub trait Config:418		frame_system::Config + pallet_evm_coder_substrate::Config + pallet_evm::Config + TypeInfo419	{420		/// Weight information for functions of this pallet.421		type WeightInfo: WeightInfo;422423		/// Events compatible with [`frame_system::Config::Event`].424		type RuntimeEvent: IsType<<Self as frame_system::Config>::RuntimeEvent> + From<Event<Self>>;425426		/// Handler of accounts and payment.427		type Currency: Balanced<Self::AccountId> + Inspect<Self::AccountId>;428429		/// Set price to create a collection.430		#[pallet::constant]431		type CollectionCreationPrice: Get<432			<<Self as Config>::Currency as Inspect<Self::AccountId>>::Balance,433		>;434435		/// Dispatcher of operations on collections.436		type CollectionDispatch: CollectionDispatch<Self>;437438		/// Account which holds the chain's treasury.439		type TreasuryAccountId: Get<Self::AccountId>;440441		/// Address under which the CollectionHelper contract would be available.442		#[pallet::constant]443		type ContractAddress: Get<H160>;444445		/// Mapper for token addresses to Ethereum addresses.446		type EvmTokenAddressMapping: TokenAddressMapping<H160>;447448		/// Mapper for token addresses to [`CrossAccountId`].449		type CrossTokenAddressMapping: TokenAddressMapping<Self::CrossAccountId>;450	}451452	const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);453	/// Collection id for native fungible collction.454	pub const NATIVE_FUNGIBLE_COLLECTION_ID: CollectionId = CollectionId(0);455456	#[pallet::pallet]457	#[pallet::storage_version(STORAGE_VERSION)]458	pub struct Pallet<T>(_);459460	#[pallet::extra_constants]461	impl<T: Config> Pallet<T> {462		/// Maximum admins per collection.463		pub fn collection_admins_limit() -> u32 {464			COLLECTION_ADMINS_LIMIT465		}466	}467468	#[pallet::genesis_config]469	pub struct GenesisConfig<T>(PhantomData<T>);470471	impl<T: Config> Default for GenesisConfig<T> {472		fn default() -> Self {473			Self(Default::default())474		}475	}476477	#[pallet::genesis_build]478	impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {479		fn build(&self) {480			StorageVersion::new(1).put::<Pallet<T>>();481		}482	}483484	impl<T: Config> Pallet<T> {485		/// Helper function that handles deposit events486		pub fn deposit_event(event: Event<T>) {487			let event = <T as Config>::RuntimeEvent::from(event);488			let event = event.into();489			<frame_system::Pallet<T>>::deposit_event(event)490		}491	}492493	#[pallet::event]494	pub enum Event<T: Config> {495		/// New collection was created496		CollectionCreated(497			/// Globally unique identifier of newly created collection.498			CollectionId,499			/// [`CollectionMode`] converted into _u8_.500			u8,501			/// Collection owner.502			T::AccountId,503		),504505		/// New collection was destroyed506		CollectionDestroyed(507			/// Globally unique identifier of collection.508			CollectionId,509		),510511		/// New item was created.512		ItemCreated(513			/// Id of the collection where item was created.514			CollectionId,515			/// Id of an item. Unique within the collection.516			TokenId,517			/// Owner of newly created item518			T::CrossAccountId,519			/// Always 1 for NFT520			u128,521		),522523		/// Collection item was burned.524		ItemDestroyed(525			/// Id of the collection where item was destroyed.526			CollectionId,527			/// Identifier of burned NFT.528			TokenId,529			/// Which user has destroyed its tokens.530			T::CrossAccountId,531			/// Amount of token pieces destroed. Always 1 for NFT.532			u128,533		),534535		/// Item was transferred536		Transfer(537			/// Id of collection to which item is belong.538			CollectionId,539			/// Id of an item.540			TokenId,541			/// Original owner of item.542			T::CrossAccountId,543			/// New owner of item.544			T::CrossAccountId,545			/// Amount of token pieces transfered. Always 1 for NFT.546			u128,547		),548549		/// Amount pieces of token owned by `sender` was approved for `spender`.550		Approved(551			/// Id of collection to which item is belong.552			CollectionId,553			/// Id of an item.554			TokenId,555			/// Original owner of item.556			T::CrossAccountId,557			/// Id for which the approval was granted.558			T::CrossAccountId,559			/// Amount of token pieces transfered. Always 1 for NFT.560			u128,561		),562563		/// A `sender` approves operations on all owned tokens for `spender`.564		ApprovedForAll(565			/// Id of collection to which item is belong.566			CollectionId,567			/// Owner of a wallet.568			T::CrossAccountId,569			/// Id for which operator status was granted or rewoked.570			T::CrossAccountId,571			/// Is operator status granted or revoked?572			bool,573		),574575		/// The colletion property has been added or edited.576		CollectionPropertySet(577			/// Id of collection to which property has been set.578			CollectionId,579			/// The property that was set.580			PropertyKey,581		),582583		/// The property has been deleted.584		CollectionPropertyDeleted(585			/// Id of collection to which property has been deleted.586			CollectionId,587			/// The property that was deleted.588			PropertyKey,589		),590591		/// The token property has been added or edited.592		TokenPropertySet(593			/// Identifier of the collection whose token has the property set.594			CollectionId,595			/// The token for which the property was set.596			TokenId,597			/// The property that was set.598			PropertyKey,599		),600601		/// The token property has been deleted.602		TokenPropertyDeleted(603			/// Identifier of the collection whose token has the property deleted.604			CollectionId,605			/// The token for which the property was deleted.606			TokenId,607			/// The property that was deleted.608			PropertyKey,609		),610611		/// The token property permission of a collection has been set.612		PropertyPermissionSet(613			/// ID of collection to which property permission has been set.614			CollectionId,615			/// The property permission that was set.616			PropertyKey,617		),618619		/// Address was added to the allow list.620		AllowListAddressAdded(621			/// ID of the affected collection.622			CollectionId,623			/// Address of the added account.624			T::CrossAccountId,625		),626627		/// Address was removed from the allow list.628		AllowListAddressRemoved(629			/// ID of the affected collection.630			CollectionId,631			/// Address of the removed account.632			T::CrossAccountId,633		),634635		/// Collection admin was added.636		CollectionAdminAdded(637			/// ID of the affected collection.638			CollectionId,639			/// Admin address.640			T::CrossAccountId,641		),642643		/// Collection admin was removed.644		CollectionAdminRemoved(645			/// ID of the affected collection.646			CollectionId,647			/// Removed admin address.648			T::CrossAccountId,649		),650651		/// Collection limits were set.652		CollectionLimitSet(653			/// ID of the affected collection.654			CollectionId,655		),656657		/// Collection owned was changed.658		CollectionOwnerChanged(659			/// ID of the affected collection.660			CollectionId,661			/// New owner address.662			T::AccountId,663		),664665		/// Collection permissions were set.666		CollectionPermissionSet(667			/// ID of the affected collection.668			CollectionId,669		),670671		/// Collection sponsor was set.672		CollectionSponsorSet(673			/// ID of the affected collection.674			CollectionId,675			/// New sponsor address.676			T::AccountId,677		),678679		/// New sponsor was confirm.680		SponsorshipConfirmed(681			/// ID of the affected collection.682			CollectionId,683			/// New sponsor address.684			T::AccountId,685		),686687		/// Collection sponsor was removed.688		CollectionSponsorRemoved(689			/// ID of the affected collection.690			CollectionId,691		),692	}693694	#[pallet::error]695	pub enum Error<T> {696		/// This collection does not exist.697		CollectionNotFound,698		/// Sender parameter and item owner must be equal.699		MustBeTokenOwner,700		/// No permission to perform action701		NoPermission,702		/// Destroying only empty collections is allowed703		CantDestroyNotEmptyCollection,704		/// Collection is not in mint mode.705		PublicMintingNotAllowed,706		/// Address is not in allow list.707		AddressNotInAllowlist,708709		/// Collection name can not be longer than 63 char.710		CollectionNameLimitExceeded,711		/// Collection description can not be longer than 255 char.712		CollectionDescriptionLimitExceeded,713		/// Token prefix can not be longer than 15 char.714		CollectionTokenPrefixLimitExceeded,715		/// Total collections bound exceeded.716		TotalCollectionsLimitExceeded,717		/// Exceeded max admin count718		CollectionAdminCountExceeded,719		/// Collection limit bounds per collection exceeded720		CollectionLimitBoundsExceeded,721		/// Tried to enable permissions which are only permitted to be disabled722		OwnerPermissionsCantBeReverted,723		/// Collection settings not allowing items transferring724		TransferNotAllowed,725		/// Account token limit exceeded per collection726		AccountTokenLimitExceeded,727		/// Collection token limit exceeded728		CollectionTokenLimitExceeded,729		/// Metadata flag frozen730		MetadataFlagFrozen,731732		/// Item does not exist733		TokenNotFound,734		/// Item is balance not enough735		TokenValueTooLow,736		/// Requested value is more than the approved737		ApprovedValueTooLow,738		/// Tried to approve more than owned739		CantApproveMoreThanOwned,740		/// Only spending from eth mirror could be approved741		AddressIsNotEthMirror,742743		/// Can't transfer tokens to ethereum zero address744		AddressIsZero,745746		/// The operation is not supported747		UnsupportedOperation,748749		/// Insufficient funds to perform an action750		NotSufficientFounds,751752		/// User does not satisfy the nesting rule753		UserIsNotAllowedToNest,754		/// Only tokens from specific collections may nest tokens under this one755		SourceCollectionIsNotAllowedToNest,756757		/// Tried to store more data than allowed in collection field758		CollectionFieldSizeExceeded,759760		/// Tried to store more property data than allowed761		NoSpaceForProperty,762763		/// Tried to store more property keys than allowed764		PropertyLimitReached,765766		/// Property key is too long767		PropertyKeyIsTooLong,768769		/// Only ASCII letters, digits, and symbols `_`, `-`, and `.` are allowed770		InvalidCharacterInPropertyKey,771772		/// Empty property keys are forbidden773		EmptyPropertyKey,774775		/// Tried to access an external collection with an internal API776		CollectionIsExternal,777778		/// Tried to access an internal collection with an external API779		CollectionIsInternal,780781		/// This address is not set as sponsor, use setCollectionSponsor first.782		ConfirmSponsorshipFail,783784		/// The user is not an administrator.785		UserIsNotCollectionAdmin,786	}787788	/// Storage of the count of created collections. Essentially contains the last collection ID.789	#[pallet::storage]790	pub type CreatedCollectionCount<T> = StorageValue<Value = CollectionId, QueryKind = ValueQuery>;791792	/// Storage of the count of deleted collections.793	#[pallet::storage]794	pub type DestroyedCollectionCount<T> =795		StorageValue<Value = CollectionId, QueryKind = ValueQuery>;796797	/// Storage of collection info.798	#[pallet::storage]799	pub type CollectionById<T> = StorageMap<800		Hasher = Blake2_128Concat,801		Key = CollectionId,802		Value = Collection<<T as frame_system::Config>::AccountId>,803		QueryKind = OptionQuery,804	>;805806	/// Storage of collection properties.807	#[pallet::storage]808	#[pallet::getter(fn collection_properties)]809	pub type CollectionProperties<T> = StorageMap<810		Hasher = Blake2_128Concat,811		Key = CollectionId,812		Value = CollectionPropertiesT,813		QueryKind = ValueQuery,814	>;815816	/// Storage of token property permissions of a collection.817	#[pallet::storage]818	#[pallet::getter(fn property_permissions)]819	pub type CollectionPropertyPermissions<T> = StorageMap<820		Hasher = Blake2_128Concat,821		Key = CollectionId,822		Value = PropertiesPermissionMap,823		QueryKind = ValueQuery,824	>;825826	/// Storage of the amount of collection admins.827	#[pallet::storage]828	pub type AdminAmount<T> = StorageMap<829		Hasher = Blake2_128Concat,830		Key = CollectionId,831		Value = u32,832		QueryKind = ValueQuery,833	>;834835	/// List of collection admins.836	#[pallet::storage]837	pub type IsAdmin<T: Config> = StorageNMap<838		Key = (839			Key<Blake2_128Concat, CollectionId>,840			Key<Blake2_128Concat, T::CrossAccountId>,841		),842		Value = bool,843		QueryKind = ValueQuery,844	>;845846	/// Allowlisted collection users.847	#[pallet::storage]848	pub type Allowlist<T: Config> = StorageNMap<849		Key = (850			Key<Blake2_128Concat, CollectionId>,851			Key<Blake2_128Concat, T::CrossAccountId>,852		),853		Value = bool,854		QueryKind = ValueQuery,855	>;856857	/// Not used by code, exists only to provide some types to metadata.858	#[pallet::storage]859	pub type DummyStorageValue<T: Config> = StorageValue<860		Value = (861			CollectionStats,862			CollectionId,863			TokenId,864			TokenChild,865			PhantomType<(866				TokenData<T::CrossAccountId>,867				RpcCollection<T::AccountId>,868				// PoV Estimate Info869				PovInfo,870			)>,871		),872		QueryKind = OptionQuery,873	>;874}875876enum LazyValueState<'a, T> {877	Pending(Box<dyn FnOnce() -> T + 'a>),878	InProgress,879	Computed(T),880}881882/// Value representation with delayed initialization time.883pub struct LazyValue<'a, T> {884	state: LazyValueState<'a, T>,885}886887impl<'a, T> LazyValue<'a, T> {888	/// Create a new LazyValue.889	pub fn new(f: impl FnOnce() -> T + 'a) -> Self {890		Self {891			state: LazyValueState::Pending(Box::new(f)),892		}893	}894895	/// Get the value. If it is called the first time, the value will be initialized.896	pub fn value(&mut self) -> &T {897		self.force_value();898		self.value_mut()899	}900901	/// Get the value. If it is called the first time, the value will be initialized.902	pub fn value_mut(&mut self) -> &mut T {903		self.force_value();904905		if let LazyValueState::Computed(value) = &mut self.state {906			value907		} else {908			unreachable!()909		}910	}911912	fn into_inner(mut self) -> T {913		self.force_value();914		if let LazyValueState::Computed(value) = self.state {915			value916		} else {917			unreachable!()918		}919	}920921	/// Is value initialized?922	pub fn has_value(&self) -> bool {923		matches!(self.state, LazyValueState::Computed(_))924	}925926	fn force_value(&mut self) {927		use LazyValueState::*;928929		if self.has_value() {930			return;931		}932933		match sp_std::mem::replace(&mut self.state, InProgress) {934			Pending(f) => self.state = Computed(f()),935			_ => panic!("recursion isn't supported"),936		}937	}938}939940fn check_token_permissions<T: Config>(941	collection_admin_permitted: bool,942	token_owner_permitted: bool,943	is_collection_admin: &mut LazyValue<bool>,944	is_token_owner: &mut LazyValue<Result<bool, DispatchError>>,945	is_token_exist: &mut LazyValue<bool>,946) -> DispatchResult {947	if !(collection_admin_permitted && *is_collection_admin.value()948		|| token_owner_permitted && (*is_token_owner.value())?)949	{950		fail!(<Error<T>>::NoPermission);951	}952953	let token_exist_due_to_owner_check_success =954		is_token_owner.has_value() && (*is_token_owner.value())?;955956	// If the token owner check has occurred and succeeded,957	// we know the token exists (otherwise, the owner check must fail).958	if !token_exist_due_to_owner_check_success {959		// If the token owner check didn't occur,960		// we must check the token's existence ourselves.961		if !is_token_exist.value() {962			fail!(<Error<T>>::TokenNotFound);963		}964	}965966	Ok(())967}968969impl<T: Config> Pallet<T> {970	/// Enshure that receiver address is correct.971	///972	/// Ethereum receiver 0x0000000000000000000000000000000000000000 is reserved, and shouldn't own tokens.973	pub fn ensure_correct_receiver(receiver: &T::CrossAccountId) -> DispatchResult {974		ensure!(975			&T::CrossAccountId::from_eth(H160([0; 20])) != receiver,976			<Error<T>>::AddressIsZero977		);978		Ok(())979	}980981	/// Get a vector of collection admins.982	pub fn adminlist(collection: CollectionId) -> Vec<T::CrossAccountId> {983		<IsAdmin<T>>::iter_prefix((collection,))984			.map(|(a, _)| a)985			.collect()986	}987988	/// Get a vector of users allowed to mint tokens.989	pub fn allowlist(collection: CollectionId) -> Vec<T::CrossAccountId> {990		<Allowlist<T>>::iter_prefix((collection,))991			.map(|(a, _)| a)992			.collect()993	}994995	/// Is `user` allowed to mint token in `collection`.996	pub fn allowed(collection: CollectionId, user: T::CrossAccountId) -> bool {997		<Allowlist<T>>::get((collection, user))998	}9991000	/// Get statistics of collections.1001	pub fn collection_stats() -> CollectionStats {1002		let created = <CreatedCollectionCount<T>>::get();1003		let destroyed = <DestroyedCollectionCount<T>>::get();1004		CollectionStats {1005			created: created.0,1006			destroyed: destroyed.0,1007			alive: created.0 - destroyed.0,1008		}1009	}10101011	/// Get the effective limits for the collection.1012	pub fn effective_collection_limits(collection: CollectionId) -> Option<CollectionLimits> {1013		let collection = <CollectionById<T>>::get(collection)?;1014		let limits = collection.limits;1015		let effective_limits = CollectionLimits {1016			account_token_ownership_limit: Some(limits.account_token_ownership_limit()),1017			sponsored_data_size: Some(limits.sponsored_data_size()),1018			sponsored_data_rate_limit: Some(1019				limits1020					.sponsored_data_rate_limit1021					.unwrap_or(SponsoringRateLimit::SponsoringDisabled),1022			),1023			token_limit: Some(limits.token_limit()),1024			sponsor_transfer_timeout: Some(limits.sponsor_transfer_timeout(1025				match collection.mode {1026					CollectionMode::NFT => NFT_SPONSOR_TRANSFER_TIMEOUT,1027					CollectionMode::Fungible(_) => FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,1028					CollectionMode::ReFungible => REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,1029				},1030			)),1031			sponsor_approve_timeout: Some(limits.sponsor_approve_timeout()),1032			owner_can_transfer: Some(limits.owner_can_transfer()),1033			owner_can_destroy: Some(limits.owner_can_destroy()),1034			transfers_enabled: Some(limits.transfers_enabled()),1035		};10361037		Some(effective_limits)1038	}10391040	/// Returns information about the `collection` adapted for rpc.1041	pub fn rpc_collection(collection: CollectionId) -> Option<RpcCollection<T::AccountId>> {1042		let Collection {1043			name,1044			description,1045			owner,1046			mode,1047			token_prefix,1048			sponsorship,1049			limits,1050			permissions,1051			flags,1052		} = <CollectionById<T>>::get(collection)?;10531054		let token_property_permissions = <CollectionPropertyPermissions<T>>::get(collection)1055			.into_iter()1056			.map(|(key, permission)| PropertyKeyPermission { key, permission })1057			.collect();10581059		let properties = <CollectionProperties<T>>::get(collection)1060			.into_iter()1061			.map(|(key, value)| Property { key, value })1062			.collect();10631064		let permissions = CollectionPermissions {1065			access: Some(permissions.access()),1066			mint_mode: Some(permissions.mint_mode()),1067			nesting: Some(permissions.nesting().clone()),1068		};10691070		Some(RpcCollection {1071			name: name.into_inner(),1072			description: description.into_inner(),1073			owner,1074			mode,1075			token_prefix: token_prefix.into_inner(),1076			sponsorship,1077			limits,1078			permissions,1079			token_property_permissions,1080			properties,1081			read_only: flags.external,10821083			flags: RpcCollectionFlags {1084				foreign: flags.foreign,1085				erc721metadata: flags.erc721metadata,1086			},1087		})1088	}1089}10901091macro_rules! limit_default {1092	($old:ident, $new:ident, $($field:ident $(($arg:expr))? => $check:expr),* $(,)?) => {{1093		$(1094			if let Some($new) = $new.$field {1095				let $old = $old.$field($($arg)?);1096				let _ = $new;1097				let _ = $old;1098				$check1099			} else {1100				$new.$field = $old.$field1101			}1102		)*1103	}};1104}1105macro_rules! limit_default_clone {1106	($old:ident, $new:ident, $($field:ident $(($arg:expr))? => $check:expr),* $(,)?) => {{1107		$(1108			if let Some($new) = $new.$field.clone() {1109				let $old = $old.$field($($arg)?);1110				let _ = $new;1111				let _ = $old;1112				$check1113			} else {1114				$new.$field = $old.$field.clone()1115			}1116		)*1117	}};1118}11191120impl<T: Config> Pallet<T> {1121	/// Create new collection.1122	///1123	/// * `owner` - The owner of the collection.1124	/// * `data` - Description of the created collection.1125	/// * `flags` - Extra flags to store.1126	pub fn init_collection(1127		owner: T::CrossAccountId,1128		payer: T::CrossAccountId,1129		data: CreateCollectionData<T::CrossAccountId>,1130	) -> Result<CollectionId, DispatchError> {1131		ensure!(data.flags.is_allowed_for_user(), <Error<T>>::NoPermission);1132		Self::init_collection_internal(owner, payer, data)1133	}11341135	/// Initializes the collection with ForeignCollection flag. Returns [CollectionId] on success, [DispatchError] otherwise.1136	pub fn init_foreign_collection(1137		owner: T::CrossAccountId,1138		payer: T::CrossAccountId,1139		mut data: CreateCollectionData<T::CrossAccountId>,1140	) -> Result<CollectionId, DispatchError> {1141		data.flags.foreign = true;1142		let id = Self::init_collection_internal(owner, payer, data)?;1143		Ok(id)1144	}11451146	fn init_collection_internal(1147		owner: T::CrossAccountId,1148		payer: T::CrossAccountId,1149		data: CreateCollectionData<T::CrossAccountId>,1150	) -> Result<CollectionId, DispatchError> {1151		{1152			ensure!(1153				data.token_prefix.len() <= MAX_TOKEN_PREFIX_LENGTH as usize,1154				Error::<T>::CollectionTokenPrefixLimitExceeded1155			);1156		}11571158		let created_count = <CreatedCollectionCount<T>>::get()1159			.01160			.checked_add(1)1161			.ok_or(ArithmeticError::Overflow)?;1162		let destroyed_count = <DestroyedCollectionCount<T>>::get().0;1163		let id = CollectionId(created_count);11641165		// bound Total number of collections1166		ensure!(1167			created_count - destroyed_count <= COLLECTION_NUMBER_LIMIT,1168			<Error<T>>::TotalCollectionsLimitExceeded1169		);11701171		// =========11721173		let collection = Collection {1174			owner: owner.as_sub().clone(),1175			name: data.name,1176			mode: data.mode.clone(),1177			description: data.description,1178			token_prefix: data.token_prefix,1179			sponsorship: data1180				.pending_sponsor1181				.map(|sponsor| SponsorshipState::Unconfirmed(sponsor.as_sub().clone()))1182				.unwrap_or_default(),1183			limits: data1184				.limits1185				.map(|limits| Self::clamp_limits(data.mode.clone(), &Default::default(), limits))1186				.unwrap_or_else(|| Ok(CollectionLimits::default()))?,1187			permissions: data1188				.permissions1189				.map(|permissions| {1190					Self::clamp_permissions(data.mode.clone(), &Default::default(), permissions)1191				})1192				.unwrap_or_else(|| Ok(CollectionPermissions::default()))?,1193			flags: data.flags,1194		};11951196		let mut collection_properties = CollectionPropertiesT::new();1197		collection_properties1198			.try_set_from_iter(data.properties.into_iter())1199			.map_err(<Error<T>>::from)?;12001201		CollectionProperties::<T>::insert(id, collection_properties);12021203		let mut token_props_permissions = PropertiesPermissionMap::new();1204		token_props_permissions1205			.try_set_from_iter(data.token_property_permissions.into_iter())1206			.map_err(<Error<T>>::from)?;12071208		CollectionPropertyPermissions::<T>::insert(id, token_props_permissions);12091210		let mut admin_amount = 0u32;1211		for admin in data.admin_list.iter() {1212			if !<IsAdmin<T>>::get((id, admin)) {1213				<IsAdmin<T>>::insert((id, admin), true);1214				admin_amount = admin_amount1215					.checked_add(1)1216					.ok_or(<Error<T>>::CollectionAdminCountExceeded)?;1217			}1218		}1219		ensure!(1220			admin_amount <= Self::collection_admins_limit(),1221			<Error<T>>::CollectionAdminCountExceeded,1222		);1223		<AdminAmount<T>>::insert(id, admin_amount);12241225		// Take a (non-refundable) deposit of collection creation1226		{1227			let mut imbalance = <Debt<T::AccountId, <T as Config>::Currency>>::zero();1228			imbalance.subsume(<T as Config>::Currency::deposit(1229				&T::TreasuryAccountId::get(),1230				T::CollectionCreationPrice::get(),1231				Precision::Exact,1232			)?);1233			let credit =1234				<T as Config>::Currency::settle(payer.as_sub(), imbalance, Preservation::Preserve)1235					.map_err(|_| Error::<T>::NotSufficientFounds)?;12361237			debug_assert!(credit.peek().is_zero())1238		}12391240		<CreatedCollectionCount<T>>::put(created_count);1241		<Pallet<T>>::deposit_event(Event::CollectionCreated(1242			id,1243			data.mode.id(),1244			owner.as_sub().clone(),1245		));1246		<PalletEvm<T>>::deposit_log(1247			erc::CollectionHelpersEvents::CollectionCreated {1248				owner: *owner.as_eth(),1249				collection_id: eth::collection_id_to_address(id),1250			}1251			.to_log(T::ContractAddress::get()),1252		);1253		<CollectionById<T>>::insert(id, collection);1254		Ok(id)1255	}12561257	/// Destroy collection.1258	///1259	/// * `collection` - Collection handler.1260	/// * `sender` - The owner or administrator of the collection.1261	pub fn destroy_collection(1262		collection: CollectionHandle<T>,1263		sender: &T::CrossAccountId,1264	) -> DispatchResult {1265		ensure!(1266			collection.limits.owner_can_destroy(),1267			<Error<T>>::NoPermission,1268		);1269		collection.check_is_owner(sender)?;12701271		let destroyed_collections = <DestroyedCollectionCount<T>>::get()1272			.01273			.checked_add(1)1274			.ok_or(ArithmeticError::Overflow)?;12751276		// =========12771278		<DestroyedCollectionCount<T>>::put(destroyed_collections);1279		<CollectionById<T>>::remove(collection.id);1280		<AdminAmount<T>>::remove(collection.id);1281		let _ = <IsAdmin<T>>::clear_prefix((collection.id,), u32::MAX, None);1282		let _ = <Allowlist<T>>::clear_prefix((collection.id,), u32::MAX, None);1283		<CollectionProperties<T>>::remove(collection.id);12841285		<Pallet<T>>::deposit_event(Event::CollectionDestroyed(collection.id));12861287		<PalletEvm<T>>::deposit_log(1288			erc::CollectionHelpersEvents::CollectionDestroyed {1289				collection_id: eth::collection_id_to_address(collection.id),1290			}1291			.to_log(T::ContractAddress::get()),1292		);1293		Ok(())1294	}12951296	/// This function sets or removes a collection properties according to1297	/// `properties_updates` contents:1298	/// * sets a property under the <key> with the value provided `(<key>, Some(<value>))`1299	/// * removes a property under the <key> if the value is `None` `(<key>, None)`.1300	///1301	/// This function fires an event for each property change.1302	/// In case of an error, all the changes (including the events) will be reverted1303	/// since the function is transactional.1304	#[transactional]1305	fn modify_collection_properties(1306		collection: &CollectionHandle<T>,1307		sender: &T::CrossAccountId,1308		properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,1309	) -> DispatchResult {1310		collection.check_is_owner_or_admin(sender)?;13111312		let mut stored_properties = <CollectionProperties<T>>::get(collection.id);13131314		for (key, value) in properties_updates {1315			match value {1316				Some(value) => {1317					stored_properties1318						.try_set(key.clone(), value)1319						.map_err(<Error<T>>::from)?;13201321					Self::deposit_event(Event::CollectionPropertySet(collection.id, key));1322					<PalletEvm<T>>::deposit_log(1323						erc::CollectionHelpersEvents::CollectionChanged {1324							collection_id: eth::collection_id_to_address(collection.id),1325						}1326						.to_log(T::ContractAddress::get()),1327					);1328				}1329				None => {1330					stored_properties.remove(&key).map_err(<Error<T>>::from)?;13311332					Self::deposit_event(Event::CollectionPropertyDeleted(collection.id, key));1333					<PalletEvm<T>>::deposit_log(1334						erc::CollectionHelpersEvents::CollectionChanged {1335							collection_id: eth::collection_id_to_address(collection.id),1336						}1337						.to_log(T::ContractAddress::get()),1338					);1339				}1340			}1341		}13421343		<CollectionProperties<T>>::set(collection.id, stored_properties);13441345		Ok(())1346	}13471348	/// Sets or unsets the approval of a given operator.1349	///1350	/// The `operator` is allowed to transfer all token pieces of the `owner` on their behalf.1351	/// - `owner`: Token owner1352	/// - `operator`: Operator1353	/// - `approve`: Should operator status be granted or revoked?1354	pub fn set_allowance_for_all(1355		collection: &CollectionHandle<T>,1356		owner: &T::CrossAccountId,1357		operator: &T::CrossAccountId,1358		approve: bool,1359		set_allowance: impl FnOnce(),1360		log: evm_coder::ethereum::Log,1361	) -> DispatchResult {1362		if collection.permissions.access() == AccessMode::AllowList {1363			collection.check_allowlist(owner)?;1364			collection.check_allowlist(operator)?;1365		}13661367		Self::ensure_correct_receiver(operator)?;13681369		set_allowance();13701371		<PalletEvm<T>>::deposit_log(log);1372		Self::deposit_event(Event::ApprovedForAll(1373			collection.id,1374			owner.clone(),1375			operator.clone(),1376			approve,1377		));1378		Ok(())1379	}13801381	/// Set collection property.1382	///1383	/// * `collection` - Collection handler.1384	/// * `sender` - The owner or administrator of the collection.1385	/// * `property` - The property to set.1386	pub fn set_collection_property(1387		collection: &CollectionHandle<T>,1388		sender: &T::CrossAccountId,1389		property: Property,1390	) -> DispatchResult {1391		Self::set_collection_properties(collection, sender, [property].into_iter())1392	}13931394	/// Set a scoped collection property, where the scope is a special prefix1395	/// prohibiting a user access to change the property directly.1396	///1397	/// * `collection_id` - ID of the collection for which the property is being set.1398	/// * `scope` - Property scope.1399	/// * `property` - The property to set.1400	pub fn set_scoped_collection_property(1401		collection_id: CollectionId,1402		scope: PropertyScope,1403		property: Property,1404	) -> DispatchResult {1405		CollectionProperties::<T>::try_mutate(collection_id, |properties| {1406			properties.try_scoped_set(scope, property.key, property.value)1407		})1408		.map_err(<Error<T>>::from)?;14091410		Ok(())1411	}14121413	/// Set scoped collection properties, where the scope is a special prefix1414	/// prohibiting a user access to change the properties directly.1415	///1416	/// * `collection_id` - ID of the collection for which the properties is being set.1417	/// * `scope` - Property scope.1418	/// * `properties` - The properties to set.1419	pub fn set_scoped_collection_properties(1420		collection_id: CollectionId,1421		scope: PropertyScope,1422		properties: impl Iterator<Item = Property>,1423	) -> DispatchResult {1424		CollectionProperties::<T>::try_mutate(collection_id, |stored_properties| {1425			stored_properties.try_scoped_set_from_iter(scope, properties)1426		})1427		.map_err(<Error<T>>::from)?;14281429		Ok(())1430	}14311432	/// Set collection properties.1433	///1434	/// * `collection` - Collection handler.1435	/// * `sender` - The owner or administrator of the collection.1436	/// * `properties` - The properties to set.1437	pub fn set_collection_properties(1438		collection: &CollectionHandle<T>,1439		sender: &T::CrossAccountId,1440		properties: impl Iterator<Item = Property>,1441	) -> DispatchResult {1442		Self::modify_collection_properties(1443			collection,1444			sender,1445			properties.map(|property| (property.key, Some(property.value))),1446		)1447	}14481449	/// Delete collection property.1450	///1451	/// * `collection` - Collection handler.1452	/// * `sender` - The owner or administrator of the collection.1453	/// * `property` - The property to delete.1454	pub fn delete_collection_property(1455		collection: &CollectionHandle<T>,1456		sender: &T::CrossAccountId,1457		property_key: PropertyKey,1458	) -> DispatchResult {1459		Self::delete_collection_properties(collection, sender, [property_key].into_iter())1460	}14611462	/// Delete collection properties.1463	///1464	/// * `collection` - Collection handler.1465	/// * `sender` - The owner or administrator of the collection.1466	/// * `properties` - The properties to delete.1467	pub fn delete_collection_properties(1468		collection: &CollectionHandle<T>,1469		sender: &T::CrossAccountId,1470		property_keys: impl Iterator<Item = PropertyKey>,1471	) -> DispatchResult {1472		Self::modify_collection_properties(collection, sender, property_keys.map(|key| (key, None)))1473	}14741475	/// Set collection propetry permission without any checks.1476	///1477	/// Used for migrations.1478	///1479	/// * `collection` - Collection handler.1480	/// * `property_permissions` - Property permissions.1481	pub fn set_property_permission_unchecked(1482		collection: CollectionId,1483		property_permission: PropertyKeyPermission,1484	) -> DispatchResult {1485		<CollectionPropertyPermissions<T>>::try_mutate(collection, |permissions| {1486			permissions.try_set(property_permission.key, property_permission.permission)1487		})1488		.map_err(<Error<T>>::from)?;1489		Ok(())1490	}14911492	/// Set collection property permission.1493	///1494	/// * `collection` - Collection handler.1495	/// * `sender` - The owner or administrator of the collection.1496	/// * `property_permission` - Property permission.1497	pub fn set_property_permission(1498		collection: &CollectionHandle<T>,1499		sender: &T::CrossAccountId,1500		property_permission: PropertyKeyPermission,1501	) -> DispatchResult {1502		Self::set_scoped_property_permission(1503			collection,1504			sender,1505			PropertyScope::None,1506			property_permission,1507		)1508	}15091510	/// Set collection property permission with scope.1511	///1512	/// * `collection` - Collection handler.1513	/// * `sender` - The owner or administrator of the collection.1514	/// * `scope` - Property scope.1515	/// * `property_permission` - Property permission.1516	pub fn set_scoped_property_permission(1517		collection: &CollectionHandle<T>,1518		sender: &T::CrossAccountId,1519		scope: PropertyScope,1520		property_permission: PropertyKeyPermission,1521	) -> DispatchResult {1522		collection.check_is_owner_or_admin(sender)?;15231524		let all_permissions = CollectionPropertyPermissions::<T>::get(collection.id);1525		let current_permission = all_permissions.get(&property_permission.key);1526		if matches![1527			current_permission,1528			Some(PropertyPermission { mutable: false, .. })1529		] {1530			return Err(<Error<T>>::NoPermission.into());1531		}15321533		CollectionPropertyPermissions::<T>::try_mutate(collection.id, |permissions| {1534			let property_permission = property_permission.clone();1535			permissions.try_scoped_set(1536				scope,1537				property_permission.key,1538				property_permission.permission,1539			)1540		})1541		.map_err(<Error<T>>::from)?;15421543		Self::deposit_event(Event::PropertyPermissionSet(1544			collection.id,1545			property_permission.key,1546		));1547		<PalletEvm<T>>::deposit_log(1548			erc::CollectionHelpersEvents::CollectionChanged {1549				collection_id: eth::collection_id_to_address(collection.id),1550			}1551			.to_log(T::ContractAddress::get()),1552		);15531554		Ok(())1555	}15561557	/// Set token property permission.1558	///1559	/// * `collection` - Collection handler.1560	/// * `sender` - The owner or administrator of the collection.1561	/// * `property_permissions` - Property permissions.1562	#[transactional]1563	pub fn set_token_property_permissions(1564		collection: &CollectionHandle<T>,1565		sender: &T::CrossAccountId,1566		property_permissions: Vec<PropertyKeyPermission>,1567	) -> DispatchResult {1568		Self::set_scoped_token_property_permissions(1569			collection,1570			sender,1571			PropertyScope::None,1572			property_permissions,1573		)1574	}15751576	/// Set token property permission with scope.1577	///1578	/// * `collection` - Collection handler.1579	/// * `sender` - The owner or administrator of the collection.1580	/// * `scope` - Property scope.1581	/// * `property_permissions` - Property permissions.1582	#[transactional]1583	pub fn set_scoped_token_property_permissions(1584		collection: &CollectionHandle<T>,1585		sender: &T::CrossAccountId,1586		scope: PropertyScope,1587		property_permissions: Vec<PropertyKeyPermission>,1588	) -> DispatchResult {1589		for prop_pemission in property_permissions {1590			Self::set_scoped_property_permission(collection, sender, scope, prop_pemission)?;1591		}15921593		Ok(())1594	}15951596	/// Get collection property.1597	pub fn get_collection_property(1598		collection_id: CollectionId,1599		key: &PropertyKey,1600	) -> Option<PropertyValue> {1601		Self::collection_properties(collection_id).get(key).cloned()1602	}16031604	/// Convert byte vector to property key vector.1605	pub fn bytes_keys_to_property_keys(1606		keys: Vec<Vec<u8>>,1607	) -> Result<Vec<PropertyKey>, DispatchError> {1608		keys.into_iter()1609			.map(|key| -> Result<PropertyKey, DispatchError> {1610				key.try_into()1611					.map_err(|_| <Error<T>>::PropertyKeyIsTooLong.into())1612			})1613			.collect::<Result<Vec<PropertyKey>, DispatchError>>()1614	}16151616	/// Get properties according to given keys.1617	pub fn filter_collection_properties(1618		collection_id: CollectionId,1619		keys: Option<Vec<PropertyKey>>,1620	) -> Result<Vec<Property>, DispatchError> {1621		let properties = Self::collection_properties(collection_id);16221623		let properties = keys1624			.map(|keys| {1625				keys.into_iter()1626					.filter_map(|key| {1627						properties.get(&key).map(|value| Property {1628							key,1629							value: value.clone(),1630						})1631					})1632					.collect()1633			})1634			.unwrap_or_else(|| {1635				properties1636					.into_iter()1637					.map(|(key, value)| Property { key, value })1638					.collect()1639			});16401641		Ok(properties)1642	}16431644	/// Get property permissions according to given keys.1645	pub fn filter_property_permissions(1646		collection_id: CollectionId,1647		keys: Option<Vec<PropertyKey>>,1648	) -> Result<Vec<PropertyKeyPermission>, DispatchError> {1649		let permissions = Self::property_permissions(collection_id);16501651		let key_permissions = keys1652			.map(|keys| {1653				keys.into_iter()1654					.filter_map(|key| {1655						permissions1656							.get(&key)1657							.map(|permission| PropertyKeyPermission {1658								key,1659								permission: permission.clone(),1660							})1661					})1662					.collect()1663			})1664			.unwrap_or_else(|| {1665				permissions1666					.into_iter()1667					.map(|(key, permission)| PropertyKeyPermission { key, permission })1668					.collect()1669			});16701671		Ok(key_permissions)1672	}16731674	/// Toggle `user` participation in the `collection`'s allow list.1675	/// #### Store read/writes1676	/// 1 writes1677	pub fn toggle_allowlist(1678		collection: &CollectionHandle<T>,1679		sender: &T::CrossAccountId,1680		user: &T::CrossAccountId,1681		allowed: bool,1682	) -> DispatchResult {1683		collection.check_is_owner_or_admin(sender)?;16841685		// =========16861687		if allowed {1688			<Allowlist<T>>::insert((collection.id, user), true);1689			Self::deposit_event(Event::<T>::AllowListAddressAdded(1690				collection.id,1691				user.clone(),1692			));1693		} else {1694			<Allowlist<T>>::remove((collection.id, user));1695			Self::deposit_event(Event::<T>::AllowListAddressRemoved(1696				collection.id,1697				user.clone(),1698			));1699		}17001701		<PalletEvm<T>>::deposit_log(1702			erc::CollectionHelpersEvents::CollectionChanged {1703				collection_id: eth::collection_id_to_address(collection.id),1704			}1705			.to_log(T::ContractAddress::get()),1706		);17071708		Ok(())1709	}17101711	/// Toggle `user` participation in the `collection`'s admin list.1712	/// #### Store read/writes1713	/// 2 reads, 2 writes1714	pub fn toggle_admin(1715		collection: &CollectionHandle<T>,1716		sender: &T::CrossAccountId,1717		user: &T::CrossAccountId,1718		admin: bool,1719	) -> DispatchResult {1720		collection.check_is_internal()?;1721		collection.check_is_owner(sender)?;17221723		let is_admin = <IsAdmin<T>>::get((collection.id, user));1724		if is_admin == admin {1725			if admin {1726				return Ok(());1727			} else {1728				return Err(Error::<T>::UserIsNotCollectionAdmin.into());1729			}1730		}1731		let amount = <AdminAmount<T>>::get(collection.id);17321733		// =========17341735		if admin {1736			let amount = amount1737				.checked_add(1)1738				.ok_or(<Error<T>>::CollectionAdminCountExceeded)?;1739			ensure!(1740				amount <= Self::collection_admins_limit(),1741				<Error<T>>::CollectionAdminCountExceeded,1742			);17431744			<AdminAmount<T>>::insert(collection.id, amount);1745			<IsAdmin<T>>::insert((collection.id, user), true);17461747			Self::deposit_event(Event::<T>::CollectionAdminAdded(1748				collection.id,1749				user.clone(),1750			));1751		} else {1752			<AdminAmount<T>>::insert(collection.id, amount.saturating_sub(1));1753			<IsAdmin<T>>::remove((collection.id, user));17541755			Self::deposit_event(Event::<T>::CollectionAdminRemoved(1756				collection.id,1757				user.clone(),1758			));1759		}17601761		<PalletEvm<T>>::deposit_log(1762			erc::CollectionHelpersEvents::CollectionChanged {1763				collection_id: eth::collection_id_to_address(collection.id),1764			}1765			.to_log(T::ContractAddress::get()),1766		);17671768		Ok(())1769	}17701771	/// Update collection limits.1772	pub fn update_limits(1773		user: &T::CrossAccountId,1774		collection: &mut CollectionHandle<T>,1775		new_limit: CollectionLimits,1776	) -> DispatchResult {1777		collection.check_is_internal()?;1778		collection.check_is_owner_or_admin(user)?;17791780		collection.limits =1781			Self::clamp_limits(collection.mode.clone(), &collection.limits, new_limit)?;17821783		Self::deposit_event(Event::<T>::CollectionLimitSet(collection.id));1784		<PalletEvm<T>>::deposit_log(1785			erc::CollectionHelpersEvents::CollectionChanged {1786				collection_id: eth::collection_id_to_address(collection.id),1787			}1788			.to_log(T::ContractAddress::get()),1789		);17901791		collection.save()1792	}17931794	/// Merge set fields from `new_limit` to `old_limit`.1795	fn clamp_limits(1796		mode: CollectionMode,1797		old_limit: &CollectionLimits,1798		mut new_limit: CollectionLimits,1799	) -> Result<CollectionLimits, DispatchError> {1800		let limits = old_limit;1801		limit_default!(old_limit, new_limit,1802			account_token_ownership_limit => ensure!(1803				new_limit <= MAX_TOKEN_OWNERSHIP,1804				<Error<T>>::CollectionLimitBoundsExceeded,1805			),1806			sponsored_data_size => ensure!(1807				new_limit <= CUSTOM_DATA_LIMIT,1808				<Error<T>>::CollectionLimitBoundsExceeded,1809			),18101811			sponsored_data_rate_limit => {},1812			token_limit => ensure!(1813				old_limit >= new_limit && new_limit > 0,1814				<Error<T>>::CollectionTokenLimitExceeded1815			),18161817			sponsor_transfer_timeout(match mode {1818				CollectionMode::NFT => NFT_SPONSOR_TRANSFER_TIMEOUT,1819				CollectionMode::Fungible(_) => FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,1820				CollectionMode::ReFungible => REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,1821			}) => ensure!(1822				new_limit <= MAX_SPONSOR_TIMEOUT,1823				<Error<T>>::CollectionLimitBoundsExceeded,1824			),1825			sponsor_approve_timeout => {},1826			owner_can_transfer => ensure!(1827				!limits.owner_can_transfer_instaled() ||1828				old_limit || !new_limit,1829				<Error<T>>::OwnerPermissionsCantBeReverted,1830			),1831			owner_can_destroy => ensure!(1832				old_limit || !new_limit,1833				<Error<T>>::OwnerPermissionsCantBeReverted,1834			),1835			transfers_enabled => {},1836		);1837		Ok(new_limit)1838	}18391840	/// Update collection permissions.1841	pub fn update_permissions(1842		user: &T::CrossAccountId,1843		collection: &mut CollectionHandle<T>,1844		new_permission: CollectionPermissions,1845	) -> DispatchResult {1846		collection.check_is_internal()?;1847		collection.check_is_owner_or_admin(user)?;1848		collection.permissions = Self::clamp_permissions(1849			collection.mode.clone(),1850			&collection.permissions,1851			new_permission,1852		)?;18531854		Self::deposit_event(Event::<T>::CollectionPermissionSet(collection.id));1855		<PalletEvm<T>>::deposit_log(1856			erc::CollectionHelpersEvents::CollectionChanged {1857				collection_id: eth::collection_id_to_address(collection.id),1858			}1859			.to_log(T::ContractAddress::get()),1860		);18611862		collection.save()1863	}18641865	/// Merge set fields from `new_permission` to `old_permission`.1866	fn clamp_permissions(1867		_mode: CollectionMode,1868		old_permission: &CollectionPermissions,1869		mut new_permission: CollectionPermissions,1870	) -> Result<CollectionPermissions, DispatchError> {1871		limit_default_clone!(old_permission, new_permission,1872			access => {},1873			mint_mode => {},1874			nesting => { /* todo check for permissive, if only it gets out of benchmarks */ },1875		);1876		Ok(new_permission)1877	}18781879	/// Repair possibly broken properties of a collection.1880	pub fn repair_collection(collection_id: CollectionId) -> DispatchResult {1881		CollectionProperties::<T>::mutate(collection_id, |properties| {1882			properties.recompute_consumed_space();1883		});18841885		Ok(())1886	}1887}18881889/// Indicates unsupported methods by returning [Error::UnsupportedOperation].1890#[macro_export]1891macro_rules! unsupported {1892	($runtime:path) => {1893		Err($crate::Error::<$runtime>::UnsupportedOperation.into())1894	};1895}18961897/// Return weights for various worst-case operations.1898pub trait CommonWeightInfo<CrossAccountId> {1899	/// Weight of item creation.1900	fn create_item(data: &CreateItemData) -> Weight {1901		Self::create_multiple_items(from_ref(data))1902	}19031904	/// Weight of items creation.1905	fn create_multiple_items(amount: &[CreateItemData]) -> Weight;19061907	/// Weight of items creation.1908	fn create_multiple_items_ex(cost: &CreateItemExData<CrossAccountId>) -> Weight;19091910	/// The weight of the burning item.1911	fn burn_item() -> Weight;19121913	/// Property setting weight.1914	///1915	/// * `amount`- The number of properties to set.1916	fn set_collection_properties(amount: u32) -> Weight;19171918	/// Collection property deletion weight.1919	///1920	/// * `amount`- The number of properties to set.1921	fn delete_collection_properties(amount: u32) -> Weight {1922		Self::set_collection_properties(amount)1923	}19241925	/// Token property setting weight.1926	///1927	/// * `amount`- The number of properties to set.1928	fn set_token_properties(amount: u32) -> Weight;19291930	/// Token property deletion weight.1931	///1932	/// * `amount`- The number of properties to delete.1933	fn delete_token_properties(amount: u32) -> Weight {1934		Self::set_token_properties(amount)1935	}19361937	/// Token property permissions set weight.1938	///1939	/// * `amount`- The number of property permissions to set.1940	fn set_token_property_permissions(amount: u32) -> Weight;19411942	/// Transfer price of the token or its parts.1943	fn transfer() -> Weight;19441945	/// The price of setting the permission of the operation from another user.1946	fn approve() -> Weight;19471948	/// The price of setting the permission of the operation from another user for eth mirror.1949	fn approve_from() -> Weight;19501951	/// Transfer price from another user.1952	fn transfer_from() -> Weight;19531954	/// The price of burning a token from another user.1955	fn burn_from() -> Weight;19561957	/// The price of setting approval for all1958	fn set_allowance_for_all() -> Weight;19591960	/// The price of repairing an item.1961	fn force_repair_item() -> Weight;1962}19631964/// Weight info extension trait for refungible pallet.1965pub trait RefungibleExtensionsWeightInfo {1966	/// Weight of token repartition.1967	fn repartition() -> Weight;1968}19691970/// Common collection operations.1971///1972/// It wraps methods in Fungible, Nonfungible and Refungible pallets1973/// and adds weight info.1974pub trait CommonCollectionOperations<T: Config> {1975	/// Create token.1976	///1977	/// * `sender` - The user who mint the token and pays for the transaction.1978	/// * `to` - The user who will own the token.1979	/// * `data` - Token data.1980	/// * `nesting_budget` - A budget that can be spent on nesting tokens.1981	fn create_item(1982		&self,1983		sender: T::CrossAccountId,1984		to: T::CrossAccountId,1985		data: CreateItemData,1986		nesting_budget: &dyn Budget,1987	) -> DispatchResultWithPostInfo;19881989	/// Create multiple tokens.1990	///1991	/// * `sender` - The user who mint the token and pays for the transaction.1992	/// * `to` - The user who will own the token.1993	/// * `data` - Token data.1994	/// * `nesting_budget` - A budget that can be spent on nesting tokens.1995	fn create_multiple_items(1996		&self,1997		sender: T::CrossAccountId,1998		to: T::CrossAccountId,1999		data: Vec<CreateItemData>,2000		nesting_budget: &dyn Budget,2001	) -> DispatchResultWithPostInfo;20022003	/// Create multiple tokens.2004	///2005	/// * `sender` - The user who mint the token and pays for the transaction.2006	/// * `to` - The user who will own the token.2007	/// * `data` - Token data.2008	/// * `nesting_budget` - A budget that can be spent on nesting tokens.2009	fn create_multiple_items_ex(2010		&self,2011		sender: T::CrossAccountId,2012		data: CreateItemExData<T::CrossAccountId>,2013		nesting_budget: &dyn Budget,2014	) -> DispatchResultWithPostInfo;20152016	/// Burn token.2017	///2018	/// * `sender` - The user who owns the token.2019	/// * `token` - Token id that will burned.2020	/// * `amount` - The number of parts of the token that will be burned.2021	fn burn_item(2022		&self,2023		sender: T::CrossAccountId,2024		token: TokenId,2025		amount: u128,2026	) -> DispatchResultWithPostInfo;20272028	/// Set collection properties.2029	///2030	/// * `sender` - Must be either the owner of the collection or its admin.2031	/// * `properties` - Properties to be set.2032	fn set_collection_properties(2033		&self,2034		sender: T::CrossAccountId,2035		properties: Vec<Property>,2036	) -> DispatchResultWithPostInfo;20372038	/// Delete collection properties.2039	///2040	/// * `sender` - Must be either the owner of the collection or its admin.2041	/// * `properties` - The properties to be removed.2042	fn delete_collection_properties(2043		&self,2044		sender: &T::CrossAccountId,2045		property_keys: Vec<PropertyKey>,2046	) -> DispatchResultWithPostInfo;20472048	/// Set token properties.2049	///2050	/// The appropriate [`PropertyPermission`] for the token property2051	/// must be set with [`Self::set_token_property_permissions`].2052	///2053	/// * `sender` - Must be either the owner of the token or its admin.2054	/// * `token_id` - The token for which the properties are being set.2055	/// * `properties` - Properties to be set.2056	/// * `budget` - Budget for setting properties.2057	fn set_token_properties(2058		&self,2059		sender: T::CrossAccountId,2060		token_id: TokenId,2061		properties: Vec<Property>,2062		budget: &dyn Budget,2063	) -> DispatchResultWithPostInfo;20642065	/// Remove token properties.2066	///2067	/// The appropriate [`PropertyPermission`] for the token property2068	/// must be set with [`Self::set_token_property_permissions`].2069	///2070	/// * `sender` - Must be either the owner of the token or its admin.2071	/// * `token_id` - The token for which the properties are being remove.2072	/// * `property_keys` - Keys to remove corresponding properties.2073	/// * `budget` - Budget for removing properties.2074	fn delete_token_properties(2075		&self,2076		sender: T::CrossAccountId,2077		token_id: TokenId,2078		property_keys: Vec<PropertyKey>,2079		budget: &dyn Budget,2080	) -> DispatchResultWithPostInfo;20812082	/// Get token properties raw map.2083	///2084	/// * `token_id` - The token which properties are needed.2085	fn get_token_properties_raw(&self, token_id: TokenId) -> Option<TokenProperties>;20862087	/// Set token properties raw map.2088	///2089	/// * `token_id` - The token for which the properties are being set.2090	/// * `map` - The raw map containing the token's properties.2091	fn set_token_properties_raw(&self, token_id: TokenId, map: TokenProperties);20922093	/// Set token property permissions.2094	///2095	/// * `sender` - Must be either the owner of the token or its admin.2096	/// * `token_id` - The token for which the properties are being set.2097	/// * `property_permissions` - Property permissions to be set.2098	/// * `budget` - Budget for setting properties.2099	fn set_token_property_permissions(2100		&self,2101		sender: &T::CrossAccountId,2102		property_permissions: Vec<PropertyKeyPermission>,2103	) -> DispatchResultWithPostInfo;21042105	/// Transfer amount of token pieces.2106	///2107	/// * `sender` - Donor user.2108	/// * `to` - Recepient user.2109	/// * `token` - The token of which parts are being sent.2110	/// * `amount` - The number of parts of the token that will be transferred.2111	/// * `budget` - The maximum budget that can be spent on the transfer.2112	fn transfer(2113		&self,2114		sender: T::CrossAccountId,2115		to: T::CrossAccountId,2116		token: TokenId,2117		amount: u128,2118		budget: &dyn Budget,2119	) -> DispatchResultWithPostInfo;21202121	/// Grant access to another account to transfer parts of the token owned by the calling user via [Self::transfer_from].2122	///2123	/// * `sender` - The user who grants access to the token.2124	/// * `spender` - The user to whom the rights are granted.2125	/// * `token` - The token to which access is granted.2126	/// * `amount` - The amount of pieces that another user can dispose of.2127	fn approve(2128		&self,2129		sender: T::CrossAccountId,2130		spender: T::CrossAccountId,2131		token: TokenId,2132		amount: u128,2133	) -> DispatchResultWithPostInfo;21342135	/// Grant access to another account to transfer parts of the token owned by the calling user's eth mirror via [Self::transfer_from].2136	///2137	/// * `sender` - The user who grants access to the token.2138	/// * `from` - Spender's eth mirror.2139	/// * `to` - The user to whom the rights are granted.2140	/// * `token` - The token to which access is granted.2141	/// * `amount` - The amount of pieces that another user can dispose of.2142	fn approve_from(2143		&self,2144		sender: T::CrossAccountId,2145		from: T::CrossAccountId,2146		to: T::CrossAccountId,2147		token: TokenId,2148		amount: u128,2149	) -> DispatchResultWithPostInfo;21502151	/// Send parts of a token owned by another user.2152	///2153	/// Before calling this method, you must grant rights to the calling user via [`Self::approve`].2154	///2155	/// * `sender` - The user who must have access to the token (see [`Self::approve`]).2156	/// * `from` - The user who owns the token.2157	/// * `to` - Recepient user.2158	/// * `token` - The token of which parts are being sent.2159	/// * `amount` - The number of parts of the token that will be transferred.2160	/// * `budget` - The maximum budget that can be spent on the transfer.2161	fn transfer_from(2162		&self,2163		sender: T::CrossAccountId,2164		from: T::CrossAccountId,2165		to: T::CrossAccountId,2166		token: TokenId,2167		amount: u128,2168		budget: &dyn Budget,2169	) -> DispatchResultWithPostInfo;21702171	/// Burn parts of a token owned by another user.2172	///2173	/// Before calling this method, you must grant rights to the calling user via [`Self::approve`].2174	///2175	/// * `sender` - The user who must have access to the token (see [`Self::approve`]).2176	/// * `from` - The user who owns the token.2177	/// * `token` - The token of which parts are being sent.2178	/// * `amount` - The number of parts of the token that will be transferred.2179	/// * `budget` - The maximum budget that can be spent on the burn.2180	fn burn_from(2181		&self,2182		sender: T::CrossAccountId,2183		from: T::CrossAccountId,2184		token: TokenId,2185		amount: u128,2186		budget: &dyn Budget,2187	) -> DispatchResultWithPostInfo;21882189	/// Check permission to nest token.2190	///2191	/// * `sender` - The user who initiated the check.2192	/// * `from` - The token that is checked for embedding.2193	/// * `under` - Token under which to check.2194	/// * `budget` - The maximum budget that can be spent on the check.2195	fn check_nesting(2196		&self,2197		sender: T::CrossAccountId,2198		from: (CollectionId, TokenId),2199		under: TokenId,2200		budget: &dyn Budget,2201	) -> DispatchResult;22022203	/// Nest one token into another.2204	///2205	/// * `under` - Token holder.2206	/// * `to_nest` - Nested token.2207	fn nest(&self, under: TokenId, to_nest: (CollectionId, TokenId));22082209	/// Unnest token.2210	///2211	/// * `under` - Token holder.2212	/// * `to_nest` - Token to unnest.2213	fn unnest(&self, under: TokenId, to_nest: (CollectionId, TokenId));22142215	/// Get all user tokens.2216	///2217	/// * `account` - Account for which you need to get tokens.2218	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId>;22192220	/// Get all the tokens in the collection.2221	fn collection_tokens(&self) -> Vec<TokenId>;22222223	/// Check if the token exists.2224	///2225	/// * `token` - Id token to check.2226	fn token_exists(&self, token: TokenId) -> bool;22272228	/// Get the id of the last minted token.2229	fn last_token_id(&self) -> TokenId;22302231	/// Get the owner of the token.2232	///2233	/// * `token` - The token for which you need to find out the owner.2234	fn token_owner(&self, token: TokenId) -> Result<T::CrossAccountId, TokenOwnerError>;22352236	/// Checks if the `maybe_owner` is the indirect owner of the `token`.2237	///2238	/// * `token` - Id token to check.2239	/// * `maybe_owner` - The account to check.2240	/// * `nesting_budget` - A budget that can be spent on nesting tokens.2241	fn check_token_indirect_owner(2242		&self,2243		token: TokenId,2244		maybe_owner: &T::CrossAccountId,2245		nesting_budget: &dyn Budget,2246	) -> Result<bool, DispatchError>;22472248	/// Returns 10 tokens owners in no particular order.2249	///2250	/// * `token` - The token for which you need to find out the owners.2251	fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId>;22522253	/// Get the value of the token property by key.2254	///2255	/// * `token` - Token with the property to get.2256	/// * `key` - Property name.2257	fn token_property(&self, token_id: TokenId, key: &PropertyKey) -> Option<PropertyValue>;22582259	/// Get a set of token properties by key vector.2260	///2261	/// * `token` - Token with the property to get.2262	/// * `keys` - Vector of property keys. If this parameter is [None](sp_std::result::Result),2263	/// then all properties are returned.2264	fn token_properties(&self, token: TokenId, keys: Option<Vec<PropertyKey>>) -> Vec<Property>;22652266	/// Amount of unique collection tokens2267	fn total_supply(&self) -> u32;22682269	/// Amount of different tokens account has.2270	///2271	/// * `account` - The account for which need to get the balance.2272	fn account_balance(&self, account: T::CrossAccountId) -> u32;22732274	/// Amount of specific token account have.2275	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128;22762277	/// Amount of token pieces2278	fn total_pieces(&self, token: TokenId) -> Option<u128>;22792280	/// Get the number of parts of the token that a trusted user can manage.2281	///2282	/// * `sender` - Trusted user.2283	/// * `spender` - Owner of the token.2284	/// * `token` - The token for which to get the value.2285	fn allowance(2286		&self,2287		sender: T::CrossAccountId,2288		spender: T::CrossAccountId,2289		token: TokenId,2290	) -> u128;22912292	/// Get extension for RFT collection.2293	fn refungible_extensions(&self) -> Option<&dyn RefungibleExtensions<T>>;22942295	/// The `operator` is allowed to transfer all tokens of the `owner` on their behalf.2296	/// * `owner` - Token owner2297	/// * `operator` - Operator2298	/// * `approve` - Should operator status be granted or revoked?2299	fn set_allowance_for_all(2300		&self,2301		owner: T::CrossAccountId,2302		operator: T::CrossAccountId,2303		approve: bool,2304	) -> DispatchResultWithPostInfo;23052306	/// Tells whether the given `owner` approves the `operator`.2307	fn allowance_for_all(&self, owner: T::CrossAccountId, operator: T::CrossAccountId) -> bool;23082309	/// Repairs a possibly broken item.2310	fn repair_item(&self, token: TokenId) -> DispatchResultWithPostInfo;2311}23122313/// Extension for RFT collection.2314pub trait RefungibleExtensions<T>2315where2316	T: Config,2317{2318	/// Change the number of parts of the token.2319	///2320	/// When the value changes down, this function is equivalent to burning parts of the token.2321	///2322	/// * `sender` - The user calling the repartition operation. Must be the owner of the token.2323	/// * `token` - The token for which you want to change the number of parts.2324	/// * `amount` - The new value of the parts of the token.2325	fn repartition(2326		&self,2327		sender: &T::CrossAccountId,2328		token: TokenId,2329		amount: u128,2330	) -> DispatchResultWithPostInfo;2331}23322333/// Merge [`DispatchResult`] with [`Weight`] into [`DispatchResultWithPostInfo`].2334///2335/// Used for [`CommonCollectionOperations`] implementations and flexible enough to do so.2336pub fn with_weight(res: DispatchResult, weight: Weight) -> DispatchResultWithPostInfo {2337	let post_info = PostDispatchInfo {2338		actual_weight: Some(weight),2339		pays_fee: Pays::Yes,2340	};2341	match res {2342		Ok(()) => Ok(post_info),2343		Err(error) => Err(DispatchErrorWithPostInfo { post_info, error }),2344	}2345}23462347impl<T: Config> From<PropertiesError> for Error<T> {2348	fn from(error: PropertiesError) -> Self {2349		match error {2350			PropertiesError::NoSpaceForProperty => Self::NoSpaceForProperty,2351			PropertiesError::PropertyLimitReached => Self::PropertyLimitReached,2352			PropertiesError::InvalidCharacterInPropertyKey => Self::InvalidCharacterInPropertyKey,2353			PropertiesError::PropertyKeyIsTooLong => Self::PropertyKeyIsTooLong,2354			PropertiesError::EmptyPropertyKey => Self::EmptyPropertyKey,2355		}2356	}2357}23582359/// The type-safe interface for writing properties (setting or deleting) to tokens.2360/// It has two distinct implementations for newly created tokens and existing ones.2361///2362/// This type utilizes the lazy evaluation to avoid repeating the computation2363/// of several performance-heavy or PoV-heavy tasks,2364/// such as checking the indirect ownership or reading the token property permissions.2365pub struct PropertyWriter<'a, WriterVariant, T, Handle> {2366	collection: &'a Handle,2367	collection_lazy_info: PropertyWriterLazyCollectionInfo<'a>,2368	_phantom: PhantomData<(T, WriterVariant)>,2369}23702371impl<'a, T, Handle, WriterVariant> PropertyWriter<'a, WriterVariant, T, Handle>2372where2373	T: Config,2374	Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2375{2376	fn internal_write_token_properties(2377		&mut self,2378		token_id: TokenId,2379		mut token_lazy_info: PropertyWriterLazyTokenInfo,2380		properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,2381		log: evm_coder::ethereum::Log,2382	) -> DispatchResult {2383		for (key, value) in properties_updates {2384			let permission = self2385				.collection_lazy_info2386				.property_permissions2387				.value()2388				.get(&key)2389				.cloned()2390				.unwrap_or_else(PropertyPermission::none);23912392			match permission {2393				PropertyPermission { mutable: false, .. }2394					if token_lazy_info2395						.stored_properties2396						.value()2397						.get(&key)2398						.is_some() =>2399				{2400					return Err(<Error<T>>::NoPermission.into());2401				}24022403				PropertyPermission {2404					collection_admin,2405					token_owner,2406					..2407				} => check_token_permissions::<T>(2408					collection_admin,2409					token_owner,2410					&mut self.collection_lazy_info.is_collection_admin,2411					&mut token_lazy_info.is_token_owner,2412					&mut token_lazy_info.is_token_exist,2413				)?,2414			}24152416			match value {2417				Some(value) => {2418					token_lazy_info2419						.stored_properties2420						.value_mut()2421						.try_set(key.clone(), value)2422						.map_err(<Error<T>>::from)?;24232424					<Pallet<T>>::deposit_event(Event::TokenPropertySet(2425						self.collection.id,2426						token_id,2427						key,2428					));2429				}2430				None => {2431					token_lazy_info2432						.stored_properties2433						.value_mut()2434						.remove(&key)2435						.map_err(<Error<T>>::from)?;24362437					<Pallet<T>>::deposit_event(Event::TokenPropertyDeleted(2438						self.collection.id,2439						token_id,2440						key,2441					));2442				}2443			}2444		}24452446		let properties_changed = token_lazy_info.stored_properties.has_value();2447		if properties_changed {2448			<PalletEvm<T>>::deposit_log(log);24492450			self.collection2451				.set_token_properties_raw(token_id, token_lazy_info.stored_properties.into_inner());2452		}24532454		Ok(())2455	}2456}24572458/// A helper structure for the [`PropertyWriter`] that holds2459/// the collection-related info. The info is loaded using lazy evaluation.2460/// This info is common for any token for which we write properties.2461pub struct PropertyWriterLazyCollectionInfo<'a> {2462	is_collection_admin: LazyValue<'a, bool>,2463	property_permissions: LazyValue<'a, PropertiesPermissionMap>,2464}24652466/// A helper structure for the [`PropertyWriter`] that holds2467/// the token-related info. The info is loaded using lazy evaluation.2468pub struct PropertyWriterLazyTokenInfo<'a> {2469	is_token_exist: LazyValue<'a, bool>,2470	is_token_owner: LazyValue<'a, Result<bool, DispatchError>>,2471	stored_properties: LazyValue<'a, TokenProperties>,2472}24732474impl<'a> PropertyWriterLazyTokenInfo<'a> {2475	/// Create a lazy token info.2476	pub fn new(2477		check_token_exist: impl FnOnce() -> bool + 'a,2478		check_token_owner: impl FnOnce() -> Result<bool, DispatchError> + 'a,2479		get_token_properties: impl FnOnce() -> TokenProperties + 'a,2480	) -> Self {2481		Self {2482			is_token_exist: LazyValue::new(check_token_exist),2483			is_token_owner: LazyValue::new(check_token_owner),2484			stored_properties: LazyValue::new(get_token_properties),2485		}2486	}2487}24882489/// A marker structure that enables the writer implementation2490/// to provide the interface to write properties to **newly created** tokens.2491pub struct NewTokenPropertyWriter<T>(PhantomData<T>);2492impl<T: Config> NewTokenPropertyWriter<T> {2493	/// Creates a [`PropertyWriter`] for **newly created** tokens.2494	pub fn new<'a, Handle>(2495		collection: &'a Handle,2496		sender: &'a T::CrossAccountId,2497	) -> PropertyWriter<'a, Self, T, Handle>2498	where2499		T: Config,2500		Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2501	{2502		PropertyWriter {2503			collection,2504			collection_lazy_info: PropertyWriterLazyCollectionInfo {2505				is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),2506				property_permissions: LazyValue::new(|| {2507					<Pallet<T>>::property_permissions(collection.id)2508				}),2509			},2510			_phantom: PhantomData,2511		}2512	}2513}25142515impl<'a, T, Handle> PropertyWriter<'a, NewTokenPropertyWriter<T>, T, Handle>2516where2517	T: Config,2518	Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2519{2520	/// A function to write properties to a **newly created** token.2521	pub fn write_token_properties(2522		&mut self,2523		mint_target_is_sender: bool,2524		token_id: TokenId,2525		properties_updates: impl Iterator<Item = Property>,2526		log: evm_coder::ethereum::Log,2527	) -> DispatchResult {2528		let check_token_exist = || {2529			debug_assert!(self.collection.token_exists(token_id));2530			true2531		};25322533		let check_token_owner = || Ok(mint_target_is_sender);25342535		let get_token_properties = || {2536			debug_assert!(self.collection.get_token_properties_raw(token_id).is_none());2537			TokenProperties::new()2538		};25392540		self.internal_write_token_properties(2541			token_id,2542			PropertyWriterLazyTokenInfo::new(2543				check_token_exist,2544				check_token_owner,2545				get_token_properties,2546			),2547			properties_updates.map(|p| (p.key, Some(p.value))),2548			log,2549		)2550	}2551}25522553/// A marker structure that enables the writer implementation2554/// to provide the interface to write properties to **already existing** tokens.2555pub struct ExistingTokenPropertyWriter<T>(PhantomData<T>);2556impl<T: Config> ExistingTokenPropertyWriter<T> {2557	/// Creates a [`PropertyWriter`] for **already existing** tokens.2558	pub fn new<'a, Handle>(2559		collection: &'a Handle,2560		sender: &'a T::CrossAccountId,2561	) -> PropertyWriter<'a, Self, T, Handle>2562	where2563		Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2564	{2565		PropertyWriter {2566			collection,2567			collection_lazy_info: PropertyWriterLazyCollectionInfo {2568				is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),2569				property_permissions: LazyValue::new(|| {2570					<Pallet<T>>::property_permissions(collection.id)2571				}),2572			},2573			_phantom: PhantomData,2574		}2575	}2576}25772578impl<'a, T, Handle> PropertyWriter<'a, ExistingTokenPropertyWriter<T>, T, Handle>2579where2580	T: Config,2581	Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2582{2583	/// A function to write properties to an **already existing** token.2584	pub fn write_token_properties(2585		&mut self,2586		sender: &T::CrossAccountId,2587		token_id: TokenId,2588		properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,2589		nesting_budget: &dyn Budget,2590		log: evm_coder::ethereum::Log,2591	) -> DispatchResult {2592		let check_token_exist = || self.collection.token_exists(token_id);2593		let check_token_owner = || {2594			self.collection2595				.check_token_indirect_owner(token_id, sender, nesting_budget)2596		};2597		let get_token_properties = || {2598			self.collection2599				.get_token_properties_raw(token_id)2600				.unwrap_or_default()2601		};26022603		self.internal_write_token_properties(2604			token_id,2605			PropertyWriterLazyTokenInfo::new(2606				check_token_exist,2607				check_token_owner,2608				get_token_properties,2609			),2610			properties_updates,2611			log,2612		)2613	}2614}26152616/// A marker structure that enables the writer implementation2617/// to benchmark the token properties writing.2618#[cfg(feature = "runtime-benchmarks")]2619pub struct BenchmarkPropertyWriter<T>(PhantomData<T>);26202621#[cfg(feature = "runtime-benchmarks")]2622impl<T: Config> BenchmarkPropertyWriter<T> {2623	/// Creates a [`PropertyWriter`] for benchmarking tokens properties writing.2624	pub fn new<'a, Handle>(2625		collection: &'a Handle,2626		collection_lazy_info: PropertyWriterLazyCollectionInfo<'a>,2627	) -> PropertyWriter<'a, Self, T, Handle>2628	where2629		Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2630	{2631		PropertyWriter {2632			collection,2633			collection_lazy_info,2634			_phantom: PhantomData,2635		}2636	}26372638	/// Load the [`PropertyWriterLazyCollectionInfo`] from the storage.2639	pub fn load_collection_info<Handle>(2640		collection_handle: &Handle,2641		sender: &T::CrossAccountId,2642	) -> PropertyWriterLazyCollectionInfo<'static>2643	where2644		Handle: Deref<Target = CollectionHandle<T>>,2645	{2646		let is_collection_admin = collection_handle.is_owner_or_admin(sender);2647		let property_permissions = <Pallet<T>>::property_permissions(collection_handle.id);26482649		PropertyWriterLazyCollectionInfo {2650			is_collection_admin: LazyValue::new(move || is_collection_admin),2651			property_permissions: LazyValue::new(move || property_permissions),2652		}2653	}26542655	/// Load the [`PropertyWriterLazyTokenInfo`] with token properties from the storage.2656	pub fn load_token_properties<Handle>(2657		collection: &Handle,2658		token_id: TokenId,2659	) -> PropertyWriterLazyTokenInfo2660	where2661		Handle: CommonCollectionOperations<T>,2662	{2663		let stored_properties = collection2664			.get_token_properties_raw(token_id)2665			.unwrap_or_default();26662667		PropertyWriterLazyTokenInfo {2668			is_token_exist: LazyValue::new(|| true),2669			is_token_owner: LazyValue::new(|| Ok(true)),2670			stored_properties: LazyValue::new(move || stored_properties),2671		}2672	}2673}26742675#[cfg(feature = "runtime-benchmarks")]2676impl<'a, T, Handle> PropertyWriter<'a, BenchmarkPropertyWriter<T>, T, Handle>2677where2678	T: Config,2679	Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2680{2681	/// A function to benchmark the writing of token properties.2682	pub fn write_token_properties(2683		&mut self,2684		token_id: TokenId,2685		properties_updates: impl Iterator<Item = Property>,2686		log: evm_coder::ethereum::Log,2687	) -> DispatchResult {2688		let check_token_exist = || true;2689		let check_token_owner = || Ok(true);2690		let get_token_properties = TokenProperties::new;26912692		self.internal_write_token_properties(2693			token_id,2694			PropertyWriterLazyTokenInfo::new(2695				check_token_exist,2696				check_token_owner,2697				get_token_properties,2698			),2699			properties_updates.map(|p| (p.key, Some(p.value))),2700			log,2701		)2702	}2703}27042705/// Computes the weight of writing properties to tokens.2706/// * `properties_nums` - The properties num of each created token.2707/// * `per_token_weight_weight` - The function to obtain the weight2708/// of writing properties from a token's properties num.2709pub fn write_token_properties_total_weight<T: Config, I: Fn(u32) -> Weight>(2710	properties_nums: impl Iterator<Item = u32>,2711	per_token_weight: I,2712) -> Weight {2713	let mut weight = properties_nums2714		.filter_map(|properties_num| {2715			if properties_num > 0 {2716				Some(per_token_weight(properties_num))2717			} else {2718				None2719			}2720		})2721		.fold(Weight::zero(), |a, b| a.saturating_add(b));27222723	if !weight.is_zero() {2724		// If we are here, it means the token properties were written at least once.2725		// Because of that, some common collection data was also loaded; we must add this weight.2726		// However, this common data was loaded only once, which is guaranteed by the `PropertyWriter`.27272728		weight = weight.saturating_add(<SelfWeightOf<T>>::property_writer_load_collection_info());2729	}27302731	weight2732}27332734#[cfg(any(feature = "tests", test))]2735#[allow(missing_docs)]2736pub mod tests {2737	use crate::{Config, DispatchError, DispatchResult, LazyValue};27382739	const fn to_bool(u: u8) -> bool {2740		u != 02741	}27422743	#[derive(Debug)]2744	pub struct TestCase {2745		pub collection_admin: bool,2746		pub is_collection_admin: bool,2747		pub token_owner: bool,2748		pub is_token_owner: bool,2749		pub no_permission: bool,2750	}27512752	impl TestCase {2753		const fn new(2754			collection_admin: u8,2755			is_collection_admin: u8,2756			token_owner: u8,2757			is_token_owner: u8,2758			no_permission: u8,2759		) -> Self {2760			Self {2761				collection_admin: to_bool(collection_admin),2762				is_collection_admin: to_bool(is_collection_admin),2763				token_owner: to_bool(token_owner),2764				is_token_owner: to_bool(is_token_owner),2765				no_permission: to_bool(no_permission),2766			}2767		}2768	}27692770	#[rustfmt::skip]2771	pub const TABLE: [TestCase; 16] = [2772		//                    ┌╴collection_admin2773		//                    │  ┌╴is_collection_admin2774		//                    │  │   ┌╴token_owner2775		//                    │  │   │  ┌╴is_token_ownership2776		//                    │  │   │  │   ┌╴no_permission2777		/*  0*/ TestCase::new(0, 0,  0, 0,  1),2778		/*  1*/ TestCase::new(0, 0,  0, 1,  1),2779		/*  2*/ TestCase::new(0, 0,  1, 0,  1),2780		/*  3*/ TestCase::new(0, 0,  1, 1,  0),2781		/*  4*/ TestCase::new(0, 1,  0, 0,  1),2782		/*  5*/ TestCase::new(0, 1,  0, 1,  1),2783		/*  6*/ TestCase::new(0, 1,  1, 0,  1),2784		/*  7*/ TestCase::new(0, 1,  1, 1,  0),2785		/*  8*/ TestCase::new(1, 0,  0, 0,  1),2786		/*  9*/ TestCase::new(1, 0,  0, 1,  1),2787		/* 10*/ TestCase::new(1, 0,  1, 0,  1),2788		/* 11*/ TestCase::new(1, 0,  1, 1,  0),2789		/* 12*/ TestCase::new(1, 1,  0, 0,  0),2790		/* 13*/ TestCase::new(1, 1,  0, 1,  0),2791		/* 14*/ TestCase::new(1, 1,  1, 0,  0),2792		/* 15*/ TestCase::new(1, 1,  1, 1,  0),2793	];27942795	pub fn check_token_permissions<T: Config>(2796		collection_admin_permitted: bool,2797		token_owner_permitted: bool,2798		is_collection_admin: &mut LazyValue<bool>,2799		check_token_ownership: &mut LazyValue<Result<bool, DispatchError>>,2800		check_token_existence: &mut LazyValue<bool>,2801	) -> DispatchResult {2802		crate::check_token_permissions::<T>(2803			collection_admin_permitted,2804			token_owner_permitted,2805			is_collection_admin,2806			check_token_ownership,2807			check_token_existence,2808		)2809	}2810}
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
--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -507,7 +507,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,
@@ -858,7 +858,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/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) {