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

difftreelog

Add extrinsic: delete collection property

Daniel Shiposha2022-05-04parent: #aa3d2ae.patch.diff
in: master

10 files changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -292,6 +292,8 @@
 
 		CollectionPropertySet(CollectionId, Property),
 
+		CollectionPropertyDeleted(CollectionId, PropertyKey),
+
 		TokenPropertySet(CollectionId, TokenId, Property),
 
 		TokenPropertyDeleted(CollectionId, TokenId, PropertyKey),
@@ -761,6 +763,34 @@
 		Ok(())
 	}
 
+	pub fn delete_collection_property(
+		collection: &CollectionHandle<T>,
+		sender: &T::CrossAccountId,
+		property_key: PropertyKey,
+	) -> DispatchResult {
+		collection.check_is_owner_or_admin(sender)?;
+
+		CollectionProperties::<T>::mutate(collection.id, |properties| {
+			properties.remove_property(&property_key);
+		});
+
+		Self::deposit_event(Event::CollectionPropertyDeleted(collection.id, property_key));
+
+		Ok(())
+	}
+
+	pub fn delete_collection_properties(
+		collection: &CollectionHandle<T>,
+		sender: &T::CrossAccountId,
+		property_keys: Vec<PropertyKey>,
+	) -> DispatchResult {
+		for key in property_keys {
+			Self::delete_collection_property(collection, sender, key)?;
+		}
+
+		Ok(())
+	}
+
 	pub fn set_property_permission(
 		collection: &CollectionHandle<T>,
 		sender: &T::CrossAccountId,
@@ -956,6 +986,7 @@
 	fn create_multiple_items_ex(cost: &CreateItemExData<CrossAccountId>) -> Weight;
 	fn burn_item() -> Weight;
 	fn set_collection_properties(amount: u32) -> Weight;
+	fn delete_collection_properties(amount: u32) -> Weight;
 	fn set_token_properties(amount: u32) -> Weight;
 	fn delete_token_properties(amount: u32) -> Weight;
 	fn set_property_permissions(amount: u32) -> Weight;
@@ -998,6 +1029,11 @@
 		sender: T::CrossAccountId,
 		properties: Vec<Property>,
 	) -> DispatchResultWithPostInfo;
+	fn delete_collection_properties(
+		&self,
+		sender: &T::CrossAccountId,
+		property_keys: Vec<PropertyKey>,
+	) -> DispatchResultWithPostInfo;
 	fn set_token_properties(
 		&self,
 		sender: T::CrossAccountId,
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -54,6 +54,10 @@
 		<SelfWeightOf<T>>::set_collection_properties(amount)
 	}
 
+	fn delete_collection_properties(amount: u32) -> Weight {
+		<SelfWeightOf<T>>::delete_collection_properties(amount)
+	}
+
 	fn set_token_properties(amount: u32) -> Weight {
 		<SelfWeightOf<T>>::set_token_properties(amount)
 	}
@@ -249,6 +253,14 @@
 		fail!(<Error<T>>::PropertiesNotAllowed)
 	}
 
+	fn delete_collection_properties(
+		&self,
+		_sender: &T::CrossAccountId,
+		_property_keys: Vec<PropertyKey>,
+	) -> DispatchResultWithPostInfo {
+		fail!(<Error<T>>::PropertiesNotAllowed)
+	}
+
 	fn set_token_properties(
 		&self,
 		_sender: T::CrossAccountId,
modifiedpallets/fungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -36,6 +36,7 @@
 	fn create_multiple_items_ex(b: u32, ) -> Weight;
 	fn burn_item() -> Weight;
 	fn set_collection_properties(amount: u32) -> Weight;
+	fn delete_collection_properties(amount: u32) -> Weight;
 	fn set_token_properties(amount: u32) -> Weight;
 	fn delete_token_properties(amount: u32) -> Weight;
 	fn set_property_permissions(amount: u32) -> Weight;
@@ -79,6 +80,11 @@
 		0
 	}
 
+	fn delete_collection_properties(_amount: u32) -> Weight {
+		// Error
+		0
+	}
+
 	fn set_token_properties(_amount: u32) -> Weight {
 		// Error
 		0
@@ -157,6 +163,11 @@
 		0
 	}
 
