git.delta.rocks / unique-network / refs/commits / 9322aa344eaa

difftreelog

Add properties extrinsics

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

10 files changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -736,7 +736,24 @@
 	) -> DispatchResult {
 		collection.check_is_owner_or_admin(sender)?;
 
-		CollectionProperties::<T>::get(collection.id).try_change_property(property)?;
+		CollectionProperties::<T>::try_mutate(
+			collection.id,
+			|properties| properties.try_change_property(property.clone())
+		)?;
+
+		<Pallet<T>>::deposit_event(Event::CollectionPropertySet(collection.id, property));
+
+		Ok(())
+	}
+
+	pub fn change_collection_properties(
+		collection: &CollectionHandle<T>,
+		sender: &T::CrossAccountId,
+		properties: Vec<Property>,
+	) -> DispatchResult {
+		for property in properties {
+			Self::change_collection_property(collection, sender, property)?;
+		}
 
 		Ok(())
 	}
@@ -909,7 +926,8 @@
 	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 change_collection_properties(amount: u32) -> Weight;
+	fn change_token_properties(amount: u32) -> Weight;
 	fn transfer() -> Weight;
 	fn approve() -> Weight;
 	fn transfer_from() -> Weight;
@@ -945,17 +963,17 @@
 		amount: u128,
 	) -> DispatchResultWithPostInfo;
 
