git.delta.rocks / unique-network / refs/commits / b69992369f0e

difftreelog

Add first draft of Properties

Daniel Shiposha2022-04-29parent: #c01b00c.patch.diff
in: master

14 files changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -18,7 +18,7 @@
 
 use core::ops::{Deref, DerefMut};
 use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
-use sp_std::vec::Vec;
+use sp_std::{vec::Vec, collections::btree_map::BTreeMap};
 use pallet_evm::account::CrossAccountId;
 use frame_support::{
 	dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, Weight, PostDispatchInfo},
@@ -35,7 +35,8 @@
 	FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MAX_SPONSOR_TIMEOUT,
 	CUSTOM_DATA_LIMIT, CollectionLimits, CustomDataLimit, CreateCollectionData, SponsorshipState,
 	CreateItemExData, SponsoringRateLimit, budget::Budget, COLLECTION_FIELD_LIMIT, CollectionField,
-	PhantomType,
+	PhantomType, Property, Properties, PropertiesPermissionMap, PropertyKey, PropertyPermission,
+	PropertiesError,
 };
 pub use pallet::*;
 use sp_core::H160;
@@ -288,6 +289,10 @@
 			T::CrossAccountId,
 			u128,
 		),
+
+		CollectionPropertySet(CollectionId, Property),
+
+		TokenPropertySet(CollectionId, TokenId, Property),
 	}
 
 	#[pallet::error]
@@ -319,7 +324,6 @@
 		CollectionLimitBoundsExceeded,
 		/// Tried to enable permissions which are only permitted to be disabled
 		OwnerPermissionsCantBeReverted,
-
 		/// Collection settings not allowing items transferring
 		TransferNotAllowed,
 		/// Account token limit exceeded per collection
@@ -372,6 +376,25 @@
 		QueryKind = OptionQuery,
 	>;
 
+	/// Collection properties
+	#[pallet::storage]
+	pub type CollectionProperties<T> = StorageMap<
+		Hasher = Blake2_128Concat,
+		Key = CollectionId,
+		Value = Properties,
+		QueryKind = ValueQuery,
+		OnEmpty = up_data_structs::CollectionProperties,
+	>;
+
+	#[pallet::storage]
+	#[pallet::getter(fn property_permission)]
+	pub type CollectionPropertyPermissions<T> = StorageMap<
+		Hasher = Blake2_128Concat,
+		Key = CollectionId,
+		Value = PropertiesPermissionMap,
+		QueryKind = ValueQuery,
+	>;
+
 	/// Large variable-size collection fields are extracted here
 	#[pallet::storage]
 	pub type CollectionData<T> = StorageNMap<
@@ -538,6 +561,7 @@
 			sponsorship,
 			limits,
 			meta_update_permission,
+			..
 		} = <CollectionById<T>>::get(collection)?;
 		Some(RpcCollection {
 			name: name.into_inner(),
@@ -615,8 +639,25 @@
 				.map(|limits| Self::clamp_limits(data.mode.clone(), &Default::default(), limits))
 				.unwrap_or_else(|| Ok(CollectionLimits::default()))?,
 			meta_update_permission: data.meta_update_permission.unwrap_or_default(),
+			// token_property_permissions: data.token_property_permissions.unwrap_or_default(),
+			// properties: Properties::from_collection_props_vec(data.properties)?
 		};
 
+		CollectionProperties::<T>::insert(
+			id,
+			Properties::from_collection_props_vec(data.properties)?,
+		);
+
+		let token_props_permissions: PropertiesPermissionMap = data
+			.token_property_permissions
+			.into_iter()
+			.map(|property| (property.key, property.permission))
+			.collect::<BTreeMap<_, _>>()
+			.try_into()
+			.map_err(|_| PropertiesError::PropertyLimitReached)?;
+
+		CollectionPropertyPermissions::<T>::insert(id, token_props_permissions);
+
 		// Take a (non-refundable) deposit of collection creation
 		{
 			let mut imbalance =
@@ -688,6 +729,34 @@
 		Ok(())
 	}
 
+	pub fn change_collection_property(
+		collection: &CollectionHandle<T>,
+		sender: &T::CrossAccountId,
+		property: Property,
+	) -> DispatchResult {
+		collection.check_is_owner_or_admin(sender)?;
+
+		CollectionProperties::<T>::get(collection.id).try_change_property(property)?;
+
+		Ok(())
+	}
+
+	pub fn change_property_permission(
+		collection: &CollectionHandle<T>,
+		sender: &T::CrossAccountId,
+		property_key: PropertyKey,
+		permission: PropertyPermission,
+	) -> DispatchResult {
+		collection.check_is_owner_or_admin(sender)?;
+
+		CollectionPropertyPermissions::<T>::try_mutate(collection.id, |permissions| {
+			permissions.try_insert(property_key, permission)
+		})
+		.map_err(|_| PropertiesError::PropertyLimitReached)?;
+
+		Ok(())
+	}
+
 	fn set_field_raw(
 		collection_id: CollectionId,
 		field: CollectionField,
@@ -840,6 +909,7 @@
 	fn create_multiple_items(amount: u32) -> Weight;
 	fn create_multiple_items_ex(cost: &CreateItemExData<CrossAccountId>) -> Weight;
 	fn burn_item() -> Weight;
+	fn set_property() -> Weight;
 	fn transfer() -> Weight;
 	fn approve() -> Weight;
 	fn transfer_from() -> Weight;
@@ -875,6 +945,19 @@
 		amount: u128,
 	) -> DispatchResultWithPostInfo;
 
+	fn change_collection_property(
+		&self,
+		sender: T::CrossAccountId,
+		property: Property,
+	) -> DispatchResultWithPostInfo;
+
+	fn change_token_property(
+		&self,
+		sender: T::CrossAccountId,
+		token_id: TokenId,
+		property: Property,
+	) -> DispatchResultWithPostInfo;
+
 	fn transfer(
 		&self,
 		sender: T::CrossAccountId,
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -21,7 +21,7 @@
 use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};
 use sp_runtime::ArithmeticError;
 use sp_std::{vec::Vec, vec};
-use up_data_structs::CustomDataLimit;
+use up_data_structs::{CustomDataLimit, Property};
 
 use crate::{
 	Allowance, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf, weights::WeightInfo,
@@ -50,6 +50,10 @@
 		<SelfWeightOf<T>>::burn_item()
 	}
 
+	fn set_property() -> Weight {
+		<SelfWeightOf<T>>::set_property()
+	}
+
 	fn transfer() -> Weight {
 		<SelfWeightOf<T>>::transfer()
 	}
@@ -225,6 +229,23 @@
 		)
 	}
 
+	fn change_collection_property(
+		&self,
+		_sender: T::CrossAccountId,
+		_property: Property,
+	) -> DispatchResultWithPostInfo {
+		fail!(<Error<T>>::PropertiesNotAllowed)
+	}
+
+	fn change_token_property(
+		&self,
+		_sender: T::CrossAccountId,
+		_token_id: TokenId,
+		_property: Property,
+	) -> DispatchResultWithPostInfo {
+		fail!(<Error<T>>::PropertiesNotAllowed)
+	}
+
 	fn set_variable_metadata(
 		&self,
 		_sender: T::CrossAccountId,
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -61,6 +61,8 @@
 		FungibleItemsDontHaveData,
 		/// Fungible token does not support nested
 		FungibleDisallowsNesting,
+		/// Item properties are not allowed
+		PropertiesNotAllowed,
 	}
 
 	#[pallet::config]
modifiedpallets/fungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -35,6 +35,7 @@
 	fn create_item() -> Weight;
 	fn create_multiple_items_ex(b: u32, ) -> Weight;
 	fn burn_item() -> Weight;
+	fn set_property() -> Weight;
 	fn transfer() -> Weight;
 	fn approve() -> Weight;
 	fn transfer_from() -> Weight;
@@ -69,6 +70,12 @@
 			.saturating_add(T::DbWeight::get().reads(2 as Weight))
 			.saturating_add(T::DbWeight::get().writes(2 as Weight))
 	}