+	fn delete_collection_properties(_amount: u32) -> Weight {
+		// Error
+		0
+	}
+
 	fn set_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	PropertyKey, PropertyKeyPermission,23};24use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};25use sp_runtime::DispatchError;26use sp_std::vec::Vec;2728use crate::{29	AccountBalance, Allowance, Config, CreateItemData, Error, NonfungibleHandle, Owned, Pallet,30	SelfWeightOf, TokenData, weights::WeightInfo, TokensMinted,31};3233pub struct CommonWeights<T: Config>(PhantomData<T>);34impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {35	fn create_item() -> Weight {36		<SelfWeightOf<T>>::create_item()37	}3839	fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {40		match data {41			CreateItemExData::NFT(t) => <SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32),42			_ => 0,43		}44	}4546	fn create_multiple_items(amount: u32) -> Weight {47		<SelfWeightOf<T>>::create_multiple_items(amount)48	}4950	fn burn_item() -> Weight {51		<SelfWeightOf<T>>::burn_item()52	}5354	fn set_collection_properties(amount: u32) -> Weight {55		<SelfWeightOf<T>>::set_collection_properties(amount)56	}5758	fn set_token_properties(amount: u32) -> Weight {59		<SelfWeightOf<T>>::set_token_properties(amount)60	}6162	fn delete_token_properties(amount: u32) -> Weight {63		<SelfWeightOf<T>>::delete_token_properties(amount)64	}6566	fn set_property_permissions(amount: u32) -> Weight {67		<SelfWeightOf<T>>::set_property_permissions(amount)68	}6970	fn transfer() -> Weight {71		<SelfWeightOf<T>>::transfer()72	}7374	fn approve() -> Weight {75		<SelfWeightOf<T>>::approve()76	}7778	fn transfer_from() -> Weight {79		<SelfWeightOf<T>>::transfer_from()80	}8182	fn burn_from() -> Weight {83		<SelfWeightOf<T>>::burn_from()84	}8586	fn set_variable_metadata(bytes: u32) -> Weight {87		<SelfWeightOf<T>>::set_variable_metadata(bytes)88	}89}9091fn map_create_data<T: Config>(92	data: up_data_structs::CreateItemData,93	to: &T::CrossAccountId,94) -> Result<CreateItemData<T>, DispatchError> {95	match data {96		up_data_structs::CreateItemData::NFT(data) => Ok(CreateItemData::<T> {97			const_data: data.const_data,98			variable_data: data.variable_data,99			owner: to.clone(),100		}),101		_ => fail!(<Error<T>>::NotNonfungibleDataUsedToMintFungibleCollectionToken),102	}103}104105impl<T: Config> CommonCollectionOperations<T> for NonfungibleHandle<T> {106	fn create_item(107		&self,108		sender: T::CrossAccountId,109		to: T::CrossAccountId,110		data: up_data_structs::CreateItemData,111		nesting_budget: &dyn Budget,112	) -> DispatchResultWithPostInfo {113		with_weight(114			<Pallet<T>>::create_item(115				self,116				&sender,117				map_create_data::<T>(data, &to)?,118				nesting_budget,119			),120			<CommonWeights<T>>::create_item(),121		)122	}123124	fn create_multiple_items(125		&self,126		sender: T::CrossAccountId,127		to: T::CrossAccountId,128		data: Vec<up_data_structs::CreateItemData>,129		nesting_budget: &dyn Budget,130	) -> DispatchResultWithPostInfo {131		let data = data132			.into_iter()133			.map(|d| map_create_data::<T>(d, &to))134			.collect::<Result<Vec<_>, DispatchError>>()?;135136		let amount = data.len();137		with_weight(138			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),139			<CommonWeights<T>>::create_multiple_items(amount as u32),140		)141	}142143	fn create_multiple_items_ex(144		&self,145		sender: <T>::CrossAccountId,146		data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,147		nesting_budget: &dyn Budget,148	) -> DispatchResultWithPostInfo {149		let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);150		let data = match data {151			up_data_structs::CreateItemExData::NFT(nft) => nft,152			_ => fail!(Error::<T>::NotNonfungibleDataUsedToMintFungibleCollectionToken),153		};154155		with_weight(156			<Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),157			weight,158		)159	}160161	fn set_collection_properties(162		&self,163		sender: T::CrossAccountId,164		properties: Vec<Property>,165	) -> DispatchResultWithPostInfo {166		let weight = <CommonWeights<T>>::set_collection_properties(properties.len() as u32);167168		with_weight(169			<Pallet<T>>::set_collection_properties(self, &sender, properties),170			weight,171		)172	}173174	fn set_token_properties(175		&self,176		sender: T::CrossAccountId,177		token_id: TokenId,178		properties: Vec<Property>,179	) -> DispatchResultWithPostInfo {180		let weight = <CommonWeights<T>>::set_token_properties(properties.len() as u32);181182		with_weight(183			<Pallet<T>>::set_token_properties(self, &sender, token_id, properties),184			weight,185		)186	}187188	fn delete_token_properties(189		&self,190		sender: T::CrossAccountId,191		token_id: TokenId,192		property_keys: Vec<PropertyKey>,193	) -> DispatchResultWithPostInfo {194		let weight = <CommonWeights<T>>::delete_token_properties(property_keys.len() as u32);195196		with_weight(197			<Pallet<T>>::delete_token_properties(self, &sender, token_id, property_keys),198			weight,199		)200	}201202	fn set_property_permissions(203		&self,204		sender: &T::CrossAccountId,205		property_permissions: Vec<PropertyKeyPermission>,206	) -> DispatchResultWithPostInfo {207		let weight =208			<CommonWeights<T>>::set_property_permissions(property_permissions.len() as u32);209210		with_weight(211			<Pallet<T>>::set_property_permissions(self, sender, property_permissions),212			weight,213		)214	}215216	fn burn_item(217		&self,218		sender: T::CrossAccountId,219		token: TokenId,220		amount: u128,221	) -> DispatchResultWithPostInfo {222		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);223		if amount == 1 {224			with_weight(225				<Pallet<T>>::burn(self, &sender, token),226				<CommonWeights<T>>::burn_item(),227			)228		} else {229			Ok(().into())230		}231	}232233	fn transfer(234		&self,235		from: T::CrossAccountId,236		to: T::CrossAccountId,237		token: TokenId,238		amount: u128,239		nesting_budget: &dyn Budget,240	) -> DispatchResultWithPostInfo {241		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);242		if amount == 1 {243			with_weight(244				<Pallet<T>>::transfer(self, &from, &to, token, nesting_budget),245				<CommonWeights<T>>::transfer(),246			)247		} else {248			Ok(().into())249		}250	}251252	fn approve(253		&self,254		sender: T::CrossAccountId,255		spender: T::CrossAccountId,256		token: TokenId,257		amount: u128,258	) -> DispatchResultWithPostInfo {259		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);260261		with_weight(262			if amount == 1 {263				<Pallet<T>>::set_allowance(self, &sender, token, Some(&spender))264			} else {265				<Pallet<T>>::set_allowance(self, &sender, token, None)266			},267			<CommonWeights<T>>::approve(),268		)269	}270271	fn transfer_from(272		&self,273		sender: T::CrossAccountId,274		from: T::CrossAccountId,275		to: T::CrossAccountId,276		token: TokenId,277		amount: u128,278		nesting_budget: &dyn Budget,279	) -> DispatchResultWithPostInfo {280		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);281282		if amount == 1 {283			with_weight(284				<Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget),285				<CommonWeights<T>>::transfer_from(),286			)287		} else {288			Ok(().into())289		}290	}291292	fn burn_from(293		&self,294		sender: T::CrossAccountId,295		from: T::CrossAccountId,296		token: TokenId,297		amount: u128,298		nesting_budget: &dyn Budget,299	) -> DispatchResultWithPostInfo {300		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);301302		if amount == 1 {303			with_weight(304				<Pallet<T>>::burn_from(self, &sender, &from, token, nesting_budget),305				<CommonWeights<T>>::burn_from(),306			)307		} else {308			Ok(().into())309		}310	}311312	fn set_variable_metadata(313		&self,314		sender: T::CrossAccountId,315		token: TokenId,316		data: BoundedVec<u8, CustomDataLimit>,317	) -> DispatchResultWithPostInfo {318		let len = data.len();319		with_weight(320			<Pallet<T>>::set_variable_metadata(self, &sender, token, data),321			<CommonWeights<T>>::set_variable_metadata(len as u32),322		)323	}324325	fn check_nesting(326		&self,327		sender: T::CrossAccountId,328		from: (CollectionId, TokenId),329		under: TokenId,330		budget: &dyn Budget,331	) -> sp_runtime::DispatchResult {332		<Pallet<T>>::check_nesting(self, sender, from, under, budget)333	}334335	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {336		<Owned<T>>::iter_prefix((self.id, account))337			.map(|(id, _)| id)338			.collect()339	}340341	fn collection_tokens(&self) -> Vec<TokenId> {342		<TokenData<T>>::iter_prefix((self.id,))343			.map(|(id, _)| id)344			.collect()345	}346347	fn token_exists(&self, token: TokenId) -> bool {348		<Pallet<T>>::token_exists(self, token)349	}350351	fn last_token_id(&self) -> TokenId {352		TokenId(<TokensMinted<T>>::get(self.id))353	}354355	fn token_owner(&self, token: TokenId) -> Option<T::CrossAccountId> {356		<TokenData<T>>::get((self.id, token)).map(|t| t.owner)357	}358	fn const_metadata(&self, token: TokenId) -> Vec<u8> {359		<TokenData<T>>::get((self.id, token))360			.map(|t| t.const_data)361			.unwrap_or_default()362			.into_inner()363	}364	fn variable_metadata(&self, token: TokenId) -> Vec<u8> {365		<TokenData<T>>::get((self.id, token))366			.map(|t| t.variable_data)367			.unwrap_or_default()368			.into_inner()369	}370371	fn total_supply(&self) -> u32 {372		<Pallet<T>>::total_supply(self)373	}374375	fn account_balance(&self, account: T::CrossAccountId) -> u32 {376		<AccountBalance<T>>::get((self.id, account))377	}378379	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {380		if <TokenData<T>>::get((self.id, token))381			.map(|a| a.owner == account)382			.unwrap_or(false)383		{384			1385		} else {386			0387		}388	}389390	fn allowance(391		&self,392		sender: T::CrossAccountId,393		spender: T::CrossAccountId,394		token: TokenId,395	) -> u128 {396		if <TokenData<T>>::get((self.id, token))397			.map(|a| a.owner != sender)398			.unwrap_or(true)399		{400			0401		} else if <Allowance<T>>::get((self.id, token)) == Some(spender) {402			1403		} else {404			0405		}406	}407}
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	PropertyKey, PropertyKeyPermission,23};24use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};25use sp_runtime::DispatchError;26use sp_std::vec::Vec;2728use crate::{29	AccountBalance, Allowance, Config, CreateItemData, Error, NonfungibleHandle, Owned, Pallet,30	SelfWeightOf, TokenData, weights::WeightInfo, TokensMinted,31};3233pub struct CommonWeights<T: Config>(PhantomData<T>);34impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {35	fn create_item() -> Weight {36		<SelfWeightOf<T>>::create_item()37	}3839	fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {40		match data {41			CreateItemExData::NFT(t) => <SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32),42			_ => 0,43		}44	}4546	fn create_multiple_items(amount: u32) -> Weight {47		<SelfWeightOf<T>>::create_multiple_items(amount)48	}4950	fn burn_item() -> Weight {51		<SelfWeightOf<T>>::burn_item()52	}5354	fn set_collection_properties(amount: u32) -> Weight {55		<SelfWeightOf<T>>::set_collection_properties(amount)56	}5758	fn delete_collection_properties(amount: u32) -> Weight {59		<SelfWeightOf<T>>::delete_collection_properties(amount)60	}6162	fn set_token_properties(amount: u32) -> Weight {63		<SelfWeightOf<T>>::set_token_properties(amount)64	}6566	fn delete_token_properties(amount: u32) -> Weight {67		<SelfWeightOf<T>>::delete_token_properties(amount)68	}6970	fn set_property_permissions(amount: u32) -> Weight {71		<SelfWeightOf<T>>::set_property_permissions(amount)72	}7374	fn transfer() -> Weight {75		<SelfWeightOf<T>>::transfer()76	}7778	fn approve() -> Weight {79		<SelfWeightOf<T>>::approve()80	}8182	fn transfer_from() -> Weight {83		<SelfWeightOf<T>>::transfer_from()84	}8586	fn burn_from() -> Weight {87		<SelfWeightOf<T>>::burn_from()88	}8990	fn set_variable_metadata(bytes: u32) -> Weight {91		<SelfWeightOf<T>>::set_variable_metadata(bytes)92	}93}9495fn map_create_data<T: Config>(96	data: up_data_structs::CreateItemData,97	to: &T::CrossAccountId,98) -> Result<CreateItemData<T>, DispatchError> {99	match data {100		up_data_structs::CreateItemData::NFT(data) => Ok(CreateItemData::<T> {101			const_data: data.const_data,102			variable_data: data.variable_data,103			owner: to.clone(),104		}),105		_ => fail!(<Error<T>>::NotNonfungibleDataUsedToMintFungibleCollectionToken),106	}107}108109impl<T: Config> CommonCollectionOperations<T> for NonfungibleHandle<T> {110	fn create_item(111		&self,112		sender: T::CrossAccountId,113		to: T::CrossAccountId,114		data: up_data_structs::CreateItemData,115		nesting_budget: &dyn Budget,116	) -> DispatchResultWithPostInfo {117		with_weight(118			<Pallet<T>>::create_item(119				self,120				&sender,121				map_create_data::<T>(data, &to)?,122				nesting_budget,123			),124			<CommonWeights<T>>::create_item(),125		)126	}127128	fn create_multiple_items(129		&self,130		sender: T::CrossAccountId,131		to: T::CrossAccountId,132		data: Vec<up_data_structs::CreateItemData>,133		nesting_budget: &dyn Budget,134	) -> DispatchResultWithPostInfo {135		let data = data136			.into_iter()137			.map(|d| map_create_data::<T>(d, &to))138			.collect::<Result<Vec<_>, DispatchError>>()?;139140		let amount = data.len();141		with_weight(142			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),143			<CommonWeights<T>>::create_multiple_items(amount as u32),144		)145	}146147	fn create_multiple_items_ex(148		&self,149		sender: <T>::CrossAccountId,150		data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,151		nesting_budget: &dyn Budget,152	) -> DispatchResultWithPostInfo {153		let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);154		let data = match data {155			up_data_structs::CreateItemExData::NFT(nft) => nft,156			_ => fail!(Error::<T>::NotNonfungibleDataUsedToMintFungibleCollectionToken),157		};158159		with_weight(160			<Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),161			weight,162		)163	}164165	fn set_collection_properties(166		&self,167		sender: T::CrossAccountId,168		properties: Vec<Property>,169	) -> DispatchResultWithPostInfo {170		let weight = <CommonWeights<T>>::set_collection_properties(properties.len() as u32);171172		with_weight(173			<Pallet<T>>::set_collection_properties(self, &sender, properties),174			weight,175		)176	}177178	fn delete_collection_properties(179		&self,180		sender: &T::CrossAccountId,181		property_keys: Vec<PropertyKey>,182	) -> DispatchResultWithPostInfo {183		let weight = <CommonWeights<T>>::delete_collection_properties(property_keys.len() as u32);184185		with_weight(186			<Pallet<T>>::delete_collection_properties(self, &sender, property_keys),187			weight188		)189	}190191	fn set_token_properties(192		&self,193		sender: T::CrossAccountId,194		token_id: TokenId,195		properties: Vec<Property>,196	) -> DispatchResultWithPostInfo {197		let weight = <CommonWeights<T>>::set_token_properties(properties.len() as u32);198199		with_weight(200			<Pallet<T>>::set_token_properties(self, &sender, token_id, properties),201			weight,202		)203	}204205	fn delete_token_properties(206		&self,207		sender: T::CrossAccountId,208		token_id: TokenId,209		property_keys: Vec<PropertyKey>,210	) -> DispatchResultWithPostInfo {211		let weight = <CommonWeights<T>>::delete_token_properties(property_keys.len() as u32);212213		with_weight(214			<Pallet<T>>::delete_token_properties(self, &sender, token_id, property_keys),215			weight,216		)217	}218219	fn set_property_permissions(220		&self,221		sender: &T::CrossAccountId,222		property_permissions: Vec<PropertyKeyPermission>,223	) -> DispatchResultWithPostInfo {224		let weight =225			<CommonWeights<T>>::set_property_permissions(property_permissions.len() as u32);226227		with_weight(228			<Pallet<T>>::set_property_permissions(self, sender, property_permissions),229			weight,230		)231	}232233	fn burn_item(234		&self,235		sender: T::CrossAccountId,236		token: TokenId,237		amount: u128,238	) -> DispatchResultWithPostInfo {239		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);240		if amount == 1 {241			with_weight(242				<Pallet<T>>::burn(self, &sender, token),243				<CommonWeights<T>>::burn_item(),244			)245		} else {246			Ok(().into())247		}248	}249250	fn transfer(251		&self,252		from: T::CrossAccountId,253		to: T::CrossAccountId,254		token: TokenId,255		amount: u128,256		nesting_budget: &dyn Budget,257	) -> DispatchResultWithPostInfo {258		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);259		if amount == 1 {260			with_weight(261				<Pallet<T>>::transfer(self, &from, &to, token, nesting_budget),262				<CommonWeights<T>>::transfer(),263			)264		} else {265			Ok(().into())266		}267	}268269	fn approve(270		&self,271		sender: T::CrossAccountId,272		spender: T::CrossAccountId,273		token: TokenId,274		amount: u128,275	) -> DispatchResultWithPostInfo {276		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);277278		with_weight(279			if amount == 1 {280				<Pallet<T>>::set_allowance(self, &sender, token, Some(&spender))281			} else {282				<Pallet<T>>::set_allowance(self, &sender, token, None)283			},284			<CommonWeights<T>>::approve(),285		)286	}287288	fn transfer_from(289		&self,290		sender: T::CrossAccountId,291		from: T::CrossAccountId,292		to: T::CrossAccountId,293		token: TokenId,294		amount: u128,295		nesting_budget: &dyn Budget,296	) -> DispatchResultWithPostInfo {297		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);298299		if amount == 1 {300			with_weight(301				<Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget),302				<CommonWeights<T>>::transfer_from(),303			)304		} else {305			Ok(().into())306		}307	}308309	fn burn_from(310		&self,311		sender: T::CrossAccountId,312		from: T::CrossAccountId,313		token: TokenId,314		amount: u128,315		nesting_budget: &dyn Budget,316	) -> DispatchResultWithPostInfo {317		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);318319		if amount == 1 {320			with_weight(321				<Pallet<T>>::burn_from(self, &sender, &from, token, nesting_budget),322				<CommonWeights<T>>::burn_from(),323			)324		} else {325			Ok(().into())326		}327	}328329	fn set_variable_metadata(330		&self,331		sender: T::CrossAccountId,332		token: TokenId,333		data: BoundedVec<u8, CustomDataLimit>,334	) -> DispatchResultWithPostInfo {335		let len = data.len();336		with_weight(337			<Pallet<T>>::set_variable_metadata(self, &sender, token, data),338			<CommonWeights<T>>::set_variable_metadata(len as u32),339		)340	}341342	fn check_nesting(343		&self,344		sender: T::CrossAccountId,345		from: (CollectionId, TokenId),346		under: TokenId,347		budget: &dyn Budget,348	) -> sp_runtime::DispatchResult {349		<Pallet<T>>::check_nesting(self, sender, from, under, budget)350	}351352	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {353		<Owned<T>>::iter_prefix((self.id, account))354			.map(|(id, _)| id)355			.collect()356	}357358	fn collection_tokens(&self) -> Vec<TokenId> {359		<TokenData<T>>::iter_prefix((self.id,))360			.map(|(id, _)| id)361			.collect()362	}363364	fn token_exists(&self, token: TokenId) -> bool {365		<Pallet<T>>::token_exists(self, token)366	}367368	fn last_token_id(&self) -> TokenId {369		TokenId(<TokensMinted<T>>::get(self.id))370	}371372	fn token_owner(&self, token: TokenId) -> Option<T::CrossAccountId> {373		<TokenData<T>>::get((self.id, token)).map(|t| t.owner)374	}375	fn const_metadata(&self, token: TokenId) -> Vec<u8> {376		<TokenData<T>>::get((self.id, token))377			.map(|t| t.const_data)378			.unwrap_or_default()379			.into_inner()380	}381	fn variable_metadata(&self, token: TokenId) -> Vec<u8> {382		<TokenData<T>>::get((self.id, token))383			.map(|t| t.variable_data)384			.unwrap_or_default()385			.into_inner()386	}387388	fn total_supply(&self) -> u32 {389		<Pallet<T>>::total_supply(self)390	}391392	fn account_balance(&self, account: T::CrossAccountId) -> u32 {393		<AccountBalance<T>>::get((self.id, account))394	}395396	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {397		if <TokenData<T>>::get((self.id, token))398			.map(|a| a.owner == account)399			.unwrap_or(false)400		{401			1402		} else {403			0404		}405	}406407	fn allowance(408		&self,409		sender: T::CrossAccountId,410		spender: T::CrossAccountId,411		token: TokenId,412	) -> u128 {413		if <TokenData<T>>::get((self.id, token))414			.map(|a| a.owner != sender)415			.unwrap_or(true)416		{417			0418		} else if <Allowance<T>>::get((self.id, token)) == Some(spender) {419			1420		} else {421			0422		}423	}424}
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -366,6 +366,14 @@
 		<PalletCommon<T>>::set_collection_properties(collection, sender, properties)
 	}
 
