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
--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -55,6 +55,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)
 	}
@@ -171,6 +175,19 @@
 		)
 	}
 
+	fn delete_collection_properties(
+		&self,
+		sender: &T::CrossAccountId,
+		property_keys: Vec<PropertyKey>,
+	) -> DispatchResultWithPostInfo {
+		let weight = <CommonWeights<T>>::delete_collection_properties(property_keys.len() as u32);
+
+		with_weight(
+			<Pallet<T>>::delete_collection_properties(self, &sender, property_keys),
+			weight
+		)
+	}
+
 	fn set_token_properties(
 		&self,
 		sender: T::CrossAccountId,
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
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, PropertyKey, PropertyKeyPermission,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_collection_properties(amount: u32) -> Weight {70		<SelfWeightOf<T>>::set_collection_properties(amount)71	}7273	fn set_token_properties(amount: u32) -> Weight {74		<SelfWeightOf<T>>::set_token_properties(amount)75	}7677	fn delete_token_properties(amount: u32) -> Weight {78		<SelfWeightOf<T>>::delete_token_properties(amount)79	}8081	fn set_property_permissions(amount: u32) -> Weight {82		<SelfWeightOf<T>>::set_property_permissions(amount)83	}8485	fn transfer() -> Weight {86		max_weight_of!(87			transfer_normal(),88			transfer_creating(),89			transfer_removing(),90			transfer_creating_removing()91		)92	}9394	fn approve() -> Weight {95		<SelfWeightOf<T>>::approve()96	}9798	fn transfer_from() -> Weight {99		max_weight_of!(100			transfer_from_normal(),101			transfer_from_creating(),102			transfer_from_removing(),103			transfer_from_creating_removing()104		)105	}106107	fn burn_from() -> Weight {108		<SelfWeightOf<T>>::burn_from()109	}110111	fn set_variable_metadata(bytes: u32) -> Weight {112		<SelfWeightOf<T>>::set_variable_metadata(bytes)113	}114}115116fn map_create_data<T: Config>(117	data: up_data_structs::CreateItemData,118	to: &T::CrossAccountId,119) -> Result<CreateRefungibleExData<T::CrossAccountId>, DispatchError> {120	match data {121		up_data_structs::CreateItemData::ReFungible(data) => Ok(CreateRefungibleExData {122			const_data: data.const_data,123			variable_data: data.variable_data,124			users: {125				let mut out = BTreeMap::new();126				out.insert(to.clone(), data.pieces);127				out.try_into().expect("limit > 0")128			},129		}),130		_ => fail!(<Error<T>>::NotRefungibleDataUsedToMintFungibleCollectionToken),131	}132}133134impl<T: Config> CommonCollectionOperations<T> for RefungibleHandle<T> {135	fn create_item(136		&self,137		sender: T::CrossAccountId,138		to: T::CrossAccountId,139		data: up_data_structs::CreateItemData,140		nesting_budget: &dyn Budget,141	) -> DispatchResultWithPostInfo {142		with_weight(143			<Pallet<T>>::create_item(144				self,145				&sender,146				map_create_data::<T>(data, &to)?,147				nesting_budget,148			),149			<CommonWeights<T>>::create_item(),150		)151	}152153	fn create_multiple_items(154		&self,155		sender: T::CrossAccountId,156		to: T::CrossAccountId,157		data: Vec<up_data_structs::CreateItemData>,158		nesting_budget: &dyn Budget,159	) -> DispatchResultWithPostInfo {160		let data = data161			.into_iter()162			.map(|d| map_create_data::<T>(d, &to))163			.collect::<Result<Vec<_>, DispatchError>>()?;164165		let amount = data.len();166		with_weight(167			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),168			<CommonWeights<T>>::create_multiple_items(amount as u32),169		)170	}171172	fn create_multiple_items_ex(173		&self,174		sender: <T>::CrossAccountId,175		data: CreateItemExData<T::CrossAccountId>,176		nesting_budget: &dyn Budget,177	) -> DispatchResultWithPostInfo {178		let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);179		let data = match data {180			CreateItemExData::RefungibleMultipleOwners(r) => vec![r],181			CreateItemExData::RefungibleMultipleItems(r)182				if r.iter().all(|i| i.users.len() == 1) =>183			{184				r.into_inner()185			}186			_ => fail!(<Error<T>>::NotRefungibleDataUsedToMintFungibleCollectionToken),187		};188189		with_weight(190			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),191			weight,192		)193	}194195	fn burn_item(196		&self,197		sender: T::CrossAccountId,198		token: TokenId,199		amount: u128,200	) -> DispatchResultWithPostInfo {201		with_weight(202			<Pallet<T>>::burn(self, &sender, token, amount),203			<CommonWeights<T>>::burn_item(),204		)205	}206207	fn transfer(208		&self,209		from: T::CrossAccountId,210		to: T::CrossAccountId,211		token: TokenId,212		amount: u128,213		nesting_budget: &dyn Budget,214	) -> DispatchResultWithPostInfo {215		with_weight(216			<Pallet<T>>::transfer(self, &from, &to, token, amount, nesting_budget),217			<CommonWeights<T>>::transfer(),218		)219	}220221	fn approve(222		&self,223		sender: T::CrossAccountId,224		spender: T::CrossAccountId,225		token: TokenId,226		amount: u128,227	) -> DispatchResultWithPostInfo {228		with_weight(229			<Pallet<T>>::set_allowance(self, &sender, &spender, token, amount),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		with_weight(244			<Pallet<T>>::transfer_from(self, &sender, &from, &to, token, amount, nesting_budget),245			<CommonWeights<T>>::transfer_from(),246		)247	}248249	fn burn_from(250		&self,251		sender: T::CrossAccountId,252		from: T::CrossAccountId,253		token: TokenId,254		amount: u128,255		nesting_budget: &dyn Budget,256	) -> DispatchResultWithPostInfo {257		with_weight(258			<Pallet<T>>::burn_from(self, &sender, &from, token, amount, nesting_budget),259			<CommonWeights<T>>::burn_from(),260		)261	}262263	fn set_collection_properties(264		&self,265		_sender: T::CrossAccountId,266		_property: Vec<Property>,267	) -> DispatchResultWithPostInfo {268		fail!(<Error<T>>::PropertiesNotAllowed)269	}270271	fn set_token_properties(272		&self,273		_sender: T::CrossAccountId,274		_token_id: TokenId,275		_property: Vec<Property>,276	) -> DispatchResultWithPostInfo {277		fail!(<Error<T>>::PropertiesNotAllowed)278	}279280	fn set_property_permissions(281		&self,282		_sender: &T::CrossAccountId,283		_property_permissions: Vec<PropertyKeyPermission>,284	) -> DispatchResultWithPostInfo {285		fail!(<Error<T>>::PropertiesNotAllowed)286	}287288	fn delete_token_properties(289		&self,290		_sender: T::CrossAccountId,291		_token_id: TokenId,292		_property_keys: Vec<PropertyKey>,293	) -> DispatchResultWithPostInfo {294		fail!(<Error<T>>::PropertiesNotAllowed)295	}296297	fn set_variable_metadata(298		&self,299		sender: T::CrossAccountId,300		token: TokenId,301		data: BoundedVec<u8, CustomDataLimit>,302	) -> DispatchResultWithPostInfo {303		let len = data.len();304		with_weight(305			<Pallet<T>>::set_variable_metadata(self, &sender, token, data),306			<CommonWeights<T>>::set_variable_metadata(len as u32),307		)308	}309310	fn check_nesting(311		&self,312		_sender: <T>::CrossAccountId,313		_from: (CollectionId, TokenId),314		_under: TokenId,315		_budget: &dyn Budget,316	) -> sp_runtime::DispatchResult {317		fail!(<Error<T>>::RefungibleDisallowsNesting)318	}319320	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {321		<Owned<T>>::iter_prefix((self.id, account))322			.map(|(id, _)| id)323			.collect()324	}325326	fn collection_tokens(&self) -> Vec<TokenId> {327		<TokenData<T>>::iter_prefix((self.id,))328			.map(|(id, _)| id)329			.collect()330	}331332	fn token_exists(&self, token: TokenId) -> bool {333		<Pallet<T>>::token_exists(self, token)334	}335336	fn last_token_id(&self) -> TokenId {337		TokenId(<TokensMinted<T>>::get(self.id))338	}339340	fn token_owner(&self, _token: TokenId) -> Option<T::CrossAccountId> {341		None342	}343	fn const_metadata(&self, token: TokenId) -> Vec<u8> {344		<TokenData<T>>::get((self.id, token))345			.const_data346			.into_inner()347	}348	fn variable_metadata(&self, token: TokenId) -> Vec<u8> {349		<TokenData<T>>::get((self.id, token))350			.variable_data351			.into_inner()352	}353354	fn total_supply(&self) -> u32 {355		<Pallet<T>>::total_supply(self)356	}357358	fn account_balance(&self, account: T::CrossAccountId) -> u32 {359		<AccountBalance<T>>::get((self.id, account))360	}361362	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {363		<Balance<T>>::get((self.id, token, account))364	}365366	fn allowance(367		&self,368		sender: T::CrossAccountId,369		spender: T::CrossAccountId,370		token: TokenId,371	) -> u128 {372		<Allowance<T>>::get((self.id, token, sender, spender))373	}374}
after · 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, PropertyKey, PropertyKeyPermission,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_collection_properties(amount: u32) -> Weight {70		<SelfWeightOf<T>>::set_collection_properties(amount)71	}7273	fn delete_collection_properties(amount: u32) -> Weight {74		<SelfWeightOf<T>>::delete_collection_properties(amount)75	}7677	fn set_token_properties(amount: u32) -> Weight {78		<SelfWeightOf<T>>::set_token_properties(amount)79	}8081	fn delete_token_properties(amount: u32) -> Weight {82		<SelfWeightOf<T>>::delete_token_properties(amount)83	}8485	fn set_property_permissions(amount: u32) -> Weight {86		<SelfWeightOf<T>>::set_property_permissions(amount)87	}8889	fn transfer() -> Weight {90		max_weight_of!(91			transfer_normal(),92			transfer_creating(),93			transfer_removing(),94			transfer_creating_removing()95		)96	}9798	fn approve() -> Weight {99		<SelfWeightOf<T>>::approve()100	}101102	fn transfer_from() -> Weight {103		max_weight_of!(104			transfer_from_normal(),105			transfer_from_creating(),106			transfer_from_removing(),107			transfer_from_creating_removing()108		)109	}110111	fn burn_from() -> Weight {112		<SelfWeightOf<T>>::burn_from()113	}114115	fn set_variable_metadata(bytes: u32) -> Weight {116		<SelfWeightOf<T>>::set_variable_metadata(bytes)117	}118}119120fn map_create_data<T: Config>(121	data: up_data_structs::CreateItemData,122	to: &T::CrossAccountId,123) -> Result<CreateRefungibleExData<T::CrossAccountId>, DispatchError> {124	match data {125		up_data_structs::CreateItemData::ReFungible(data) => Ok(CreateRefungibleExData {126			const_data: data.const_data,127			variable_data: data.variable_data,128			users: {129				let mut out = BTreeMap::new();130				out.insert(to.clone(), data.pieces);131				out.try_into().expect("limit > 0")132			},133		}),134		_ => fail!(<Error<T>>::NotRefungibleDataUsedToMintFungibleCollectionToken),135	}136}137138impl<T: Config> CommonCollectionOperations<T> for RefungibleHandle<T> {139	fn create_item(140		&self,141		sender: T::CrossAccountId,142		to: T::CrossAccountId,143		data: up_data_structs::CreateItemData,144		nesting_budget: &dyn Budget,145	) -> DispatchResultWithPostInfo {146		with_weight(147			<Pallet<T>>::create_item(148				self,149				&sender,150				map_create_data::<T>(data, &to)?,151				nesting_budget,152			),153			<CommonWeights<T>>::create_item(),154		)155	}156157	fn create_multiple_items(158		&self,159		sender: T::CrossAccountId,160		to: T::CrossAccountId,161		data: Vec<up_data_structs::CreateItemData>,162		nesting_budget: &dyn Budget,163	) -> DispatchResultWithPostInfo {164		let data = data165			.into_iter()166			.map(|d| map_create_data::<T>(d, &to))167			.collect::<Result<Vec<_>, DispatchError>>()?;168169		let amount = data.len();170		with_weight(171			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),172			<CommonWeights<T>>::create_multiple_items(amount as u32),173		)174	}175176	fn create_multiple_items_ex(177		&self,178		sender: <T>::CrossAccountId,179		data: CreateItemExData<T::CrossAccountId>,180		nesting_budget: &dyn Budget,181	) -> DispatchResultWithPostInfo {182		let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);183		let data = match data {184			CreateItemExData::RefungibleMultipleOwners(r) => vec![r],185			CreateItemExData::RefungibleMultipleItems(r)186				if r.iter().all(|i| i.users.len() == 1) =>187			{188				r.into_inner()189			}190			_ => fail!(<Error<T>>::NotRefungibleDataUsedToMintFungibleCollectionToken),191		};192193		with_weight(194			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),195			weight,196		)197	}198199	fn burn_item(200		&self,201		sender: T::CrossAccountId,202		token: TokenId,203		amount: u128,204	) -> DispatchResultWithPostInfo {205		with_weight(206			<Pallet<T>>::burn(self, &sender, token, amount),207			<CommonWeights<T>>::burn_item(),208		)209	}210211	fn transfer(212		&self,213		from: T::CrossAccountId,214		to: T::CrossAccountId,215		token: TokenId,216		amount: u128,217		nesting_budget: &dyn Budget,218	) -> DispatchResultWithPostInfo {219		with_weight(220			<Pallet<T>>::transfer(self, &from, &to, token, amount, nesting_budget),221			<CommonWeights<T>>::transfer(),222		)223	}224225	fn approve(226		&self,227		sender: T::CrossAccountId,228		spender: T::CrossAccountId,229		token: TokenId,230		amount: u128,231	) -> DispatchResultWithPostInfo {232		with_weight(233			<Pallet<T>>::set_allowance(self, &sender, &spender, token, amount),234			<CommonWeights<T>>::approve(),235		)236	}237238	fn transfer_from(239		&self,240		sender: T::CrossAccountId,241		from: T::CrossAccountId,242		to: T::CrossAccountId,243		token: TokenId,244		amount: u128,245		nesting_budget: &dyn Budget,246	) -> DispatchResultWithPostInfo {247		with_weight(248			<Pallet<T>>::transfer_from(self, &sender, &from, &to, token, amount, nesting_budget),249			<CommonWeights<T>>::transfer_from(),250		)251	}252253	fn burn_from(254		&self,255		sender: T::CrossAccountId,256		from: T::CrossAccountId,257		token: TokenId,258		amount: u128,259		nesting_budget: &dyn Budget,260	) -> DispatchResultWithPostInfo {261		with_weight(262			<Pallet<T>>::burn_from(self, &sender, &from, token, amount, nesting_budget),263			<CommonWeights<T>>::burn_from(),264		)265	}266267	fn set_collection_properties(268		&self,269		_sender: T::CrossAccountId,270		_property: Vec<Property>,271	) -> DispatchResultWithPostInfo {272		fail!(<Error<T>>::PropertiesNotAllowed)273	}274275	fn delete_collection_properties(276		&self,277		_sender: &T::CrossAccountId,278		_property_keys: Vec<PropertyKey>,279	) -> DispatchResultWithPostInfo {280		fail!(<Error<T>>::PropertiesNotAllowed)281	}282283	fn set_token_properties(284		&self,285		_sender: T::CrossAccountId,286		_token_id: TokenId,287		_property: Vec<Property>,288	) -> DispatchResultWithPostInfo {289		fail!(<Error<T>>::PropertiesNotAllowed)290	}291292	fn set_property_permissions(293		&self,294		_sender: &T::CrossAccountId,295		_property_permissions: Vec<PropertyKeyPermission>,296	) -> DispatchResultWithPostInfo {297		fail!(<Error<T>>::PropertiesNotAllowed)298	}299300	fn delete_token_properties(301		&self,302		_sender: T::CrossAccountId,303		_token_id: TokenId,304		_property_keys: Vec<PropertyKey>,305	) -> DispatchResultWithPostInfo {306		fail!(<Error<T>>::PropertiesNotAllowed)307	}308309	fn set_variable_metadata(310		&self,311		sender: T::CrossAccountId,312		token: TokenId,313		data: BoundedVec<u8, CustomDataLimit>,314	) -> DispatchResultWithPostInfo {315		let len = data.len();316		with_weight(317			<Pallet<T>>::set_variable_metadata(self, &sender, token, data),318			<CommonWeights<T>>::set_variable_metadata(len as u32),319		)320	}321322	fn check_nesting(323		&self,324		_sender: <T>::CrossAccountId,325		_from: (CollectionId, TokenId),326		_under: TokenId,327		_budget: &dyn Budget,328	) -> sp_runtime::DispatchResult {329		fail!(<Error<T>>::RefungibleDisallowsNesting)330	}331332	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {333		<Owned<T>>::iter_prefix((self.id, account))334			.map(|(id, _)| id)335			.collect()336	}337338	fn collection_tokens(&self) -> Vec<TokenId> {339		<TokenData<T>>::iter_prefix((self.id,))340			.map(|(id, _)| id)341			.collect()342	}343344	fn token_exists(&self, token: TokenId) -> bool {345		<Pallet<T>>::token_exists(self, token)346	}347348	fn last_token_id(&self) -> TokenId {349		TokenId(<TokensMinted<T>>::get(self.id))350	}351352	fn token_owner(&self, _token: TokenId) -> Option<T::CrossAccountId> {353		None354	}355	fn const_metadata(&self, token: TokenId) -> Vec<u8> {356		<TokenData<T>>::get((self.id, token))357			.const_data358			.into_inner()359	}360	fn variable_metadata(&self, token: TokenId) -> Vec<u8> {361		<TokenData<T>>::get((self.id, token))362			.variable_data363			.into_inner()364	}365366	fn total_supply(&self) -> u32 {367		<Pallet<T>>::total_supply(self)368	}369370	fn account_balance(&self, account: T::CrossAccountId) -> u32 {371		<AccountBalance<T>>::get((self.id, account))372	}373374	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {375		<Balance<T>>::get((self.id, token, account))376	}377378	fn allowance(379		&self,380		sender: T::CrossAccountId,381		spender: T::CrossAccountId,382		token: TokenId,383	) -> u128 {384		<Allowance<T>>::get((self.id, token, sender, spender))385	}386}
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))
 	}