+
+	fn set_property() -> Weight {
+		// Error
+		0
+	}
+
 	// Storage: Fungible Balance (r:2 w:2)
 	fn transfer() -> Weight {
 		(17_713_000 as Weight)
@@ -126,6 +133,12 @@
 			.saturating_add(RocksDbWeight::get().reads(2 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(2 as Weight))
 	}
+
+	fn set_property() -> Weight {
+		// Error
+		0
+	}
+
 	// Storage: Fungible Balance (r:2 w:2)
 	fn transfer() -> Weight {
 		(17_713_000 as Weight)
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -17,7 +17,9 @@
 use core::marker::PhantomData;
 
 use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, BoundedVec};
-use up_data_structs::{TokenId, CustomDataLimit, CreateItemExData, CollectionId, budget::Budget};
+use up_data_structs::{
+	TokenId, CustomDataLimit, CreateItemExData, CollectionId, budget::Budget, Property,
+};
 use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};
 use sp_runtime::DispatchError;
 use sp_std::vec::Vec;
@@ -48,6 +50,10 @@
 		<SelfWeightOf<T>>::burn_item()
 	}
 
+	fn set_property() -> Weight {
+		<SelfWeightOf<T>>::set_property()
+	}
+
 	fn transfer() -> Weight {
 		<SelfWeightOf<T>>::transfer()
 	}
@@ -235,6 +241,32 @@
 		}
 	}
 
+	fn change_collection_property(
+		&self,
+		sender: T::CrossAccountId,
+		property: Property,
+	) -> DispatchResultWithPostInfo {
+		// let token_id = None;
+		with_weight(
+			// <Pallet<T>>::change_property(self, &sender, token_id, property),
+			Ok(()),
+			<CommonWeights<T>>::set_property(),
+		)
+	}
+
+	fn change_token_property(
+		&self,
+		sender: T::CrossAccountId,
+		token_id: TokenId,
+		property: Property,
+	) -> DispatchResultWithPostInfo {
+		with_weight(
+			// <Pallet<T>>::change_property(self, &sender, Some(token_id), property),
+			Ok(()),
+			<CommonWeights<T>>::set_property(),
+		)
+	}
+
 	fn set_variable_metadata(
 		&self,
 		sender: T::CrossAccountId,
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -20,7 +20,7 @@
 use frame_support::{BoundedVec, ensure, fail};
 use up_data_structs::{
 	AccessMode, CollectionId, CustomDataLimit, TokenId, CreateCollectionData, CreateNftExData,
-	mapping::TokenAddressMapping, NestingRule, budget::Budget,
+	mapping::TokenAddressMapping, NestingRule, budget::Budget, Property, PropertyPermission,
 };
 use pallet_evm::account::CrossAccountId;
 use pallet_common::{
@@ -94,6 +94,14 @@
 		QueryKind = OptionQuery,
 	>;
 
+	#[pallet::storage]
+	pub type TokenProperties<T: Config> = StorageNMap<
+		Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
+		Value = up_data_structs::Properties,
+		QueryKind = ValueQuery,
+		OnEmpty = up_data_structs::TokenProperties,
+	>;
+
 	/// Used to enumerate tokens owned by account
 	#[pallet::storage]
 	pub type Owned<T: Config> = StorageNMap<
@@ -246,6 +254,56 @@
 		Ok(())
 	}
 
+	pub fn change_token_property(
+		collection: &NonfungibleHandle<T>,
+		sender: &T::CrossAccountId,
+		token_id: TokenId,
+		property: Property,
+	) -> DispatchResult {
+		let permission = <PalletCommon<T>>::property_permission(collection.id)
+			.get(&property.key)
+			.map(|p| p.clone())
+			.unwrap_or(PropertyPermission::None);
+
+		let check_token_owner = || -> DispatchResult {
+			let token_data = <TokenData<T>>::get((collection.id, token_id))
+				.ok_or(<CommonError<T>>::TokenNotFound)?;
+
+			ensure!(&token_data.owner == sender, <CommonError<T>>::NoPermission);
+
+			Ok(())
+		};
+
+		let is_property_exists = TokenProperties::<T>::get((collection.id, token_id))
+			.get_property(&property.key)
+			.is_some();
+
+		match (permission, is_property_exists) {
+			(PropertyPermission::AdminConst, false) => {
+				collection.check_is_owner_or_admin(sender)?
+			}
+			(PropertyPermission::Admin, _) => collection.check_is_owner_or_admin(sender)?,
+			(PropertyPermission::ItemOwnerConst, false) => check_token_owner()?,
+			(PropertyPermission::ItemOwner, _) => check_token_owner()?,
+			(PropertyPermission::ItemOwnerOrAdmin, _) => {
+				check_token_owner().or(collection.check_is_owner_or_admin(sender))?;
+			}
+			_ => return Err(<CommonError<T>>::NoPermission.into()),
+		}
+
+		<TokenProperties<T>>::try_mutate((collection.id, token_id), |properties| {
+			properties.try_change_property(property.clone())
+		})?;
+
+		<PalletCommon<T>>::deposit_event(CommonEvent::TokenPropertySet(
+			collection.id,
+			token_id,
+			property,
+		));
+
+		Ok(())
+	}
+
 	pub fn transfer(
 		collection: &NonfungibleHandle<T>,
 		from: &T::CrossAccountId,
modifiedpallets/nonfungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -36,6 +36,7 @@
 	fn create_multiple_items(b: u32, ) -> Weight;
 	fn create_multiple_items_ex(b: u32, ) -> Weight;
 	fn burn_item() -> Weight;
+	fn set_property() -> Weight;
 	fn transfer() -> Weight;
 	fn approve() -> Weight;
 	fn transfer_from() -> Weight;
@@ -90,6 +91,12 @@
 			.saturating_add(T::DbWeight::get().reads(4 as Weight))
 			.saturating_add(T::DbWeight::get().writes(4 as Weight))
 	}
+
+	fn set_property() -> Weight {
+		// TODO calculate appropriate weight
+		50_000_000 as Weight
+	}
+
 	// Storage: Nonfungible TokenData (r:1 w:1)
 	// Storage: Nonfungible AccountBalance (r:2 w:2)
 	// Storage: Nonfungible Allowance (r:1 w:0)
@@ -179,6 +186,12 @@
 			.saturating_add(RocksDbWeight::get().reads(4 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(4 as Weight))
 	}
+
+	fn set_property() -> Weight {
+		// TODO calculate appropriate weight
+		50_000_000 as Weight
+	}
+
 	// Storage: Nonfungible TokenData (r:1 w:1)
 	// Storage: Nonfungible AccountBalance (r:2 w:2)
 	// Storage: Nonfungible Allowance (r:1 w:0)
modifiedpallets/refungible/src/common.rsdiffbeforeafterboth
--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -20,7 +20,7 @@
 use frame_support::{dispatch::DispatchResultWithPostInfo, fail, weights::Weight, BoundedVec};
 use up_data_structs::{
 	CollectionId, TokenId, CustomDataLimit, CreateItemExData, CreateRefungibleExData,
-	budget::Budget,
+	budget::Budget, Property,
 };
 use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};
 use sp_runtime::DispatchError;
@@ -66,6 +66,10 @@
 		max_weight_of!(burn_item_partial(), burn_item_fully())
 	}
 
+	fn set_property() -> Weight {
+		<SelfWeightOf<T>>::set_property()
+	}
+
 	fn transfer() -> Weight {
 		max_weight_of!(
 			transfer_normal(),
@@ -244,6 +248,23 @@
 		)
 	}
 
+	fn change_collection_property(
+		&self,
+		_sender: T::CrossAccountId,
+		_property: Property,
+	) -> DispatchResultWithPostInfo {
+		fail!(<Error<T>>::PropertiesNotAllowed)
+	}
+
+	fn change_token_property(
+		&self,
+		_sender: T::CrossAccountId,
+		_token_id: TokenId,
+		_property: Property,
+	) -> DispatchResultWithPostInfo {
+		fail!(<Error<T>>::PropertiesNotAllowed)
+	}
+
 	fn set_variable_metadata(
 		&self,
 		sender: T::CrossAccountId,
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -62,6 +62,8 @@
 		WrongRefungiblePieces,
 		/// Refungible token can't nest other tokens
 		RefungibleDisallowsNesting,
+		/// Item properties are not allowed
+		PropertiesNotAllowed,
 	}
 
 	#[pallet::config]