+	pub fn delete_collection_properties(
+		collection: &CollectionHandle<T>,
+		sender: &T::CrossAccountId,
+		property_keys: Vec<PropertyKey>,
+	) -> DispatchResult {
+		<PalletCommon<T>>::delete_collection_properties(collection, sender, property_keys)
+	}
+
 	pub fn set_property_permissions(
 		collection: &CollectionHandle<T>,
 		sender: &T::CrossAccountId,
modifiedpallets/nonfungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -37,6 +37,7 @@
 	fn create_multiple_items_ex(b: u32, ) -> Weight;
 	fn burn_item() -> Weight;
 	fn set_collection_properties(amount: u32) -> Weight;
+	fn delete_collection_properties(amount: u32) -> Weight;
 	fn set_token_properties(amount: u32) -> Weight;
 	fn delete_token_properties(amount: u32) -> Weight;
 	fn set_property_permissions(amount: u32) -> Weight;
@@ -100,6 +101,11 @@
 		(50_000_000 as Weight).saturating_mul(amount as Weight)
 	}
 
+	fn delete_collection_properties(amount: u32) -> Weight {
+		// TODO calculate appropriate weight
+		(50_000_000 as Weight).saturating_mul(amount as Weight)
+	}
+
 	fn set_token_properties(amount: u32) -> Weight {
 		// TODO calculate appropriate weight
 		(50_000_000 as Weight).saturating_mul(amount as Weight)
@@ -210,6 +216,11 @@
 		(50_000_000 as Weight).saturating_mul(amount as Weight)
 	}
 
