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
before · pallets/nonfungible/src/common.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use core::marker::PhantomData;1819use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, BoundedVec};20use up_data_structs::{21	TokenId, CustomDataLimit, CreateItemExData, CollectionId, budget::Budget, Property,22};23use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};24use sp_runtime::DispatchError;25use sp_std::vec::Vec;2627use crate::{28	AccountBalance, Allowance, Config, CreateItemData, Error, NonfungibleHandle, Owned, Pallet,29	SelfWeightOf, TokenData, weights::WeightInfo, TokensMinted,30};3132pub struct CommonWeights<T: Config>(PhantomData<T>);33impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {34	fn create_item() -> Weight {35		<SelfWeightOf<T>>::create_item()36	}3738	fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {39		match data {40			CreateItemExData::NFT(t) => <SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32),41			_ => 0,42		}43	}4445	fn create_multiple_items(amount: u32) -> Weight {46		<SelfWeightOf<T>>::create_multiple_items(amount)47	}4849	fn burn_item() -> Weight {50		<SelfWeightOf<T>>::burn_item()51	}5253	fn set_property() -> Weight {54		<SelfWeightOf<T>>::set_property()55	}5657	fn transfer() -> Weight {58		<SelfWeightOf<T>>::transfer()59	}6061	fn approve() -> Weight {62		<SelfWeightOf<T>>::approve()63	}6465	fn transfer_from() -> Weight {66		<SelfWeightOf<T>>::transfer_from()67	}6869	fn burn_from() -> Weight {70		<SelfWeightOf<T>>::burn_from()71	}7273	fn set_variable_metadata(bytes: u32) -> Weight {74		<SelfWeightOf<T>>::set_variable_metadata(bytes)75	}76}7778fn map_create_data<T: Config>(79	data: up_data_structs::CreateItemData,80	to: &T::CrossAccountId,81) -> Result<CreateItemData<T>, DispatchError> {82	match data {83		up_data_structs::CreateItemData::NFT(data) => Ok(CreateItemData::<T> {84			const_data: data.const_data,85			variable_data: data.variable_data,86			owner: to.clone(),87		}),88		_ => fail!(<Error<T>>::NotNonfungibleDataUsedToMintFungibleCollectionToken),89	}90}9192impl<T: Config> CommonCollectionOperations<T> for NonfungibleHandle<T> {93	fn create_item(94		&self,95		sender: T::CrossAccountId,96		to: T::CrossAccountId,97		data: up_data_structs::CreateItemData,98		nesting_budget: &dyn Budget,99	) -> DispatchResultWithPostInfo {100		with_weight(101			<Pallet<T>>::create_item(102				self,103				&sender,104				map_create_data::<T>(data, &to)?,105				nesting_budget,106			),107			<CommonWeights<T>>::create_item(),108		)109	}110111	fn create_multiple_items(112		&self,113		sender: T::CrossAccountId,114		to: T::CrossAccountId,115		data: Vec<up_data_structs::CreateItemData>,116		nesting_budget: &dyn Budget,117	) -> DispatchResultWithPostInfo {118		let data = data119			.into_iter()120			.map(|d| map_create_data::<T>(d, &to))121			.collect::<Result<Vec<_>, DispatchError>>()?;122123		let amount = data.len();124		with_weight(125			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),126			<CommonWeights<T>>::create_multiple_items(amount as u32),127		)128	}129130	fn create_multiple_items_ex(131		&self,132		sender: <T>::CrossAccountId,133		data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,134		nesting_budget: &dyn Budget,135	) -> DispatchResultWithPostInfo {136		let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);137		let data = match data {138			up_data_structs::CreateItemExData::NFT(nft) => nft,139			_ => fail!(Error::<T>::NotNonfungibleDataUsedToMintFungibleCollectionToken),140		};141142		with_weight(143			<Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),144			weight,145		)146	}147148	fn burn_item(149		&self,150		sender: T::CrossAccountId,151		token: TokenId,152		amount: u128,153	) -> DispatchResultWithPostInfo {154		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);155		if amount == 1 {156			with_weight(157				<Pallet<T>>::burn(self, &sender, token),158				<CommonWeights<T>>::burn_item(),159			)160		} else {161			Ok(().into())162		}163	}164165	fn transfer(166		&self,167		from: T::CrossAccountId,168		to: T::CrossAccountId,169		token: TokenId,170		amount: u128,171		nesting_budget: &dyn Budget,172	) -> DispatchResultWithPostInfo {173		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);174		if amount == 1 {175			with_weight(176				<Pallet<T>>::transfer(self, &from, &to, token, nesting_budget),177				<CommonWeights<T>>::transfer(),178			)179		} else {180			Ok(().into())181		}182	}183184	fn approve(185		&self,186		sender: T::CrossAccountId,187		spender: T::CrossAccountId,188		token: TokenId,189		amount: u128,190	) -> DispatchResultWithPostInfo {191		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);192193		with_weight(194			if amount == 1 {195				<Pallet<T>>::set_allowance(self, &sender, token, Some(&spender))196			} else {197				<Pallet<T>>::set_allowance(self, &sender, token, None)198			},199			<CommonWeights<T>>::approve(),200		)201	}202203	fn transfer_from(204		&self,205		sender: T::CrossAccountId,206		from: T::CrossAccountId,207		to: T::CrossAccountId,208		token: TokenId,209		amount: u128,210		nesting_budget: &dyn Budget,211	) -> DispatchResultWithPostInfo {212		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);213214		if amount == 1 {215			with_weight(216				<Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget),217				<CommonWeights<T>>::transfer_from(),218			)219		} else {220			Ok(().into())221		}222	}223224	fn burn_from(225		&self,226		sender: T::CrossAccountId,227		from: T::CrossAccountId,228		token: TokenId,229		amount: u128,230		nesting_budget: &dyn Budget,231	) -> DispatchResultWithPostInfo {232		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);233234		if amount == 1 {235			with_weight(236				<Pallet<T>>::burn_from(self, &sender, &from, token, nesting_budget),237				<CommonWeights<T>>::burn_from(),238			)239		} else {240			Ok(().into())241		}242	}243244	fn change_collection_property(245		&self,246		sender: T::CrossAccountId,247		property: Property,248	) -> DispatchResultWithPostInfo {249		// let token_id = None;250		with_weight(251			// <Pallet<T>>::change_property(self, &sender, token_id, property),252			Ok(()),253			<CommonWeights<T>>::set_property(),254		)255	}256257	fn change_token_property(258		&self,259		sender: T::CrossAccountId,260		token_id: TokenId,261		property: Property,262	) -> DispatchResultWithPostInfo {263		with_weight(264			// <Pallet<T>>::change_property(self, &sender, Some(token_id), property),265			Ok(()),266			<CommonWeights<T>>::set_property(),267		)268	}269270	fn set_variable_metadata(271		&self,272		sender: T::CrossAccountId,273		token: TokenId,274		data: BoundedVec<u8, CustomDataLimit>,275	) -> DispatchResultWithPostInfo {276		let len = data.len();277		with_weight(278			<Pallet<T>>::set_variable_metadata(self, &sender, token, data),279			<CommonWeights<T>>::set_variable_metadata(len as u32),280		)281	}282283	fn check_nesting(284		&self,285		sender: T::CrossAccountId,286		from: (CollectionId, TokenId),287		under: TokenId,288		budget: &dyn Budget,289	) -> sp_runtime::DispatchResult {290		<Pallet<T>>::check_nesting(self, sender, from, under, budget)291	}292293	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {294		<Owned<T>>::iter_prefix((self.id, account))295			.map(|(id, _)| id)296			.collect()297	}298299	fn collection_tokens(&self) -> Vec<TokenId> {300		<TokenData<T>>::iter_prefix((self.id,))301			.map(|(id, _)| id)302			.collect()303	}304305	fn token_exists(&self, token: TokenId) -> bool {306		<Pallet<T>>::token_exists(self, token)307	}308309	fn last_token_id(&self) -> TokenId {310		TokenId(<TokensMinted<T>>::get(self.id))311	}312313	fn token_owner(&self, token: TokenId) -> Option<T::CrossAccountId> {314		<TokenData<T>>::get((self.id, token)).map(|t| t.owner)315	}316	fn const_metadata(&self, token: TokenId) -> Vec<u8> {317		<TokenData<T>>::get((self.id, token))318			.map(|t| t.const_data)319			.unwrap_or_default()320			.into_inner()321	}322	fn variable_metadata(&self, token: TokenId) -> Vec<u8> {323		<TokenData<T>>::get((self.id, token))324			.map(|t| t.variable_data)325			.unwrap_or_default()326			.into_inner()327	}328329	fn total_supply(&self) -> u32 {330		<Pallet<T>>::total_supply(self)331	}332333	fn account_balance(&self, account: T::CrossAccountId) -> u32 {334		<AccountBalance<T>>::get((self.id, account))335	}336337	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {338		if <TokenData<T>>::get((self.id, token))339			.map(|a| a.owner == account)340			.unwrap_or(false)341		{342			1343		} else {344			0345		}346	}347348	fn allowance(349		&self,350		sender: T::CrossAccountId,351		spender: T::CrossAccountId,352		token: TokenId,353	) -> u128 {354		if <TokenData<T>>::get((self.id, token))355			.map(|a| a.owner != sender)356			.unwrap_or(true)357		{358			0359		} else if <Allowance<T>>::get((self.id, token)) == Some(spender) {360			1361		} else {362			0363		}364	}365}
after · pallets/nonfungible/src/common.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use core::marker::PhantomData;1819use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, BoundedVec};20use up_data_structs::{21	TokenId, CustomDataLimit, CreateItemExData, CollectionId, budget::Budget, Property,22};23use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};24use sp_runtime::DispatchError;25use sp_std::vec::Vec;2627use crate::{28	AccountBalance, Allowance, Config, CreateItemData, Error, NonfungibleHandle, Owned, Pallet,29	SelfWeightOf, TokenData, weights::WeightInfo, TokensMinted,30};3132pub struct CommonWeights<T: Config>(PhantomData<T>);33impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {34	fn create_item() -> Weight {35		<SelfWeightOf<T>>::create_item()36	}3738	fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {39		match data {40			CreateItemExData::NFT(t) => <SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32),41			_ => 0,42		}43	}4445	fn create_multiple_items(amount: u32) -> Weight {46		<SelfWeightOf<T>>::create_multiple_items(amount)47	}4849	fn burn_item() -> Weight {50		<SelfWeightOf<T>>::burn_item()51	}5253	fn change_collection_properties(amount: u32) -> Weight {54		<SelfWeightOf<T>>::change_collection_properties(amount)55	}5657	fn change_token_properties(amount: u32) -> Weight {58		<SelfWeightOf<T>>::change_token_properties(amount)59	}6061	fn transfer() -> Weight {62		<SelfWeightOf<T>>::transfer()63	}6465	fn approve() -> Weight {66		<SelfWeightOf<T>>::approve()67	}6869	fn transfer_from() -> Weight {70		<SelfWeightOf<T>>::transfer_from()71	}7273	fn burn_from() -> Weight {74		<SelfWeightOf<T>>::burn_from()75	}7677	fn set_variable_metadata(bytes: u32) -> Weight {78		<SelfWeightOf<T>>::set_variable_metadata(bytes)79	}80}8182fn map_create_data<T: Config>(83	data: up_data_structs::CreateItemData,84	to: &T::CrossAccountId,85) -> Result<CreateItemData<T>, DispatchError> {86	match data {87		up_data_structs::CreateItemData::NFT(data) => Ok(CreateItemData::<T> {88			const_data: data.const_data,89			variable_data: data.variable_data,90			owner: to.clone(),91		}),92		_ => fail!(<Error<T>>::NotNonfungibleDataUsedToMintFungibleCollectionToken),93	}94}9596impl<T: Config> CommonCollectionOperations<T> for NonfungibleHandle<T> {97	fn create_item(98		&self,99		sender: T::CrossAccountId,100		to: T::CrossAccountId,101		data: up_data_structs::CreateItemData,102		nesting_budget: &dyn Budget,103	) -> DispatchResultWithPostInfo {104		with_weight(105			<Pallet<T>>::create_item(106				self,107				&sender,108				map_create_data::<T>(data, &to)?,109				nesting_budget,110			),111			<CommonWeights<T>>::create_item(),112		)113	}114115	fn create_multiple_items(116		&self,117		sender: T::CrossAccountId,118		to: T::CrossAccountId,119		data: Vec<up_data_structs::CreateItemData>,120		nesting_budget: &dyn Budget,121	) -> DispatchResultWithPostInfo {122		let data = data123			.into_iter()124			.map(|d| map_create_data::<T>(d, &to))125			.collect::<Result<Vec<_>, DispatchError>>()?;126127		let amount = data.len();128		with_weight(129			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),130			<CommonWeights<T>>::create_multiple_items(amount as u32),131		)132	}133134	fn create_multiple_items_ex(135		&self,136		sender: <T>::CrossAccountId,137		data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,138		nesting_budget: &dyn Budget,139	) -> DispatchResultWithPostInfo {140		let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);141		let data = match data {142			up_data_structs::CreateItemExData::NFT(nft) => nft,143			_ => fail!(Error::<T>::NotNonfungibleDataUsedToMintFungibleCollectionToken),144		};145146		with_weight(147			<Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),148			weight,149		)150	}151152	fn change_collection_properties(153		&self,154		sender: T::CrossAccountId,155		properties: Vec<Property>,156	) -> DispatchResultWithPostInfo {157		let weight = <CommonWeights<T>>::change_collection_properties(properties.len() as u32);158159		with_weight(160			<Pallet<T>>::change_collection_properties(self, &sender, properties),161			weight162		)163	}164165	fn change_token_properties(166		&self,167		sender: T::CrossAccountId,168		token_id: TokenId,169		properties: Vec<Property>,170	) -> DispatchResultWithPostInfo {171		let weight = <CommonWeights<T>>::change_token_properties(properties.len() as u32);172173		with_weight(174			<Pallet<T>>::change_token_properties(self, &sender, token_id, properties),175			weight176		)177	}178179	fn burn_item(180		&self,181		sender: T::CrossAccountId,182		token: TokenId,183		amount: u128,184	) -> DispatchResultWithPostInfo {185		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);186		if amount == 1 {187			with_weight(188				<Pallet<T>>::burn(self, &sender, token),189				<CommonWeights<T>>::burn_item(),190			)191		} else {192			Ok(().into())193		}194	}195196	fn transfer(197		&self,198		from: T::CrossAccountId,199		to: T::CrossAccountId,200		token: TokenId,201		amount: u128,202		nesting_budget: &dyn Budget,203	) -> DispatchResultWithPostInfo {204		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);205		if amount == 1 {206			with_weight(207				<Pallet<T>>::transfer(self, &from, &to, token, nesting_budget),208				<CommonWeights<T>>::transfer(),209			)210		} else {211			Ok(().into())212		}213	}214215	fn approve(216		&self,217		sender: T::CrossAccountId,218		spender: T::CrossAccountId,219		token: TokenId,220		amount: u128,221	) -> DispatchResultWithPostInfo {222		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);223224		with_weight(225			if amount == 1 {226				<Pallet<T>>::set_allowance(self, &sender, token, Some(&spender))227			} else {228				<Pallet<T>>::set_allowance(self, &sender, token, None)229			},230			<CommonWeights<T>>::approve(),231		)232	}233234	fn transfer_from(235		&self,236		sender: T::CrossAccountId,237		from: T::CrossAccountId,238		to: T::CrossAccountId,239		token: TokenId,240		amount: u128,241		nesting_budget: &dyn Budget,242	) -> DispatchResultWithPostInfo {243		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);244245		if amount == 1 {246			with_weight(247				<Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget),248				<CommonWeights<T>>::transfer_from(),249			)250		} else {251			Ok(().into())252		}253	}254255	fn burn_from(256		&self,257		sender: T::CrossAccountId,258		from: T::CrossAccountId,259		token: TokenId,260		amount: u128,261		nesting_budget: &dyn Budget,262	) -> DispatchResultWithPostInfo {263		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);264265		if amount == 1 {266			with_weight(267				<Pallet<T>>::burn_from(self, &sender, &from, token, nesting_budget),268				<CommonWeights<T>>::burn_from(),269			)270		} else {271			Ok(().into())272		}273	}274275	fn set_variable_metadata(276		&self,277		sender: T::CrossAccountId,278		token: TokenId,279		data: BoundedVec<u8, CustomDataLimit>,280	) -> DispatchResultWithPostInfo {281		let len = data.len();282		with_weight(283			<Pallet<T>>::set_variable_metadata(self, &sender, token, data),284			<CommonWeights<T>>::set_variable_metadata(len as u32),285		)286	}287288	fn check_nesting(289		&self,290		sender: T::CrossAccountId,291		from: (CollectionId, TokenId),292		under: TokenId,293		budget: &dyn Budget,294	) -> sp_runtime::DispatchResult {295		<Pallet<T>>::check_nesting(self, sender, from, under, budget)296	}297298	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {299		<Owned<T>>::iter_prefix((self.id, account))300			.map(|(id, _)| id)301			.collect()302	}303304	fn collection_tokens(&self) -> Vec<TokenId> {305		<TokenData<T>>::iter_prefix((self.id,))306			.map(|(id, _)| id)307			.collect()308	}309310	fn token_exists(&self, token: TokenId) -> bool {311		<Pallet<T>>::token_exists(self, token)312	}313314	fn last_token_id(&self) -> TokenId {315		TokenId(<TokensMinted<T>>::get(self.id))316	}317318	fn token_owner(&self, token: TokenId) -> Option<T::CrossAccountId> {319		<TokenData<T>>::get((self.id, token)).map(|t| t.owner)320	}321	fn const_metadata(&self, token: TokenId) -> Vec<u8> {322		<TokenData<T>>::get((self.id, token))323			.map(|t| t.const_data)324			.unwrap_or_default()325			.into_inner()326	}327	fn variable_metadata(&self, token: TokenId) -> Vec<u8> {328		<TokenData<T>>::get((self.id, token))329			.map(|t| t.variable_data)330			.unwrap_or_default()331			.into_inner()332	}333334	fn total_supply(&self) -> u32 {335		<Pallet<T>>::total_supply(self)336	}337338	fn account_balance(&self, account: T::CrossAccountId) -> u32 {339		<AccountBalance<T>>::get((self.id, account))340	}341342	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {343		if <TokenData<T>>::get((self.id, token))344			.map(|a| a.owner == account)345			.unwrap_or(false)346		{347			1348		} else {349			0350		}351	}352353	fn allowance(354		&self,355		sender: T::CrossAccountId,356		spender: T::CrossAccountId,357		token: TokenId,358	) -> u128 {359		if <TokenData<T>>::get((self.id, token))360			.map(|a| a.owner != sender)361			.unwrap_or(true)362		{363			0364		} else if <Allowance<T>>::get((self.id, token)) == Some(spender) {365			1366		} else {367			0368		}369	}370}
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
--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -66,8 +66,12 @@
 		max_weight_of!(burn_item_partial(), burn_item_fully())
 	}
 
-	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 {
@@ -248,19 +252,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/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 {