modifiedpallets/refungible/src/weights.rsdiffbeforeafterboth
before · pallets/refungible/src/weights.rs
1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_refungible4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-03-01, STEPS: `50`, REPEAT: 200, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 102489// Executed Command:10// target/release/unique-collator11// benchmark12// --pallet13// pallet-refungible14// --wasm-execution15// compiled16// --extrinsic17// *18// --template19// .maintain/frame-weight-template.hbs20// --steps=5021// --repeat=20022// --heap-pages=409623// --output=./pallets/refungible/src/weights.rs2425#![cfg_attr(rustfmt, rustfmt_skip)]26#![allow(unused_parens)]27#![allow(unused_imports)]28#![allow(clippy::unnecessary_cast)]2930use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};31use sp_std::marker::PhantomData;3233/// Weight functions needed for pallet_refungible.34pub trait WeightInfo {35	fn create_item() -> Weight;36	fn create_multiple_items(b: u32, ) -> Weight;37	fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight;38	fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight;39	fn burn_item_partial() -> Weight;40	fn burn_item_fully() -> Weight;41	fn transfer_normal() -> Weight;42	fn transfer_creating() -> Weight;43	fn transfer_removing() -> Weight;44	fn transfer_creating_removing() -> Weight;45	fn approve() -> Weight;46	fn transfer_from_normal() -> Weight;47	fn transfer_from_creating() -> Weight;48	fn transfer_from_removing() -> Weight;49	fn transfer_from_creating_removing() -> Weight;50	fn burn_from() -> Weight;51	fn set_variable_metadata(b: u32, ) -> Weight;52}5354/// Weights for pallet_refungible using the Substrate node and recommended hardware.55pub struct SubstrateWeight<T>(PhantomData<T>);56impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {57	// Storage: Refungible TokensMinted (r:1 w:1)58	// Storage: Refungible AccountBalance (r:1 w:1)59	// Storage: Refungible Balance (r:0 w:1)60	// Storage: Refungible TotalSupply (r:0 w:1)61	// Storage: Refungible TokenData (r:0 w:1)62	// Storage: Refungible Owned (r:0 w:1)63	fn create_item() -> Weight {64		(21_255_000 as Weight)65			.saturating_add(T::DbWeight::get().reads(2 as Weight))66			.saturating_add(T::DbWeight::get().writes(6 as Weight))67	}68	// Storage: Refungible TokensMinted (r:1 w:1)69	// Storage: Refungible AccountBalance (r:1 w:1)70	// Storage: Refungible Balance (r:0 w:4)71	// Storage: Refungible TotalSupply (r:0 w:4)72	// Storage: Refungible TokenData (r:0 w:4)73	// Storage: Refungible Owned (r:0 w:4)74	fn create_multiple_items(b: u32, ) -> Weight {75		(18_052_000 as Weight)76			// Standard Error: 1_00077			.saturating_add((5_549_000 as Weight).saturating_mul(b as Weight))78			.saturating_add(T::DbWeight::get().reads(2 as Weight))79			.saturating_add(T::DbWeight::get().writes(2 as Weight))80			.saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))81	}82	// Storage: Refungible TokensMinted (r:1 w:1)83	// Storage: Refungible AccountBalance (r:4 w:4)84	// Storage: Refungible Balance (r:0 w:4)85	// Storage: Refungible TotalSupply (r:0 w:4)86	// Storage: Refungible TokenData (r:0 w:4)87	// Storage: Refungible Owned (r:0 w:4)88	fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {89		(15_766_000 as Weight)90			// Standard Error: 2_00091			.saturating_add((8_187_000 as Weight).saturating_mul(b as Weight))92			.saturating_add(T::DbWeight::get().reads(1 as Weight))93			.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))94			.saturating_add(T::DbWeight::get().writes(1 as Weight))95			.saturating_add(T::DbWeight::get().writes((5 as Weight).saturating_mul(b as Weight)))96	}97	// Storage: Refungible TokensMinted (r:1 w:1)98	// Storage: Refungible TotalSupply (r:0 w:1)99	// Storage: Refungible TokenData (r:0 w:1)100	// Storage: Refungible AccountBalance (r:4 w:4)101	// Storage: Refungible Balance (r:0 w:4)102	// Storage: Refungible Owned (r:0 w:4)103	fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {104		(5_675_000 as Weight)105			// Standard Error: 2_000106			.saturating_add((6_315_000 as Weight).saturating_mul(b as Weight))107			.saturating_add(T::DbWeight::get().reads(1 as Weight))108			.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))109			.saturating_add(T::DbWeight::get().writes(3 as Weight))110			.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))111	}112	// Storage: Refungible TotalSupply (r:1 w:1)113	// Storage: Refungible Balance (r:1 w:1)114	// Storage: Refungible AccountBalance (r:1 w:1)115	// Storage: Refungible Owned (r:0 w:1)116	fn burn_item_partial() -> Weight {117		(23_518_000 as Weight)118			.saturating_add(T::DbWeight::get().reads(3 as Weight))119			.saturating_add(T::DbWeight::get().writes(4 as Weight))120	}121	// Storage: Refungible TotalSupply (r:1 w:1)122	// Storage: Refungible Balance (r:1 w:1)123	// Storage: Refungible AccountBalance (r:1 w:1)124	// Storage: Refungible TokensBurnt (r:1 w:1)125	// Storage: Refungible TokenData (r:0 w:1)126	// Storage: Refungible Owned (r:0 w:1)127	fn burn_item_fully() -> Weight {128		(32_489_000 as Weight)129			.saturating_add(T::DbWeight::get().reads(4 as Weight))130			.saturating_add(T::DbWeight::get().writes(6 as Weight))131	}132	// Storage: Refungible Balance (r:2 w:2)133	fn transfer_normal() -> Weight {134		(19_766_000 as Weight)135			.saturating_add(T::DbWeight::get().reads(2 as Weight))136			.saturating_add(T::DbWeight::get().writes(2 as Weight))137	}138	// Storage: Refungible Balance (r:2 w:2)139	// Storage: Refungible AccountBalance (r:1 w:1)140	// Storage: Refungible Owned (r:0 w:1)141	fn transfer_creating() -> Weight {142		(23_360_000 as Weight)143			.saturating_add(T::DbWeight::get().reads(3 as Weight))144			.saturating_add(T::DbWeight::get().writes(4 as Weight))145	}146	// Storage: Refungible Balance (r:2 w:2)147	// Storage: Refungible AccountBalance (r:1 w:1)148	// Storage: Refungible Owned (r:0 w:1)149	fn transfer_removing() -> Weight {150		(25_344_000 as Weight)151			.saturating_add(T::DbWeight::get().reads(3 as Weight))152			.saturating_add(T::DbWeight::get().writes(4 as Weight))153	}154	// Storage: Refungible Balance (r:2 w:2)155	// Storage: Refungible AccountBalance (r:2 w:2)156	// Storage: Refungible Owned (r:0 w:2)157	fn transfer_creating_removing() -> Weight {158		(28_553_000 as Weight)159			.saturating_add(T::DbWeight::get().reads(4 as Weight))160			.saturating_add(T::DbWeight::get().writes(6 as Weight))161	}162	// Storage: Refungible Balance (r:1 w:0)163	// Storage: Refungible Allowance (r:0 w:1)164	fn approve() -> Weight {165		(15_356_000 as Weight)166			.saturating_add(T::DbWeight::get().reads(1 as Weight))167			.saturating_add(T::DbWeight::get().writes(1 as Weight))168	}169	// Storage: Refungible Allowance (r:1 w:1)170	// Storage: Refungible Balance (r:2 w:2)171	fn transfer_from_normal() -> Weight {172		(28_832_000 as Weight)173			.saturating_add(T::DbWeight::get().reads(3 as Weight))174			.saturating_add(T::DbWeight::get().writes(3 as Weight))175	}176	// Storage: Refungible Allowance (r:1 w:1)177	// Storage: Refungible Balance (r:2 w:2)178	// Storage: Refungible AccountBalance (r:1 w:1)179	// Storage: Refungible Owned (r:0 w:1)180	fn transfer_from_creating() -> Weight {181		(32_132_000 as Weight)182			.saturating_add(T::DbWeight::get().reads(4 as Weight))183			.saturating_add(T::DbWeight::get().writes(5 as Weight))184	}185	// Storage: Refungible Allowance (r:1 w:1)186	// Storage: Refungible Balance (r:2 w:2)187	// Storage: Refungible AccountBalance (r:1 w:1)188	// Storage: Refungible Owned (r:0 w:1)189	fn transfer_from_removing() -> Weight {190		(33_237_000 as Weight)191			.saturating_add(T::DbWeight::get().reads(4 as Weight))192			.saturating_add(T::DbWeight::get().writes(5 as Weight))193	}194	// Storage: Refungible Allowance (r:1 w:1)195	// Storage: Refungible Balance (r:2 w:2)196	// Storage: Refungible AccountBalance (r:2 w:2)197	// Storage: Refungible Owned (r:0 w:2)198	fn transfer_from_creating_removing() -> Weight {199		(36_399_000 as Weight)200			.saturating_add(T::DbWeight::get().reads(5 as Weight))201			.saturating_add(T::DbWeight::get().writes(7 as Weight))202	}203	// Storage: Refungible Allowance (r:1 w:1)204	// Storage: Refungible TotalSupply (r:1 w:1)205	// Storage: Refungible Balance (r:1 w:1)206	// Storage: Refungible AccountBalance (r:1 w:1)207	// Storage: Refungible TokensBurnt (r:1 w:1)208	// Storage: Refungible TokenData (r:0 w:1)209	// Storage: Refungible Owned (r:0 w:1)210	fn burn_from() -> Weight {211		(42_043_000 as Weight)212			.saturating_add(T::DbWeight::get().reads(5 as Weight))213			.saturating_add(T::DbWeight::get().writes(7 as Weight))214	}215	// Storage: Refungible TokenData (r:1 w:1)216	fn set_variable_metadata(_b: u32, ) -> Weight {217		(7_364_000 as Weight)218			.saturating_add(T::DbWeight::get().reads(1 as Weight))219			.saturating_add(T::DbWeight::get().writes(1 as Weight))220	}221}222223// For backwards compatibility and tests224impl WeightInfo for () {225	// Storage: Refungible TokensMinted (r:1 w:1)226	// Storage: Refungible AccountBalance (r:1 w:1)227	// Storage: Refungible Balance (r:0 w:1)228	// Storage: Refungible TotalSupply (r:0 w:1)229	// Storage: Refungible TokenData (r:0 w:1)230	// Storage: Refungible Owned (r:0 w:1)231	fn create_item() -> Weight {232		(21_255_000 as Weight)233			.saturating_add(RocksDbWeight::get().reads(2 as Weight))234			.saturating_add(RocksDbWeight::get().writes(6 as Weight))235	}236	// Storage: Refungible TokensMinted (r:1 w:1)237	// Storage: Refungible AccountBalance (r:1 w:1)238	// Storage: Refungible Balance (r:0 w:4)239	// Storage: Refungible TotalSupply (r:0 w:4)240	// Storage: Refungible TokenData (r:0 w:4)241	// Storage: Refungible Owned (r:0 w:4)242	fn create_multiple_items(b: u32, ) -> Weight {243		(18_052_000 as Weight)244			// Standard Error: 1_000245			.saturating_add((5_549_000 as Weight).saturating_mul(b as Weight))246			.saturating_add(RocksDbWeight::get().reads(2 as Weight))247			.saturating_add(RocksDbWeight::get().writes(2 as Weight))248			.saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))249	}250	// Storage: Refungible TokensMinted (r:1 w:1)251	// Storage: Refungible AccountBalance (r:4 w:4)252	// Storage: Refungible Balance (r:0 w:4)253	// Storage: Refungible TotalSupply (r:0 w:4)254	// Storage: Refungible TokenData (r:0 w:4)255	// Storage: Refungible Owned (r:0 w:4)256	fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {257		(15_766_000 as Weight)258			// Standard Error: 2_000259			.saturating_add((8_187_000 as Weight).saturating_mul(b as Weight))260			.saturating_add(RocksDbWeight::get().reads(1 as Weight))261			.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))262			.saturating_add(RocksDbWeight::get().writes(1 as Weight))263			.saturating_add(RocksDbWeight::get().writes((5 as Weight).saturating_mul(b as Weight)))264	}265	// Storage: Refungible TokensMinted (r:1 w:1)266	// Storage: Refungible TotalSupply (r:0 w:1)267	// Storage: Refungible TokenData (r:0 w:1)268	// Storage: Refungible AccountBalance (r:4 w:4)269	// Storage: Refungible Balance (r:0 w:4)270	// Storage: Refungible Owned (r:0 w:4)271	fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {272		(5_675_000 as Weight)273			// Standard Error: 2_000274			.saturating_add((6_315_000 as Weight).saturating_mul(b as Weight))275			.saturating_add(RocksDbWeight::get().reads(1 as Weight))276			.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))277			.saturating_add(RocksDbWeight::get().writes(3 as Weight))278			.saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))279	}280	// Storage: Refungible TotalSupply (r:1 w:1)281	// Storage: Refungible Balance (r:1 w:1)282	// Storage: Refungible AccountBalance (r:1 w:1)283	// Storage: Refungible Owned (r:0 w:1)284	fn burn_item_partial() -> Weight {285		(23_518_000 as Weight)286			.saturating_add(RocksDbWeight::get().reads(3 as Weight))287			.saturating_add(RocksDbWeight::get().writes(4 as Weight))288	}289	// Storage: Refungible TotalSupply (r:1 w:1)290	// Storage: Refungible Balance (r:1 w:1)291	// Storage: Refungible AccountBalance (r:1 w:1)292	// Storage: Refungible TokensBurnt (r:1 w:1)293	// Storage: Refungible TokenData (r:0 w:1)294	// Storage: Refungible Owned (r:0 w:1)295	fn burn_item_fully() -> Weight {296		(32_489_000 as Weight)297			.saturating_add(RocksDbWeight::get().reads(4 as Weight))298			.saturating_add(RocksDbWeight::get().writes(6 as Weight))299	}300	// Storage: Refungible Balance (r:2 w:2)301	fn transfer_normal() -> Weight {302		(19_766_000 as Weight)303			.saturating_add(RocksDbWeight::get().reads(2 as Weight))304			.saturating_add(RocksDbWeight::get().writes(2 as Weight))305	}306	// Storage: Refungible Balance (r:2 w:2)307	// Storage: Refungible AccountBalance (r:1 w:1)308	// Storage: Refungible Owned (r:0 w:1)309	fn transfer_creating() -> Weight {310		(23_360_000 as Weight)311			.saturating_add(RocksDbWeight::get().reads(3 as Weight))312			.saturating_add(RocksDbWeight::get().writes(4 as Weight))313	}314	// Storage: Refungible Balance (r:2 w:2)315	// Storage: Refungible AccountBalance (r:1 w:1)316	// Storage: Refungible Owned (r:0 w:1)317	fn transfer_removing() -> Weight {318		(25_344_000 as Weight)319			.saturating_add(RocksDbWeight::get().reads(3 as Weight))320			.saturating_add(RocksDbWeight::get().writes(4 as Weight))321	}322	// Storage: Refungible Balance (r:2 w:2)323	// Storage: Refungible AccountBalance (r:2 w:2)324	// Storage: Refungible Owned (r:0 w:2)325	fn transfer_creating_removing() -> Weight {326		(28_553_000 as Weight)327			.saturating_add(RocksDbWeight::get().reads(4 as Weight))328			.saturating_add(RocksDbWeight::get().writes(6 as Weight))329	}330	// Storage: Refungible Balance (r:1 w:0)331	// Storage: Refungible Allowance (r:0 w:1)332	fn approve() -> Weight {333		(15_356_000 as Weight)334			.saturating_add(RocksDbWeight::get().reads(1 as Weight))335			.saturating_add(RocksDbWeight::get().writes(1 as Weight))336	}337	// Storage: Refungible Allowance (r:1 w:1)338	// Storage: Refungible Balance (r:2 w:2)339	fn transfer_from_normal() -> Weight {340		(28_832_000 as Weight)341			.saturating_add(RocksDbWeight::get().reads(3 as Weight))342			.saturating_add(RocksDbWeight::get().writes(3 as Weight))343	}344	// Storage: Refungible Allowance (r:1 w:1)345	// Storage: Refungible Balance (r:2 w:2)346	// Storage: Refungible AccountBalance (r:1 w:1)347	// Storage: Refungible Owned (r:0 w:1)348	fn transfer_from_creating() -> Weight {349		(32_132_000 as Weight)350			.saturating_add(RocksDbWeight::get().reads(4 as Weight))351			.saturating_add(RocksDbWeight::get().writes(5 as Weight))352	}353	// Storage: Refungible Allowance (r:1 w:1)354	// Storage: Refungible Balance (r:2 w:2)355	// Storage: Refungible AccountBalance (r:1 w:1)356	// Storage: Refungible Owned (r:0 w:1)357	fn transfer_from_removing() -> Weight {358		(33_237_000 as Weight)359			.saturating_add(RocksDbWeight::get().reads(4 as Weight))360			.saturating_add(RocksDbWeight::get().writes(5 as Weight))361	}362	// Storage: Refungible Allowance (r:1 w:1)363	// Storage: Refungible Balance (r:2 w:2)364	// Storage: Refungible AccountBalance (r:2 w:2)365	// Storage: Refungible Owned (r:0 w:2)366	fn transfer_from_creating_removing() -> Weight {367		(36_399_000 as Weight)368			.saturating_add(RocksDbWeight::get().reads(5 as Weight))369			.saturating_add(RocksDbWeight::get().writes(7 as Weight))370	}371	// Storage: Refungible Allowance (r:1 w:1)372	// Storage: Refungible TotalSupply (r:1 w:1)373	// Storage: Refungible Balance (r:1 w:1)374	// Storage: Refungible AccountBalance (r:1 w:1)375	// Storage: Refungible TokensBurnt (r:1 w:1)376	// Storage: Refungible TokenData (r:0 w:1)377	// Storage: Refungible Owned (r:0 w:1)378	fn burn_from() -> Weight {379		(42_043_000 as Weight)380			.saturating_add(RocksDbWeight::get().reads(5 as Weight))381			.saturating_add(RocksDbWeight::get().writes(7 as Weight))382	}383	// Storage: Refungible TokenData (r:1 w:1)384	fn set_variable_metadata(_b: u32, ) -> Weight {385		(7_364_000 as Weight)386			.saturating_add(RocksDbWeight::get().reads(1 as Weight))387			.saturating_add(RocksDbWeight::get().writes(1 as Weight))388	}389}
after · pallets/refungible/src/weights.rs
1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_refungible4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-03-01, STEPS: `50`, REPEAT: 200, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 102489// Executed Command:10// target/release/unique-collator11// benchmark12// --pallet13// pallet-refungible14// --wasm-execution15// compiled16// --extrinsic17// *18// --template19// .maintain/frame-weight-template.hbs20// --steps=5021// --repeat=20022// --heap-pages=409623// --output=./pallets/refungible/src/weights.rs2425#![cfg_attr(rustfmt, rustfmt_skip)]26#![allow(unused_parens)]27#![allow(unused_imports)]28#![allow(clippy::unnecessary_cast)]2930use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};31use sp_std::marker::PhantomData;3233/// Weight functions needed for pallet_refungible.34pub trait WeightInfo {35	fn create_item() -> Weight;36	fn create_multiple_items(b: u32, ) -> Weight;37	fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight;38	fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight;39	fn burn_item_partial() -> Weight;40	fn burn_item_fully() -> Weight;41	fn set_property() -> Weight;42	fn transfer_normal() -> Weight;43	fn transfer_creating() -> Weight;44	fn transfer_removing() -> Weight;45	fn transfer_creating_removing() -> Weight;46	fn approve() -> Weight;47	fn transfer_from_normal() -> Weight;48	fn transfer_from_creating() -> Weight;49	fn transfer_from_removing() -> Weight;50	fn transfer_from_creating_removing() -> Weight;51	fn burn_from() -> Weight;52	fn set_variable_metadata(b: u32, ) -> Weight;53}5455/// Weights for pallet_refungible using the Substrate node and recommended hardware.56pub struct SubstrateWeight<T>(PhantomData<T>);57impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {58	// Storage: Refungible TokensMinted (r:1 w:1)59	// Storage: Refungible AccountBalance (r:1 w:1)60	// Storage: Refungible Balance (r:0 w:1)61	// Storage: Refungible TotalSupply (r:0 w:1)62	// Storage: Refungible TokenData (r:0 w:1)63	// Storage: Refungible Owned (r:0 w:1)64	fn create_item() -> Weight {65		(21_255_000 as Weight)66			.saturating_add(T::DbWeight::get().reads(2 as Weight))67			.saturating_add(T::DbWeight::get().writes(6 as Weight))68	}69	// Storage: Refungible TokensMinted (r:1 w:1)70	// Storage: Refungible AccountBalance (r:1 w:1)71	// Storage: Refungible Balance (r:0 w:4)72	// Storage: Refungible TotalSupply (r:0 w:4)73	// Storage: Refungible TokenData (r:0 w:4)74	// Storage: Refungible Owned (r:0 w:4)75	fn create_multiple_items(b: u32, ) -> Weight {76		(18_052_000 as Weight)77			// Standard Error: 1_00078			.saturating_add((5_549_000 as Weight).saturating_mul(b as Weight))79			.saturating_add(T::DbWeight::get().reads(2 as Weight))80			.saturating_add(T::DbWeight::get().writes(2 as Weight))81			.saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))82	}83	// Storage: Refungible TokensMinted (r:1 w:1)84	// Storage: Refungible AccountBalance (r:4 w:4)85	// Storage: Refungible Balance (r:0 w:4)86	// Storage: Refungible TotalSupply (r:0 w:4)87	// Storage: Refungible TokenData (r:0 w:4)88	// Storage: Refungible Owned (r:0 w:4)89	fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {90		(15_766_000 as Weight)91			// Standard Error: 2_00092			.saturating_add((8_187_000 as Weight).saturating_mul(b as Weight))93			.saturating_add(T::DbWeight::get().reads(1 as Weight))94			.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))95			.saturating_add(T::DbWeight::get().writes(1 as Weight))96			.saturating_add(T::DbWeight::get().writes((5 as Weight).saturating_mul(b as Weight)))97	}98	// Storage: Refungible TokensMinted (r:1 w:1)99	// Storage: Refungible TotalSupply (r:0 w:1)100	// Storage: Refungible TokenData (r:0 w:1)101	// Storage: Refungible AccountBalance (r:4 w:4)102	// Storage: Refungible Balance (r:0 w:4)103	// Storage: Refungible Owned (r:0 w:4)104	fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {105		(5_675_000 as Weight)106			// Standard Error: 2_000107			.saturating_add((6_315_000 as Weight).saturating_mul(b as Weight))108			.saturating_add(T::DbWeight::get().reads(1 as Weight))109			.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))110			.saturating_add(T::DbWeight::get().writes(3 as Weight))111			.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))112	}113	// Storage: Refungible TotalSupply (r:1 w:1)114	// Storage: Refungible Balance (r:1 w:1)115	// Storage: Refungible AccountBalance (r:1 w:1)116	// Storage: Refungible Owned (r:0 w:1)117	fn burn_item_partial() -> Weight {118		(23_518_000 as Weight)119			.saturating_add(T::DbWeight::get().reads(3 as Weight))120			.saturating_add(T::DbWeight::get().writes(4 as Weight))121	}122	// Storage: Refungible TotalSupply (r:1 w:1)123	// Storage: Refungible Balance (r:1 w:1)124	// Storage: Refungible AccountBalance (r:1 w:1)125	// Storage: Refungible TokensBurnt (r:1 w:1)126	// Storage: Refungible TokenData (r:0 w:1)127	// Storage: Refungible Owned (r:0 w:1)128	fn burn_item_fully() -> Weight {129		(32_489_000 as Weight)130			.saturating_add(T::DbWeight::get().reads(4 as Weight))131			.saturating_add(T::DbWeight::get().writes(6 as Weight))132	}133134	fn set_property() -> Weight {135		// Error136		0137	}138139	// Storage: Refungible Balance (r:2 w:2)140	fn transfer_normal() -> Weight {141		(19_766_000 as Weight)142			.saturating_add(T::DbWeight::get().reads(2 as Weight))143			.saturating_add(T::DbWeight::get().writes(2 as Weight))144	}145	// Storage: Refungible Balance (r:2 w:2)146	// Storage: Refungible AccountBalance (r:1 w:1)147	// Storage: Refungible Owned (r:0 w:1)148	fn transfer_creating() -> Weight {149		(23_360_000 as Weight)150			.saturating_add(T::DbWeight::get().reads(3 as Weight))151			.saturating_add(T::DbWeight::get().writes(4 as Weight))152	}153	// Storage: Refungible Balance (r:2 w:2)154	// Storage: Refungible AccountBalance (r:1 w:1)155	// Storage: Refungible Owned (r:0 w:1)156	fn transfer_removing() -> Weight {157		(25_344_000 as Weight)158			.saturating_add(T::DbWeight::get().reads(3 as Weight))159			.saturating_add(T::DbWeight::get().writes(4 as Weight))160	}161	// Storage: Refungible Balance (r:2 w:2)162	// Storage: Refungible AccountBalance (r:2 w:2)163	// Storage: Refungible Owned (r:0 w:2)164	fn transfer_creating_removing() -> Weight {165		(28_553_000 as Weight)166			.saturating_add(T::DbWeight::get().reads(4 as Weight))167			.saturating_add(T::DbWeight::get().writes(6 as Weight))168	}169	// Storage: Refungible Balance (r:1 w:0)170	// Storage: Refungible Allowance (r:0 w:1)171	fn approve() -> Weight {172		(15_356_000 as Weight)173			.saturating_add(T::DbWeight::get().reads(1 as Weight))174			.saturating_add(T::DbWeight::get().writes(1 as Weight))175	}176	// Storage: Refungible Allowance (r:1 w:1)177	// Storage: Refungible Balance (r:2 w:2)178	fn transfer_from_normal() -> Weight {179		(28_832_000 as Weight)180			.saturating_add(T::DbWeight::get().reads(3 as Weight))181			.saturating_add(T::DbWeight::get().writes(3 as Weight))182	}183	// Storage: Refungible Allowance (r:1 w:1)184	// Storage: Refungible Balance (r:2 w:2)185	// Storage: Refungible AccountBalance (r:1 w:1)186	// Storage: Refungible Owned (r:0 w:1)187	fn transfer_from_creating() -> Weight {188		(32_132_000 as Weight)189			.saturating_add(T::DbWeight::get().reads(4 as Weight))190			.saturating_add(T::DbWeight::get().writes(5 as Weight))191	}192	// Storage: Refungible Allowance (r:1 w:1)193	// Storage: Refungible Balance (r:2 w:2)194	// Storage: Refungible AccountBalance (r:1 w:1)195	// Storage: Refungible Owned (r:0 w:1)196	fn transfer_from_removing() -> Weight {197		(33_237_000 as Weight)198			.saturating_add(T::DbWeight::get().reads(4 as Weight))199			.saturating_add(T::DbWeight::get().writes(5 as Weight))200	}201	// Storage: Refungible Allowance (r:1 w:1)202	// Storage: Refungible Balance (r:2 w:2)203	// Storage: Refungible AccountBalance (r:2 w:2)204	// Storage: Refungible Owned (r:0 w:2)205	fn transfer_from_creating_removing() -> Weight {206		(36_399_000 as Weight)207			.saturating_add(T::DbWeight::get().reads(5 as Weight))208			.saturating_add(T::DbWeight::get().writes(7 as Weight))209	}210	// Storage: Refungible Allowance (r:1 w:1)211	// Storage: Refungible TotalSupply (r:1 w:1)212	// Storage: Refungible Balance (r:1 w:1)213	// Storage: Refungible AccountBalance (r:1 w:1)214	// Storage: Refungible TokensBurnt (r:1 w:1)215	// Storage: Refungible TokenData (r:0 w:1)216	// Storage: Refungible Owned (r:0 w:1)217	fn burn_from() -> Weight {218		(42_043_000 as Weight)219			.saturating_add(T::DbWeight::get().reads(5 as Weight))220			.saturating_add(T::DbWeight::get().writes(7 as Weight))221	}222	// Storage: Refungible TokenData (r:1 w:1)223	fn set_variable_metadata(_b: u32, ) -> Weight {224		(7_364_000 as Weight)225			.saturating_add(T::DbWeight::get().reads(1 as Weight))226			.saturating_add(T::DbWeight::get().writes(1 as Weight))227	}228}229230// For backwards compatibility and tests231impl WeightInfo for () {232	// Storage: Refungible TokensMinted (r:1 w:1)233	// Storage: Refungible AccountBalance (r:1 w:1)234	// Storage: Refungible Balance (r:0 w:1)235	// Storage: Refungible TotalSupply (r:0 w:1)236	// Storage: Refungible TokenData (r:0 w:1)237	// Storage: Refungible Owned (r:0 w:1)238	fn create_item() -> Weight {239		(21_255_000 as Weight)240			.saturating_add(RocksDbWeight::get().reads(2 as Weight))241			.saturating_add(RocksDbWeight::get().writes(6 as Weight))242	}243	// Storage: Refungible TokensMinted (r:1 w:1)244	// Storage: Refungible AccountBalance (r:1 w:1)245	// Storage: Refungible Balance (r:0 w:4)246	// Storage: Refungible TotalSupply (r:0 w:4)247	// Storage: Refungible TokenData (r:0 w:4)248	// Storage: Refungible Owned (r:0 w:4)249	fn create_multiple_items(b: u32, ) -> Weight {250		(18_052_000 as Weight)251			// Standard Error: 1_000252			.saturating_add((5_549_000 as Weight).saturating_mul(b as Weight))253			.saturating_add(RocksDbWeight::get().reads(2 as Weight))254			.saturating_add(RocksDbWeight::get().writes(2 as Weight))255			.saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))256	}257	// Storage: Refungible TokensMinted (r:1 w:1)258	// Storage: Refungible AccountBalance (r:4 w:4)259	// Storage: Refungible Balance (r:0 w:4)260	// Storage: Refungible TotalSupply (r:0 w:4)261	// Storage: Refungible TokenData (r:0 w:4)262	// Storage: Refungible Owned (r:0 w:4)263	fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {264		(15_766_000 as Weight)265			// Standard Error: 2_000266			.saturating_add((8_187_000 as Weight).saturating_mul(b as Weight))267			.saturating_add(RocksDbWeight::get().reads(1 as Weight))268			.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))269			.saturating_add(RocksDbWeight::get().writes(1 as Weight))270			.saturating_add(RocksDbWeight::get().writes((5 as Weight).saturating_mul(b as Weight)))271	}272	// Storage: Refungible TokensMinted (r:1 w:1)273	// Storage: Refungible TotalSupply (r:0 w:1)274	// Storage: Refungible TokenData (r:0 w:1)275	// Storage: Refungible AccountBalance (r:4 w:4)276	// Storage: Refungible Balance (r:0 w:4)277	// Storage: Refungible Owned (r:0 w:4)278	fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {279		(5_675_000 as Weight)280			// Standard Error: 2_000281			.saturating_add((6_315_000 as Weight).saturating_mul(b as Weight))282			.saturating_add(RocksDbWeight::get().reads(1 as Weight))283			.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))284			.saturating_add(RocksDbWeight::get().writes(3 as Weight))285			.saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))286	}287	// Storage: Refungible TotalSupply (r:1 w:1)288	// Storage: Refungible Balance (r:1 w:1)289	// Storage: Refungible AccountBalance (r:1 w:1)290	// Storage: Refungible Owned (r:0 w:1)291	fn burn_item_partial() -> Weight {292		(23_518_000 as Weight)293			.saturating_add(RocksDbWeight::get().reads(3 as Weight))294			.saturating_add(RocksDbWeight::get().writes(4 as Weight))295	}296	// Storage: Refungible TotalSupply (r:1 w:1)297	// Storage: Refungible Balance (r:1 w:1)298	// Storage: Refungible AccountBalance (r:1 w:1)299	// Storage: Refungible TokensBurnt (r:1 w:1)300	// Storage: Refungible TokenData (r:0 w:1)301	// Storage: Refungible Owned (r:0 w:1)302	fn burn_item_fully() -> Weight {303		(32_489_000 as Weight)304			.saturating_add(RocksDbWeight::get().reads(4 as Weight))305			.saturating_add(RocksDbWeight::get().writes(6 as Weight))306	}307308	fn set_property() -> Weight {309		// Error310		0311	}312313	// Storage: Refungible Balance (r:2 w:2)314	fn transfer_normal() -> Weight {315		(19_766_000 as Weight)316			.saturating_add(RocksDbWeight::get().reads(2 as Weight))317			.saturating_add(RocksDbWeight::get().writes(2 as Weight))318	}319	// Storage: Refungible Balance (r:2 w:2)320	// Storage: Refungible AccountBalance (r:1 w:1)321	// Storage: Refungible Owned (r:0 w:1)322	fn transfer_creating() -> Weight {323		(23_360_000 as Weight)324			.saturating_add(RocksDbWeight::get().reads(3 as Weight))325			.saturating_add(RocksDbWeight::get().writes(4 as Weight))326	}327	// Storage: Refungible Balance (r:2 w:2)328	// Storage: Refungible AccountBalance (r:1 w:1)329	// Storage: Refungible Owned (r:0 w:1)330	fn transfer_removing() -> Weight {331		(25_344_000 as Weight)332			.saturating_add(RocksDbWeight::get().reads(3 as Weight))333			.saturating_add(RocksDbWeight::get().writes(4 as Weight))334	}335	// Storage: Refungible Balance (r:2 w:2)336	// Storage: Refungible AccountBalance (r:2 w:2)337	// Storage: Refungible Owned (r:0 w:2)338	fn transfer_creating_removing() -> Weight {339		(28_553_000 as Weight)340			.saturating_add(RocksDbWeight::get().reads(4 as Weight))341			.saturating_add(RocksDbWeight::get().writes(6 as Weight))342	}343	// Storage: Refungible Balance (r:1 w:0)344	// Storage: Refungible Allowance (r:0 w:1)345	fn approve() -> Weight {346		(15_356_000 as Weight)347			.saturating_add(RocksDbWeight::get().reads(1 as Weight))348			.saturating_add(RocksDbWeight::get().writes(1 as Weight))349	}350	// Storage: Refungible Allowance (r:1 w:1)351	// Storage: Refungible Balance (r:2 w:2)352	fn transfer_from_normal() -> Weight {353		(28_832_000 as Weight)354			.saturating_add(RocksDbWeight::get().reads(3 as Weight))355			.saturating_add(RocksDbWeight::get().writes(3 as Weight))356	}357	// Storage: Refungible Allowance (r:1 w:1)358	// Storage: Refungible Balance (r:2 w:2)359	// Storage: Refungible AccountBalance (r:1 w:1)360	// Storage: Refungible Owned (r:0 w:1)361	fn transfer_from_creating() -> Weight {362		(32_132_000 as Weight)363			.saturating_add(RocksDbWeight::get().reads(4 as Weight))364			.saturating_add(RocksDbWeight::get().writes(5 as Weight))365	}366	// Storage: Refungible Allowance (r:1 w:1)367	// Storage: Refungible Balance (r:2 w:2)368	// Storage: Refungible AccountBalance (r:1 w:1)369	// Storage: Refungible Owned (r:0 w:1)370	fn transfer_from_removing() -> Weight {371		(33_237_000 as Weight)372			.saturating_add(RocksDbWeight::get().reads(4 as Weight))373			.saturating_add(RocksDbWeight::get().writes(5 as Weight))374	}375	// Storage: Refungible Allowance (r:1 w:1)376	// Storage: Refungible Balance (r:2 w:2)377	// Storage: Refungible AccountBalance (r:2 w:2)378	// Storage: Refungible Owned (r:0 w:2)379	fn transfer_from_creating_removing() -> Weight {380		(36_399_000 as Weight)381			.saturating_add(RocksDbWeight::get().reads(5 as Weight))382			.saturating_add(RocksDbWeight::get().writes(7 as Weight))383	}384	// Storage: Refungible Allowance (r:1 w:1)385	// Storage: Refungible TotalSupply (r:1 w:1)386	// Storage: Refungible Balance (r:1 w:1)387	// Storage: Refungible AccountBalance (r:1 w:1)388	// Storage: Refungible TokensBurnt (r:1 w:1)389	// Storage: Refungible TokenData (r:0 w:1)390	// Storage: Refungible Owned (r:0 w:1)391	fn burn_from() -> Weight {392		(42_043_000 as Weight)393			.saturating_add(RocksDbWeight::get().reads(5 as Weight))394			.saturating_add(RocksDbWeight::get().writes(7 as Weight))395	}396	// Storage: Refungible TokenData (r:1 w:1)397	fn set_variable_metadata(_b: u32, ) -> Weight {398		(7_364_000 as Weight)399			.saturating_add(RocksDbWeight::get().reads(1 as Weight))400			.saturating_add(RocksDbWeight::get().writes(1 as Weight))401	}402}
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -39,7 +39,7 @@
 	MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
 	AccessMode, CreateItemData, CollectionLimits, CollectionId, CollectionMode, TokenId,
 	SchemaVersion, SponsorshipState, MetaUpdatePermission, CreateCollectionData, CustomDataLimit,