+	fn delete_collection_properties(amount: u32) -> Weight {
+		// TODO calculate appropriate weight
+		(50_000_000 as Weight).saturating_mul(amount as Weight)
+	}
+
 	fn set_token_properties(amount: u32) -> Weight {
 		// TODO calculate appropriate weight
 		(50_000_000 as Weight).saturating_mul(amount as Weight)
modifiedpallets/refungible/src/common.rsdiffbeforeafterboth
--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -70,6 +70,10 @@
 		<SelfWeightOf<T>>::set_collection_properties(amount)
 	}
 
+	fn delete_collection_properties(amount: u32) -> Weight {
+		<SelfWeightOf<T>>::delete_collection_properties(amount)
+	}
+
 	fn set_token_properties(amount: u32) -> Weight {
 		<SelfWeightOf<T>>::set_token_properties(amount)
 	}
@@ -268,6 +272,14 @@
 		fail!(<Error<T>>::PropertiesNotAllowed)
 	}
 
+	fn delete_collection_properties(
+		&self,
+		_sender: &T::CrossAccountId,
+		_property_keys: Vec<PropertyKey>,
+	) -> DispatchResultWithPostInfo {
+		fail!(<Error<T>>::PropertiesNotAllowed)
+	}
+
 	fn set_token_properties(
 		&self,
 		_sender: T::CrossAccountId,
modifiedpallets/refungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/refungible/src/weights.rs
+++ b/pallets/refungible/src/weights.rs
@@ -39,6 +39,7 @@
 	fn burn_item_partial() -> Weight;
 	fn burn_item_fully() -> Weight;
 	fn set_collection_properties(amount: u32) -> Weight;
+	fn delete_collection_properties(amount: u32) -> Weight;
 	fn set_token_properties(amount: u32) -> Weight;
 	fn delete_token_properties(amount: u32) -> Weight;
 	fn set_property_permissions(amount: u32) -> Weight;
@@ -139,6 +140,11 @@
 		0
 	}
 