-	fn change_collection_property(
+	fn change_collection_properties(
 		&self,
 		sender: T::CrossAccountId,
-		property: Property,
+		properties: Vec<Property>,
 	) -> DispatchResultWithPostInfo;
 
-	fn change_token_property(
+	fn change_token_properties(
 		&self,
 		sender: T::CrossAccountId,
 		token_id: TokenId,
-		property: Property,
+		property: Vec<Property>,
 	) -> DispatchResultWithPostInfo;
 
 	fn transfer(
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -50,8 +50,12 @@
 		<SelfWeightOf<T>>::burn_item()
 	}
 
-	fn set_property() -> Weight {
-		<SelfWeightOf<T>>::set_property()
+	fn change_collection_properties(amount: u32) -> Weight {
+		<SelfWeightOf<T>>::change_collection_properties(amount)
+	}
+
+	fn change_token_properties(amount: u32) -> Weight {
+		<SelfWeightOf<T>>::change_token_properties(amount)
 	}
 
 	fn transfer() -> Weight {
@@ -229,19 +233,19 @@
 		)
 	}
 
-	fn change_collection_property(
+	fn change_collection_properties(
 		&self,
 		_sender: T::CrossAccountId,
-		_property: Property,
+		_property: Vec<Property>,
 	) -> DispatchResultWithPostInfo {
 		fail!(<Error<T>>::PropertiesNotAllowed)
 	}
 
-	fn change_token_property(
+	fn change_token_properties(
 		&self,
 		_sender: T::CrossAccountId,
 		_token_id: TokenId,
-		_property: Property,
+		_property: Vec<Property>,
 	) -> DispatchResultWithPostInfo {
 		fail!(<Error<T>>::PropertiesNotAllowed)
 	}
modifiedpallets/fungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -35,7 +35,8 @@
 	fn create_item() -> Weight;
 	fn create_multiple_items_ex(b: u32, ) -> Weight;
 	fn burn_item() -> Weight;
-	fn set_property() -> Weight;
+	fn change_collection_properties(amount: u32) -> Weight;
+	fn change_token_properties(amount: u32) -> Weight;
 	fn transfer() -> Weight;
 	fn approve() -> Weight;
 	fn transfer_from() -> Weight;
@@ -71,11 +72,16 @@
 			.saturating_add(T::DbWeight::get().writes(2 as Weight))
 	}
 
-	fn set_property() -> Weight {
+	fn change_collection_properties(amount: u32) -> Weight {
 		// Error
 		0
 	}
 
+	fn change_token_properties(amount: u32) -> Weight {
+		// Error
+		0
+	}
+
 	// Storage: Fungible Balance (r:2 w:2)
 	fn transfer() -> Weight {
 		(17_713_000 as Weight)
@@ -134,7 +140,12 @@
 			.saturating_add(RocksDbWeight::get().writes(2 as Weight))
 	}
 
-	fn set_property() -> Weight {
+	fn change_collection_properties(amount: u32) -> Weight {
+		// Error
+		0
+	}
+
+	fn change_token_properties(amount: u32) -> Weight {
 		// Error
 		0
 	}
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -50,8 +50,12 @@
 		<SelfWeightOf<T>>::burn_item()
 	}
 
-	fn set_property() -> Weight {
-		<SelfWeightOf<T>>::set_property()
+	fn change_collection_properties(amount: u32) -> Weight {
+		<SelfWeightOf<T>>::change_collection_properties(amount)
+	}
+
+	fn change_token_properties(amount: u32) -> Weight {
+		<SelfWeightOf<T>>::change_token_properties(amount)
 	}
 
 	fn transfer() -> Weight {
@@ -145,6 +149,33 @@
 		)
 	}
 
+	fn change_collection_properties(
+		&self,
+		sender: T::CrossAccountId,
+		properties: Vec<Property>,
+	) -> DispatchResultWithPostInfo {
+		let weight = <CommonWeights<T>>::change_collection_properties(properties.len() as u32);
+
+		with_weight(
+			<Pallet<T>>::change_collection_properties(self, &sender, properties),
+			weight
+		)
+	}
+
+	fn change_token_properties(
+		&self,
+		sender: T::CrossAccountId,
+		token_id: TokenId,
+		properties: Vec<Property>,
+	) -> DispatchResultWithPostInfo {
+		let weight = <CommonWeights<T>>::change_token_properties(properties.len() as u32);
+
+		with_weight(
+			<Pallet<T>>::change_token_properties(self, &sender, token_id, properties),
+			weight
+		)
+	}
+
 	fn burn_item(
 		&self,
 		sender: T::CrossAccountId,
@@ -239,32 +270,6 @@
 		} else {
 			Ok(().into())
 		}
-	}
-
-	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(
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -265,12 +265,11 @@
 			.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)?;
+		let token_data = <TokenData<T>>::get((collection.id, token_id))
+			.ok_or(<CommonError<T>>::TokenNotFound)?;
 
+		let check_token_owner = || -> DispatchResult {
 			ensure!(&token_data.owner == sender, <CommonError<T>>::NoPermission);
-
 			Ok(())
 		};
 
@@ -304,6 +303,27 @@
 		Ok(())
 	}
 
+	pub fn change_token_properties(
+		collection: &NonfungibleHandle<T>,
+		sender: &T::CrossAccountId,
+		token_id: TokenId,
+		properties: Vec<Property>,
+	) -> DispatchResult {
+		for property in properties {
+			Self::change_token_property(collection, sender, token_id, property)?;
+		}
+
+		Ok(())
+	}
+
+	pub fn change_collection_properties(
+		collection: &NonfungibleHandle<T>,
+		sender: &T::CrossAccountId,
+		properties: Vec<Property>,
+	) -> DispatchResult {
+		<PalletCommon<T>>::change_collection_properties(collection, sender, properties)
+	}
+
 	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,7 +36,8 @@
 	fn create_multiple_items(b: u32, ) -> Weight;
 	fn create_multiple_items_ex(b: u32, ) -> Weight;
 	fn burn_item() -> Weight;
-	fn set_property() -> Weight;
+	fn change_collection_properties(amount: u32) -> Weight;
+	fn change_token_properties(amount: u32) -> Weight;
 	fn transfer() -> Weight;
 	fn approve() -> Weight;
 	fn transfer_from() -> Weight;
@@ -92,11 +93,16 @@
 			.saturating_add(T::DbWeight::get().writes(4 as Weight))
 	}
 
-	fn set_property() -> Weight {
+	fn change_collection_properties(amount: u32) -> Weight {
 		// TODO calculate appropriate weight
-		50_000_000 as Weight
+		(50_000_000 as Weight).saturating_mul(amount as Weight)
 	}
 
+	fn change_token_properties(amount: u32) -> Weight {
+		// TODO calculate appropriate weight
+		(50_000_000 as Weight).saturating_mul(amount as Weight)
+	}
+
 	// Storage: Nonfungible TokenData (r:1 w:1)
 	// Storage: Nonfungible AccountBalance (r:2 w:2)
 	// Storage: Nonfungible Allowance (r:1 w:0)
@@ -187,9 +193,14 @@
 			.saturating_add(RocksDbWeight::get().writes(4 as Weight))
 	}
 
-	fn set_property() -> Weight {
+	fn change_collection_properties(amount: u32) -> Weight {
+		// TODO calculate appropriate weight
+		(50_000_000 as Weight).saturating_mul(amount as Weight)
+	}
+
+	fn change_token_properties(amount: u32) -> Weight {
 		// TODO calculate appropriate weight
-		50_000_000 as Weight
+		(50_000_000 as Weight).saturating_mul(amount as Weight)
 	}
 
 	// Storage: Nonfungible TokenData (r:1 w:1)
modifiedpallets/refungible/src/common.rsdiffbeforeafterboth
before · pallets/refungible/src/common.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use core::marker::PhantomData;1819use sp_std::collections::btree_map::BTreeMap;20use frame_support::{dispatch::DispatchResultWithPostInfo, fail, weights::Weight, BoundedVec};21use up_data_structs::{22	CollectionId, TokenId, CustomDataLimit, CreateItemExData, CreateRefungibleExData,23	budget::Budget, Property,24};25use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};26use sp_runtime::DispatchError;27use sp_std::{vec::Vec, vec};2829use crate::{30	AccountBalance, Allowance, Balance, Config, Error, Owned, Pallet, RefungibleHandle,31	SelfWeightOf, TokenData, weights::WeightInfo, TokensMinted,32};3334macro_rules! max_weight_of {35	($($method:ident ($($args:tt)*)),*) => {36		037		$(38			.max(<SelfWeightOf<T>>::$method($($args)*))39		)*40	};41}4243pub struct CommonWeights<T: Config>(PhantomData<T>);44impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {45	fn create_item() -> Weight {46		<SelfWeightOf<T>>::create_item()47	}4849	fn create_multiple_items(amount: u32) -> Weight {50		<SelfWeightOf<T>>::create_multiple_items(amount)51	}5253	fn create_multiple_items_ex(call: &CreateItemExData<T::CrossAccountId>) -> Weight {54		match call {55			CreateItemExData::RefungibleMultipleOwners(i) => {56				<SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(i.users.len() as u32)57			}58			CreateItemExData::RefungibleMultipleItems(i) => {59				<SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(i.len() as u32)60			}61			_ => 0,62		}63	}6465	fn burn_item() -> Weight {66		max_weight_of!(burn_item_partial(), burn_item_fully())67	}6869	fn set_property() -> Weight {70		<SelfWeightOf<T>>::set_property()71	}7273	fn transfer() -> Weight {74		max_weight_of!(75			transfer_normal(),76			transfer_creating(),77			transfer_removing(),78			transfer_creating_removing()79		)80	}8182	fn approve() -> Weight {83		<SelfWeightOf<T>>::approve()84	}8586	fn transfer_from() -> Weight {87		max_weight_of!(88			transfer_from_normal(),89			transfer_from_creating(),90			transfer_from_removing(),91			transfer_from_creating_removing()92		)93	}9495	fn burn_from() -> Weight {96		<SelfWeightOf<T>>::burn_from()97	}9899	fn set_variable_metadata(bytes: u32) -> Weight {100		<SelfWeightOf<T>>::set_variable_metadata(bytes)101	}102}103104fn map_create_data<T: Config>(105	data: up_data_structs::CreateItemData,106	to: &T::CrossAccountId,107) -> Result<CreateRefungibleExData<T::CrossAccountId>, DispatchError> {108	match data {109		up_data_structs::CreateItemData::ReFungible(data) => Ok(CreateRefungibleExData {110			const_data: data.const_data,111			variable_data: data.variable_data,112			users: {113				let mut out = BTreeMap::new();114				out.insert(to.clone(), data.pieces);115				out.try_into().expect("limit > 0")116			},117		}),118		_ => fail!(<Error<T>>::NotRefungibleDataUsedToMintFungibleCollectionToken),119	}120}121122impl<T: Config> CommonCollectionOperations<T> for RefungibleHandle<T> {123	fn create_item(124		&self,125		sender: T::CrossAccountId,126		to: T::CrossAccountId,127		data: up_data_structs::CreateItemData,128		nesting_budget: &dyn Budget,129	) -> DispatchResultWithPostInfo {130		with_weight(131			<Pallet<T>>::create_item(132				self,133				&sender,134				map_create_data::<T>(data, &to)?,135				nesting_budget,136			),137			<CommonWeights<T>>::create_item(),138		)139	}140141	fn create_multiple_items(142		&self,143		sender: T::CrossAccountId,144		to: T::CrossAccountId,145		data: Vec<up_data_structs::CreateItemData>,146		nesting_budget: &dyn Budget,147	) -> DispatchResultWithPostInfo {148		let data = data149			.into_iter()150			.map(|d| map_create_data::<T>(d, &to))151			.collect::<Result<Vec<_>, DispatchError>>()?;152153		let amount = data.len();154		with_weight(155			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),156			<CommonWeights<T>>::create_multiple_items(amount as u32),157		)158	}159160	fn create_multiple_items_ex(161		&self,162		sender: <T>::CrossAccountId,163		data: CreateItemExData<T::CrossAccountId>,164		nesting_budget: &dyn Budget,165	) -> DispatchResultWithPostInfo {166		let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);167		let data = match data {168			CreateItemExData::RefungibleMultipleOwners(r) => vec![r],169			CreateItemExData::RefungibleMultipleItems(r)170				if r.iter().all(|i| i.users.len() == 1) =>171			{172				r.into_inner()173			}174			_ => fail!(<Error<T>>::NotRefungibleDataUsedToMintFungibleCollectionToken),175		};176177		with_weight(178			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),179			weight,180		)181	}182183	fn burn_item(184		&self,185		sender: T::CrossAccountId,186		token: TokenId,187		amount: u128,188	) -> DispatchResultWithPostInfo {189		with_weight(190			<Pallet<T>>::burn(self, &sender, token, amount),191			<CommonWeights<T>>::burn_item(),192		)193	}194195	fn transfer(196		&self,197		from: T::CrossAccountId,198		to: T::CrossAccountId,199		token: TokenId,200		amount: u128,201		nesting_budget: &dyn Budget,202	) -> DispatchResultWithPostInfo {203		with_weight(204			<Pallet<T>>::transfer(self, &from, &to, token, amount, nesting_budget),205			<CommonWeights<T>>::transfer(),206		)207	}208209	fn approve(210		&self,211		sender: T::CrossAccountId,212		spender: T::CrossAccountId,213		token: TokenId,214		amount: u128,215	) -> DispatchResultWithPostInfo {216		with_weight(217			<Pallet<T>>::set_allowance(self, &sender, &spender, token, amount),218			<CommonWeights<T>>::approve(),219		)220	}221222	fn transfer_from(223		&self,224		sender: T::CrossAccountId,225		from: T::CrossAccountId,226		to: T::CrossAccountId,227		token: TokenId,228		amount: u128,229		nesting_budget: &dyn Budget,230	) -> DispatchResultWithPostInfo {231		with_weight(232			<Pallet<T>>::transfer_from(self, &sender, &from, &to, token, amount, nesting_budget),233			<CommonWeights<T>>::transfer_from(),234		)235	}236237	fn burn_from(238		&self,239		sender: T::CrossAccountId,240		from: T::CrossAccountId,241		token: TokenId,242		amount: u128,243		nesting_budget: &dyn Budget,244	) -> DispatchResultWithPostInfo {245		with_weight(246			<Pallet<T>>::burn_from(self, &sender, &from, token, amount, nesting_budget),247			<CommonWeights<T>>::burn_from(),248		)249	}250251	fn change_collection_property(252		&self,253		_sender: T::CrossAccountId,254		_property: Property,255	) -> DispatchResultWithPostInfo {256		fail!(<Error<T>>::PropertiesNotAllowed)257	}258259	fn change_token_property(260		&self,261		_sender: T::CrossAccountId,262		_token_id: TokenId,263		_property: Property,264	) -> DispatchResultWithPostInfo {265		fail!(<Error<T>>::PropertiesNotAllowed)266	}267268	fn set_variable_metadata(269		&self,270		sender: T::CrossAccountId,271		token: TokenId,272		data: BoundedVec<u8, CustomDataLimit>,273	) -> DispatchResultWithPostInfo {274		let len = data.len();275		with_weight(276			<Pallet<T>>::set_variable_metadata(self, &sender, token, data),277			<CommonWeights<T>>::set_variable_metadata(len as u32),278		)279	}280281	fn check_nesting(282		&self,283		_sender: <T>::CrossAccountId,284		_from: (CollectionId, TokenId),285		_under: TokenId,286		_budget: &dyn Budget,287	) -> sp_runtime::DispatchResult {288		fail!(<Error<T>>::RefungibleDisallowsNesting)289	}290291	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {292		<Owned<T>>::iter_prefix((self.id, account))293			.map(|(id, _)| id)294			.collect()295	}296297	fn collection_tokens(&self) -> Vec<TokenId> {298		<TokenData<T>>::iter_prefix((self.id,))299			.map(|(id, _)| id)300			.collect()301	}302303	fn token_exists(&self, token: TokenId) -> bool {304		<Pallet<T>>::token_exists(self, token)305	}306307	fn last_token_id(&self) -> TokenId {308		TokenId(<TokensMinted<T>>::get(self.id))309	}310311	fn token_owner(&self, _token: TokenId) -> Option<T::CrossAccountId> {312		None313	}314	fn const_metadata(&self, token: TokenId) -> Vec<u8> {315		<TokenData<T>>::get((self.id, token))316			.const_data317			.into_inner()318	}319	fn variable_metadata(&self, token: TokenId) -> Vec<u8> {320		<TokenData<T>>::get((self.id, token))321			.variable_data322			.into_inner()323	}324325	fn total_supply(&self) -> u32 {326		<Pallet<T>>::total_supply(self)327	}328329	fn account_balance(&self, account: T::CrossAccountId) -> u32 {330		<AccountBalance<T>>::get((self.id, account))331	}332333	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {334		<Balance<T>>::get((self.id, token, account))335	}336337	fn allowance(338		&self,339		sender: T::CrossAccountId,340		spender: T::CrossAccountId,341		token: TokenId,342	) -> u128 {343		<Allowance<T>>::get((self.id, token, sender, spender))344	}345}
modifiedpallets/refungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/refungible/src/weights.rs
+++ b/pallets/refungible/src/weights.rs
@@ -38,7 +38,8 @@
 	fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight;
 	fn burn_item_partial() -> Weight;
 	fn burn_item_fully() -> Weight;