-	CreateItemExData, budget, CollectionField,
+	CreateItemExData, budget, CollectionField, Property,
 };
 use pallet_evm::account::CrossAccountId;
 use pallet_common::{
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -22,13 +22,14 @@
 };
 use frame_support::{
 	storage::{bounded_btree_map::BoundedBTreeMap, bounded_btree_set::BoundedBTreeSet},
+	traits::Get,
 };
 
 #[cfg(feature = "serde")]
 use serde::{Serialize, Deserialize};
 
 use sp_core::U256;
-use sp_runtime::{ArithmeticError, sp_std::prelude::Vec};
+use sp_runtime::{ArithmeticError, sp_std::prelude::Vec, DispatchError};
 use codec::{Decode, Encode, EncodeLike, MaxEncodedLen};
 use frame_support::{BoundedVec, traits::ConstU32};
 use derivative::Derivative;
@@ -85,6 +86,26 @@
 pub const MAX_COLLECTION_DESCRIPTION_LENGTH: u32 = 256;
 pub const MAX_TOKEN_PREFIX_LENGTH: u32 = 16;
 
+pub const MAX_PROPERTY_KEY_LENGTH: u32 = 256;
+pub const MAX_PROPERTY_VALUE_LENGTH: u32 = 32768;
+pub const MAX_PROPERTIES_PER_ITEM: u32 = 64;
+
+// pub const MAX_PROPERTY_KEYS_OVERALL_LENGTH: u32 = MAX_PROPERTY_KEY_LENGTH * MAX_PROPERTIES_PER_ITEM;
+pub const MAX_COLLECTION_PROPERTIES_SIZE: u32 = 40960;
+pub const MAX_TOKEN_PROPERTIES_SIZE: u32 = 32768;
+
+pub const MAX_COLLECTION_PROPERTIES_ENCODE_LEN: u32 =
+	MAX_PROPERTIES_PER_ITEM * MAX_PROPERTY_KEY_LENGTH + MAX_COLLECTION_PROPERTIES_SIZE;
+
+pub struct MaxPropertiesPermissionsEncodeLen;
+
+impl Get<u32> for MaxPropertiesPermissionsEncodeLen {
+	fn get() -> u32 {
+		MAX_PROPERTIES_PER_ITEM * MAX_PROPERTY_KEY_LENGTH
+			+ <PropertyPermission as MaxEncodedLen>::max_encoded_len() as u32
+	}
+}
+
 /// How much items can be created per single
 /// create_many call
 pub const MAX_ITEMS_PER_BATCH: u32 = 200;