+	fn delete_collection_properties(_amount: u32) -> Weight {
+		// Error
+		0
+	}
+
 	fn set_token_properties(_amount: u32) -> Weight {
 		// Error
 		0
@@ -328,6 +334,11 @@
 		0
 	}
 
+	fn delete_collection_properties(_amount: u32) -> Weight {
+		// Error
+		0
+	}
+
 	fn set_token_properties(_amount: u32) -> Weight {
 		// Error
 		0
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -708,6 +708,20 @@
 			dispatch_call::<T, _>(collection_id, |d| d.set_collection_properties(sender, properties))
 		}
 
+		#[weight = T::CommonWeightInfo::delete_collection_properties(property_keys.len() as u32)]
+		#[transactional]
+		pub fn delete_collection_properties(
+			origin,
+			collection_id: CollectionId,
+			property_keys: Vec<PropertyKey>,
+		) -> DispatchResultWithPostInfo {
+			ensure!(!property_keys.is_empty(), Error::<T>::EmptyArgument);
+
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+
+			dispatch_call::<T, _>(collection_id, |d| d.delete_collection_properties(&sender, property_keys))
+		}
+
 		#[weight = T::CommonWeightInfo::set_token_properties(properties.len() as u32)]
 		#[transactional]
 		pub fn set_token_properties(
@@ -723,19 +737,19 @@
 			dispatch_call::<T, _>(collection_id, |d| d.set_token_properties(sender, token_id, properties))
 		}
 