-	fn set_property() -> Weight;
+	fn change_collection_properties(amount: u32) -> Weight;
+	fn change_token_properties(amount: u32) -> Weight;
 	fn transfer_normal() -> Weight;
 	fn transfer_creating() -> Weight;
 	fn transfer_removing() -> Weight;
@@ -131,11 +132,16 @@
 			.saturating_add(T::DbWeight::get().writes(6 as Weight))
 	}
 
-	fn set_property() -> Weight {
+	fn change_collection_properties(amount: u32) -> Weight {
 		// Error
 		0
 	}
 
+	fn change_token_properties(amount: u32) -> Weight {
+		// Error
+		0
+	}
+
 	// Storage: Refungible Balance (r:2 w:2)
 	fn transfer_normal() -> Weight {
 		(19_766_000 as Weight)
@@ -305,7 +311,12 @@
 			.saturating_add(RocksDbWeight::get().writes(6 as Weight))
 	}
 
-	fn set_property() -> Weight {
+	fn change_collection_properties(amount: u32) -> Weight {
+		// Error
+		0
+	}
+
+	fn change_token_properties(amount: u32) -> Weight {
 		// Error
 		0
 	}
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -694,6 +694,35 @@
 			dispatch_call::<T, _>(collection_id, |d| d.create_multiple_items(sender, owner, items_data, &budget))
 		}
 
+		#[weight = T::CommonWeightInfo::change_collection_properties(properties.len() as u32)]
+		#[transactional]
+		pub fn change_collection_properties(
+			origin,
+			collection_id: CollectionId,
+			properties: Vec<Property>
+		) -> DispatchResultWithPostInfo {
+			ensure!(!properties.is_empty(), Error::<T>::EmptyArgument);
+
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+
+			dispatch_call::<T, _>(collection_id, |d| d.change_collection_properties(sender, properties))
+		}
+
+		#[weight = T::CommonWeightInfo::change_token_properties(properties.len() as u32)]
+		#[transactional]
+		pub fn change_token_properties(
+			origin,
+			collection_id: CollectionId,
+			token_id: TokenId,
+			properties: Vec<Property>
+		) -> DispatchResultWithPostInfo {
+			ensure!(!properties.is_empty(), Error::<T>::EmptyArgument);
+
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+
+			dispatch_call::<T, _>(collection_id, |d| d.change_token_properties(sender, token_id, properties))
+		}
+
 		#[weight = T::CommonWeightInfo::create_multiple_items_ex(&data)]
 		#[transactional]
 		pub fn create_multiple_items_ex(origin, collection_id: CollectionId, data: CreateItemExData<T::CrossAccountId>) -> DispatchResultWithPostInfo {
modifiedruntime/common/src/weights.rsdiffbeforeafterboth
--- a/runtime/common/src/weights.rs
+++ b/runtime/common/src/weights.rs
@@ -54,8 +54,12 @@
 		dispatch_weight::<T>() + max_weight_of!(burn_item())
 	}
 
-	fn set_property() -> Weight {
-		dispatch_weight::<T>() + max_weight_of!(set_property())
+	fn change_collection_properties(amount: u32) -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(change_collection_properties(amount))
+	}
+
+	fn change_token_properties(amount: u32) -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(change_token_properties(amount))
 	}
 
 	fn transfer() -> Weight {