@@ -310,31 +331,32 @@
 	OffchainSchema,
 }
 
-#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, Debug, Derivative, MaxEncodedLen)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
-#[derivative(Default(bound = ""))]
+#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, Derivative, MaxEncodedLen)]
+#[derivative(Debug, Default(bound = ""))]
 pub struct CreateCollectionData<AccountId> {
 	#[derivative(Default(value = "CollectionMode::NFT"))]
 	pub mode: CollectionMode,
 	pub access: Option<AccessMode>,
-	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
 	pub name: BoundedVec<u16, ConstU32<MAX_COLLECTION_NAME_LENGTH>>,
-	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
 	pub description: BoundedVec<u16, ConstU32<MAX_COLLECTION_DESCRIPTION_LENGTH>>,
-	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
 	pub token_prefix: BoundedVec<u8, ConstU32<MAX_TOKEN_PREFIX_LENGTH>>,
-	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
 	pub offchain_schema: BoundedVec<u8, ConstU32<OFFCHAIN_SCHEMA_LIMIT>>,
 	pub schema_version: Option<SchemaVersion>,
 	pub pending_sponsor: Option<AccountId>,
 	pub limits: Option<CollectionLimits>,
-	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
 	pub variable_on_chain_schema: BoundedVec<u8, ConstU32<VARIABLE_ON_CHAIN_SCHEMA_LIMIT>>,
-	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
 	pub const_on_chain_schema: BoundedVec<u8, ConstU32<CONST_ON_CHAIN_SCHEMA_LIMIT>>,
 	pub meta_update_permission: Option<MetaUpdatePermission>,
+	pub token_property_permissions: CollectionPropertiesPermissionsVec,
+	pub properties: CollectionPropertiesVec,
 }
 