-		#[weight = T::CommonWeightInfo::delete_token_properties(properties.len() as u32)]
+		#[weight = T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32)]
 		#[transactional]
 		pub fn delete_token_properties(
 			origin,
 			collection_id: CollectionId,
 			token_id: TokenId,
-			properties: Vec<PropertyKey>
+			property_keys: Vec<PropertyKey>
 		) -> DispatchResultWithPostInfo {
-			ensure!(!properties.is_empty(), Error::<T>::EmptyArgument);
+			ensure!(!property_keys.is_empty(), Error::<T>::EmptyArgument);
 
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 
-			dispatch_call::<T, _>(collection_id, |d| d.delete_token_properties(sender, token_id, properties))
+			dispatch_call::<T, _>(collection_id, |d| d.delete_token_properties(sender, token_id, property_keys))
 		}
 
 		#[weight = T::CommonWeightInfo::set_property_permissions(property_permissions.len() as u32)]
modifiedruntime/common/src/weights.rsdiffbeforeafterboth
--- a/runtime/common/src/weights.rs
+++ b/runtime/common/src/weights.rs
@@ -58,6 +58,10 @@
 		dispatch_weight::<T>() + max_weight_of!(set_collection_properties(amount))
 	}
 
+	fn delete_collection_properties(amount: u32) -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(delete_collection_properties(amount))
+	}
+
 	fn set_token_properties(amount: u32) -> Weight {
 		dispatch_weight::<T>() + max_weight_of!(set_token_properties(amount))
 	}