+pub type CollectionPropertiesPermissionsVec =
+	BoundedVec<PropertyKeyPermission, MaxPropertiesPermissionsEncodeLen>;
+
+pub type CollectionPropertiesVec =
+	BoundedVec<Property, ConstU32<MAX_COLLECTION_PROPERTIES_ENCODE_LEN>>;
+
 #[derive(Encode, Decode, Debug, Clone, PartialEq, TypeInfo)]
 #[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
 pub struct NftItemType<AccountId> {
@@ -607,3 +629,128 @@
 		0
 	}
 }
+
+pub type PropertyKey = BoundedVec<u8, ConstU32<MAX_PROPERTY_KEY_LENGTH>>;
+pub type PropertyValue = BoundedVec<u8, ConstU32<MAX_PROPERTY_VALUE_LENGTH>>;
+
+#[derive(Encode, Decode, TypeInfo, Debug, MaxEncodedLen, PartialEq, Clone)]
+pub enum PropertyPermission {
+	None,
+	AdminConst,
+	Admin,
+	ItemOwnerConst,
+	ItemOwner,
+	ItemOwnerOrAdmin,
+}
+
+#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq, MaxEncodedLen)]
+pub struct Property {
+	pub key: PropertyKey,
+	pub value: PropertyValue,
+}
+
+#[derive(Encode, Decode, TypeInfo, Debug, MaxEncodedLen, PartialEq, Clone)]
+pub struct PropertyKeyPermission {
+	pub key: PropertyKey,
+	pub permission: PropertyPermission,
+}
+
+pub enum PropertiesError {
+	NoSpaceForProperty,
+	PropertyLimitReached,
+}
+
+impl From<PropertiesError> for DispatchError {
+	fn from(error: PropertiesError) -> Self {
+		match error {
+			PropertiesError::NoSpaceForProperty => DispatchError::Other("no space for property"),
+			PropertiesError::PropertyLimitReached => {
+				DispatchError::Other("property key limit reached")
+			}
+		}
+	}
+}
+
+pub type PropertiesMap =
+	BoundedBTreeMap<PropertyKey, PropertyValue, ConstU32<MAX_PROPERTIES_PER_ITEM>>;
+pub type PropertiesPermissionMap =
+	BoundedBTreeMap<PropertyKey, PropertyPermission, ConstU32<MAX_PROPERTIES_PER_ITEM>>;
+
+#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, MaxEncodedLen)]
+pub struct Properties {
+	map: PropertiesMap,
+	consumed_space: u32,
+	space_limit: u32,
+}
+
+impl Properties {
+	pub fn new(space_limit: u32) -> Self {
+		Self {
+			map: BoundedBTreeMap::new(),
+			consumed_space: 0,
+			space_limit,
+		}
+	}
+
+	pub fn from_collection_props_vec(
+		data: CollectionPropertiesVec,
+	) -> Result<Self, PropertiesError> {
+		let mut props = Self::new(MAX_COLLECTION_PROPERTIES_SIZE);
+
+		for property in data.into_iter() {
+			props.try_change_property(property)?;
+		}
+
+		Ok(props)
+	}
+
+	pub fn try_change_property(&mut self, property: Property) -> Result<(), PropertiesError> {
+		let value_len = property.value.len();
+
+		if self.consumed_space as usize + value_len > self.space_limit as usize {
+			return Err(PropertiesError::NoSpaceForProperty);
+		}
+
+		self.map
+			.try_insert(property.key, property.value)
+			.map_err(|_| PropertiesError::PropertyLimitReached)?;
+
+		self.consumed_space += value_len as u32;
+
+		Ok(())
+	}
+
+	pub fn get_property(&self, key: &PropertyKey) -> Option<&PropertyValue> {
+		self.map.get(key)
+	}
+}
+
+pub struct CollectionProperties;
+
+impl Get<Properties> for CollectionProperties {
+	fn get() -> Properties {
+		Properties::new(MAX_COLLECTION_PROPERTIES_SIZE)
+	}
+}
+
+pub struct TokenProperties;
+
+impl Get<Properties> for TokenProperties {
+	fn get() -> Properties {
+		Properties::new(MAX_TOKEN_PROPERTIES_SIZE)
+	}
+}
+
+// #[cfg(not(feature = "std"))]
+// fn properties_map_debug(_properties: &PropertiesMap, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
+// 	write!(f, "<properties>")
+// }
+
+// #[cfg(not(feature = "std"))]
+// fn opt_properties_permissions_map_debug(properties: &Option<PropertiesPermissionMap>, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
+// 	if properties.is_some() {
+// 		write!(f, "Some(<properties permissions>)")
+// 	 } else {
+// 		write!(f, "None")
+// 	}
+// }
modifiedprimitives/rpc/src/lib.rsdiffbeforeafterboth
--- a/primitives/rpc/src/lib.rs
+++ b/primitives/rpc/src/lib.rs
@@ -16,7 +16,9 @@
 
 #![cfg_attr(not(feature = "std"), no_std)]
 
-use up_data_structs::{CollectionId, TokenId, RpcCollection, CollectionStats, CollectionLimits};
+use up_data_structs::{
+	CollectionId, TokenId, RpcCollection, CollectionStats, CollectionLimits, Property,
+};
 use sp_std::vec::Vec;
 use codec::Decode;
 use sp_runtime::DispatchError;
modifiedruntime/common/src/weights.rsdiffbeforeafterboth
--- a/runtime/common/src/weights.rs
+++ b/runtime/common/src/weights.rs
@@ -54,6 +54,10 @@
 		dispatch_weight::<T>() + max_weight_of!(burn_item())
 	}
 
+	fn set_property() -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(set_property())
+	}
+
 	fn transfer() -> Weight {
 		dispatch_weight::<T>() + max_weight_of!(transfer())
 	}