git.delta.rocks / unique-network / refs/commits / 9d51561e5bd0

difftreelog

Revert "feat: burn children when destroying a collection"

Daniel Shiposha2022-05-27parent: #2c83d97.patch.diff
in: master
This reverts commit 4b7f4d90a16f3a5ab26bed0511dabae078429724.

12 files changed

modifiedpallets/common/src/dispatch.rsdiffbeforeafterboth
--- a/pallets/common/src/dispatch.rs
+++ b/pallets/common/src/dispatch.rs
@@ -6,7 +6,7 @@
 	weights::Pays,
 	traits::Get,
 };
-use up_data_structs::{CollectionId, CreateCollectionData, budget::Budget};
+use up_data_structs::{CollectionId, CreateCollectionData};
 
 use crate::{pallet::Config, CommonCollectionOperations, CollectionHandle};
 
@@ -57,11 +57,7 @@
 
 pub trait CollectionDispatch<T: Config> {
 	fn create(sender: T::AccountId, data: CreateCollectionData<T::AccountId>) -> DispatchResult;
-	fn destroy(
-		sender: T::CrossAccountId,
-		handle: CollectionHandle<T>,
-		nesting_budget: &dyn Budget,
-	) -> DispatchResult;
+	fn destroy(sender: T::CrossAccountId, handle: CollectionHandle<T>) -> DispatchResult;
 
 	fn dispatch(handle: CollectionHandle<T>) -> Self;
 	fn into_inner(self) -> CollectionHandle<T>;
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -1169,12 +1169,6 @@
 		token: TokenId,
 		amount: u128,
 	) -> DispatchResultWithPostInfo;
-	fn burn_item_unchecked(
-		&self,
-		owner: &T::CrossAccountId,
-		token: TokenId,
-		amount: u128,
-	) -> DispatchResult;
 	fn set_collection_properties(
 		&self,
 		sender: T::CrossAccountId,
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -170,17 +170,6 @@
 		)
 	}
 
-	fn burn_item_unchecked(
-		&self,
-		owner: &T::CrossAccountId,
-		_token: TokenId,
-		amount: u128,
-	) -> sp_runtime::DispatchResult {
-		<Pallet<T>>::burn_item_unchecked(self, owner, amount)?;
-
-		Ok(())
-	}
-
 	fn transfer(
 		&self,
 		from: T::CrossAccountId,
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -160,36 +160,6 @@
 		owner: &T::CrossAccountId,
 		amount: u128,
 	) -> DispatchResult {
-		if collection.access == AccessMode::AllowList {
-			collection.check_allowlist(owner)?;
-		}
-
-		// =========
-
-		Self::burn_item_unchecked(collection, owner, amount)?;
-
-		<PalletEvm<T>>::deposit_log(
-			ERC20Events::Transfer {
-				from: *owner.as_eth(),
-				to: H160::default(),
-				value: amount.into(),
-			}
-			.to_log(collection_id_to_address(collection.id)),
-		);
-		<PalletCommon<T>>::deposit_event(CommonEvent::ItemDestroyed(
-			collection.id,
-			TokenId::default(),
-			owner.clone(),
-			amount,
-		));
-		Ok(())
-	}
-
-	pub fn burn_item_unchecked(
-		collection: &FungibleHandle<T>,
-		owner: &T::CrossAccountId,
-		amount: u128,
-	) -> DispatchResult {
 		let total_supply = <TotalSupply<T>>::get(collection.id)
 			.checked_sub(amount)
 			.ok_or(<CommonError<T>>::TokenValueTooLow)?;
@@ -216,6 +186,20 @@
 		}
 		<TotalSupply<T>>::insert(collection.id, total_supply);
 
+		<PalletEvm<T>>::deposit_log(
+			ERC20Events::Transfer {
+				from: *owner.as_eth(),
+				to: H160::default(),
+				value: amount.into(),
+			}
+			.to_log(collection_id_to_address(collection.id)),
+		);
+		<PalletCommon<T>>::deposit_event(CommonEvent::ItemDestroyed(
+			collection.id,
+			TokenId::default(),
+			owner.clone(),
+			amount,
+		));
 		Ok(())
 	}
 
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};20use up_data_structs::{21	TokenId, CreateItemExData, CollectionId, budget::Budget, Property, PropertyKey,22	PropertyKeyPermission, PropertyValue,23};24use pallet_common::{25	CommonCollectionOperations, CommonWeightInfo, with_weight, weights::WeightInfo as _,26};27use sp_runtime::DispatchError;28use sp_std::vec::Vec;2930use crate::{31	AccountBalance, Allowance, Config, CreateItemData, Error, NonfungibleHandle, Owned, Pallet,32	SelfWeightOf, TokenData, weights::WeightInfo, TokensMinted,33};3435pub struct CommonWeights<T: Config>(PhantomData<T>);36impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {37	fn create_item() -> Weight {38		<SelfWeightOf<T>>::create_item()39	}4041	fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {42		match data {43			CreateItemExData::NFT(t) => {44				<SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32)45					+ t.iter()46						.map(|t| {47							if t.properties.len() > 0 {48								Self::set_token_properties(t.properties.len() as u32)49							} else {50								051							}52						})53						.sum::<u64>()54			}55			_ => 0,56		}57	}5859	fn create_multiple_items(data: &[up_data_structs::CreateItemData]) -> Weight {60		<SelfWeightOf<T>>::create_multiple_items(data.len() as u32)61			+ data62				.iter()63				.filter_map(|t| match t {64					up_data_structs::CreateItemData::NFT(n) if n.properties.len() > 0 => {65						Some(Self::set_token_properties(n.properties.len() as u32))66					}67					_ => None,68				})69				.sum::<u64>()70	}7172	fn burn_item() -> Weight {73		<SelfWeightOf<T>>::burn_item()74	}7576	fn set_collection_properties(amount: u32) -> Weight {77		<pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)78	}7980	fn delete_collection_properties(amount: u32) -> Weight {81		<pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)82	}8384	fn set_token_properties(amount: u32) -> Weight {85		<SelfWeightOf<T>>::set_token_properties(amount)86	}8788	fn delete_token_properties(amount: u32) -> Weight {89		<SelfWeightOf<T>>::delete_token_properties(amount)90	}9192	fn set_property_permissions(amount: u32) -> Weight {93		<SelfWeightOf<T>>::set_property_permissions(amount)94	}9596	fn transfer() -> Weight {97		<SelfWeightOf<T>>::transfer()98	}99100	fn approve() -> Weight {101		<SelfWeightOf<T>>::approve()102	}103104	fn transfer_from() -> Weight {105		<SelfWeightOf<T>>::transfer_from()106	}107108	fn burn_from() -> Weight {109		<SelfWeightOf<T>>::burn_from()110	}111}112113fn map_create_data<T: Config>(114	data: up_data_structs::CreateItemData,115	to: &T::CrossAccountId,116) -> Result<CreateItemData<T>, DispatchError> {117	match data {118		up_data_structs::CreateItemData::NFT(data) => Ok(CreateItemData::<T> {119			properties: data.properties,120			owner: to.clone(),121		}),122		_ => fail!(<Error<T>>::NotNonfungibleDataUsedToMintFungibleCollectionToken),123	}124}125126impl<T: Config> CommonCollectionOperations<T> for NonfungibleHandle<T> {127	fn create_item(128		&self,129		sender: T::CrossAccountId,130		to: T::CrossAccountId,131		data: up_data_structs::CreateItemData,132		nesting_budget: &dyn Budget,133	) -> DispatchResultWithPostInfo {134		with_weight(135			<Pallet<T>>::create_item(136				self,137				&sender,138				map_create_data::<T>(data, &to)?,139				nesting_budget,140			),141			<CommonWeights<T>>::create_item(),142		)143	}144145	fn create_multiple_items(146		&self,147		sender: T::CrossAccountId,148		to: T::CrossAccountId,149		data: Vec<up_data_structs::CreateItemData>,150		nesting_budget: &dyn Budget,151	) -> DispatchResultWithPostInfo {152		let weight = <CommonWeights<T>>::create_multiple_items(&data);153		let data = data154			.into_iter()155			.map(|d| map_create_data::<T>(d, &to))156			.collect::<Result<Vec<_>, DispatchError>>()?;157158		with_weight(159			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),160			weight,161		)162	}163164	fn create_multiple_items_ex(165		&self,166		sender: <T>::CrossAccountId,167		data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,168		nesting_budget: &dyn Budget,169	) -> DispatchResultWithPostInfo {170		let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);171		let data = match data {172			up_data_structs::CreateItemExData::NFT(nft) => nft,173			_ => fail!(Error::<T>::NotNonfungibleDataUsedToMintFungibleCollectionToken),174		};175176		with_weight(177			<Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),178			weight,179		)180	}181182	fn set_collection_properties(183		&self,184		sender: T::CrossAccountId,185		properties: Vec<Property>,186	) -> DispatchResultWithPostInfo {187		let weight = <CommonWeights<T>>::set_collection_properties(properties.len() as u32);188189		with_weight(190			<Pallet<T>>::set_collection_properties(self, &sender, properties),191			weight,192		)193	}194195	fn delete_collection_properties(196		&self,197		sender: &T::CrossAccountId,198		property_keys: Vec<PropertyKey>,199	) -> DispatchResultWithPostInfo {200		let weight = <CommonWeights<T>>::delete_collection_properties(property_keys.len() as u32);201202		with_weight(203			<Pallet<T>>::delete_collection_properties(self, sender, property_keys),204			weight,205		)206	}207208	fn set_token_properties(209		&self,210		sender: T::CrossAccountId,211		token_id: TokenId,212		properties: Vec<Property>,213	) -> DispatchResultWithPostInfo {214		let weight = <CommonWeights<T>>::set_token_properties(properties.len() as u32);215216		with_weight(217			<Pallet<T>>::set_token_properties(self, &sender, token_id, properties),218			weight,219		)220	}221222	fn delete_token_properties(223		&self,224		sender: T::CrossAccountId,225		token_id: TokenId,226		property_keys: Vec<PropertyKey>,227	) -> DispatchResultWithPostInfo {228		let weight = <CommonWeights<T>>::delete_token_properties(property_keys.len() as u32);229230		with_weight(231			<Pallet<T>>::delete_token_properties(self, &sender, token_id, property_keys),232			weight,233		)234	}235236	fn set_property_permissions(237		&self,238		sender: &T::CrossAccountId,239		property_permissions: Vec<PropertyKeyPermission>,240	) -> DispatchResultWithPostInfo {241		let weight =242			<CommonWeights<T>>::set_property_permissions(property_permissions.len() as u32);243244		with_weight(245			<Pallet<T>>::set_property_permissions(self, sender, property_permissions),246			weight,247		)248	}249250	fn burn_item(251		&self,252		sender: T::CrossAccountId,253		token: TokenId,254		amount: u128,255	) -> DispatchResultWithPostInfo {256		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);257		if amount == 1 {258			with_weight(259				<Pallet<T>>::burn(self, &sender, token),260				<CommonWeights<T>>::burn_item(),261			)262		} else {263			Ok(().into())264		}265	}266267	fn burn_item_unchecked(268		&self,269		owner:& T::CrossAccountId,270		token: TokenId,271		amount: u128,272	) -> sp_runtime::DispatchResult {273		if amount == 1 {274			<Pallet<T>>::burn_item_unchecked(self, owner, token)275		} else {276			Ok(())277		}278	}279280	fn transfer(281		&self,282		from: T::CrossAccountId,283		to: T::CrossAccountId,284		token: TokenId,285		amount: u128,286		nesting_budget: &dyn Budget,287	) -> DispatchResultWithPostInfo {288		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);289		if amount == 1 {290			with_weight(291				<Pallet<T>>::transfer(self, &from, &to, token, nesting_budget),292				<CommonWeights<T>>::transfer(),293			)294		} else {295			Ok(().into())296		}297	}298299	fn approve(300		&self,301		sender: T::CrossAccountId,302		spender: T::CrossAccountId,303		token: TokenId,304		amount: u128,305	) -> DispatchResultWithPostInfo {306		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);307308		with_weight(309			if amount == 1 {310				<Pallet<T>>::set_allowance(self, &sender, token, Some(&spender))311			} else {312				<Pallet<T>>::set_allowance(self, &sender, token, None)313			},314			<CommonWeights<T>>::approve(),315		)316	}317318	fn transfer_from(319		&self,320		sender: T::CrossAccountId,321		from: T::CrossAccountId,322		to: T::CrossAccountId,323		token: TokenId,324		amount: u128,325		nesting_budget: &dyn Budget,326	) -> DispatchResultWithPostInfo {327		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);328329		if amount == 1 {330			with_weight(331				<Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget),332				<CommonWeights<T>>::transfer_from(),333			)334		} else {335			Ok(().into())336		}337	}338339	fn burn_from(340		&self,341		sender: T::CrossAccountId,342		from: T::CrossAccountId,343		token: TokenId,344		amount: u128,345		nesting_budget: &dyn Budget,346	) -> DispatchResultWithPostInfo {347		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);348349		if amount == 1 {350			with_weight(351				<Pallet<T>>::burn_from(self, &sender, &from, token, nesting_budget),352				<CommonWeights<T>>::burn_from(),353			)354		} else {355			Ok(().into())356		}357	}358359	fn check_nesting(360		&self,361		sender: T::CrossAccountId,362		from: (CollectionId, TokenId),363		under: TokenId,364		budget: &dyn Budget,365	) -> sp_runtime::DispatchResult {366		<Pallet<T>>::check_nesting(self, sender, from, under, budget)367	}368369	fn nest(370		&self,371		under: TokenId,372		to_nest: (CollectionId, TokenId)373	) {374		<Pallet<T>>::nest((self.id, under), to_nest);375	}376377	fn unnest(378		&self,379		under: TokenId,380		to_unnest: (CollectionId, TokenId)381	) {382		<Pallet<T>>::unnest((self.id, under), to_unnest);383	}384385	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {386		<Owned<T>>::iter_prefix((self.id, account))387			.map(|(id, _)| id)388			.collect()389	}390391	fn collection_tokens(&self) -> Vec<TokenId> {392		<TokenData<T>>::iter_prefix((self.id,))393			.map(|(id, _)| id)394			.collect()395	}396397	fn token_exists(&self, token: TokenId) -> bool {398		<Pallet<T>>::token_exists(self, token)399	}400401	fn last_token_id(&self) -> TokenId {402		TokenId(<TokensMinted<T>>::get(self.id))403	}404405	fn token_owner(&self, token: TokenId) -> Option<T::CrossAccountId> {406		<TokenData<T>>::get((self.id, token)).map(|t| t.owner)407	}408409	fn token_property(&self, token_id: TokenId, key: &PropertyKey) -> Option<PropertyValue> {410		<Pallet<T>>::token_properties((self.id, token_id))411			.get(key)412			.cloned()413	}414415	fn token_properties(&self, token_id: TokenId, keys: Option<Vec<PropertyKey>>) -> Vec<Property> {416		let properties = <Pallet<T>>::token_properties((self.id, token_id));417418		keys.map(|keys| {419			keys.into_iter()420				.filter_map(|key| {421					properties.get(&key).map(|value| Property {422						key,423						value: value.clone(),424					})425				})426				.collect()427		})428		.unwrap_or_else(|| {429			properties430				.into_iter()431				.map(|(key, value)| Property {432					key: key.clone(),433					value: value.clone(),434				})435				.collect()436		})437	}438439	fn total_supply(&self) -> u32 {440		<Pallet<T>>::total_supply(self)441	}442443	fn account_balance(&self, account: T::CrossAccountId) -> u32 {444		<AccountBalance<T>>::get((self.id, account))445	}446447	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {448		if <TokenData<T>>::get((self.id, token))449			.map(|a| a.owner == account)450			.unwrap_or(false)451		{452			1453		} else {454			0455		}456	}457458	fn allowance(459		&self,460		sender: T::CrossAccountId,461		spender: T::CrossAccountId,462		token: TokenId,463	) -> u128 {464		if <TokenData<T>>::get((self.id, token))465			.map(|a| a.owner != sender)466			.unwrap_or(true)467		{468			0469		} else if <Allowance<T>>::get((self.id, token)) == Some(spender) {470			1471		} else {472			0473		}474	}475}
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};20use up_data_structs::{21	TokenId, CreateItemExData, CollectionId, budget::Budget, Property, PropertyKey,22	PropertyKeyPermission, PropertyValue,23};24use pallet_common::{25	CommonCollectionOperations, CommonWeightInfo, with_weight, weights::WeightInfo as _,26};27use sp_runtime::DispatchError;28use sp_std::vec::Vec;2930use crate::{31	AccountBalance, Allowance, Config, CreateItemData, Error, NonfungibleHandle, Owned, Pallet,32	SelfWeightOf, TokenData, weights::WeightInfo, TokensMinted,33};3435pub struct CommonWeights<T: Config>(PhantomData<T>);36impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {37	fn create_item() -> Weight {38		<SelfWeightOf<T>>::create_item()39	}4041	fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {42		match data {43			CreateItemExData::NFT(t) => {44				<SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32)45					+ t.iter()46						.map(|t| {47							if t.properties.len() > 0 {48								Self::set_token_properties(t.properties.len() as u32)49							} else {50								051							}52						})53						.sum::<u64>()54			}55			_ => 0,56		}57	}5859	fn create_multiple_items(data: &[up_data_structs::CreateItemData]) -> Weight {60		<SelfWeightOf<T>>::create_multiple_items(data.len() as u32)61			+ data62				.iter()63				.filter_map(|t| match t {64					up_data_structs::CreateItemData::NFT(n) if n.properties.len() > 0 => {65						Some(Self::set_token_properties(n.properties.len() as u32))66					}67					_ => None,68				})69				.sum::<u64>()70	}7172	fn burn_item() -> Weight {73		<SelfWeightOf<T>>::burn_item()74	}7576	fn set_collection_properties(amount: u32) -> Weight {77		<pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)78	}7980	fn delete_collection_properties(amount: u32) -> Weight {81		<pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)82	}8384	fn set_token_properties(amount: u32) -> Weight {85		<SelfWeightOf<T>>::set_token_properties(amount)86	}8788	fn delete_token_properties(amount: u32) -> Weight {89		<SelfWeightOf<T>>::delete_token_properties(amount)90	}9192	fn set_property_permissions(amount: u32) -> Weight {93		<SelfWeightOf<T>>::set_property_permissions(amount)94	}9596	fn transfer() -> Weight {97		<SelfWeightOf<T>>::transfer()98	}99100	fn approve() -> Weight {101		<SelfWeightOf<T>>::approve()102	}103104	fn transfer_from() -> Weight {105		<SelfWeightOf<T>>::transfer_from()106	}107108	fn burn_from() -> Weight {109		<SelfWeightOf<T>>::burn_from()110	}111}112113fn map_create_data<T: Config>(114	data: up_data_structs::CreateItemData,115	to: &T::CrossAccountId,116) -> Result<CreateItemData<T>, DispatchError> {117	match data {118		up_data_structs::CreateItemData::NFT(data) => Ok(CreateItemData::<T> {119			properties: data.properties,120			owner: to.clone(),121		}),122		_ => fail!(<Error<T>>::NotNonfungibleDataUsedToMintFungibleCollectionToken),123	}124}125126impl<T: Config> CommonCollectionOperations<T> for NonfungibleHandle<T> {127	fn create_item(128		&self,129		sender: T::CrossAccountId,130		to: T::CrossAccountId,131		data: up_data_structs::CreateItemData,132		nesting_budget: &dyn Budget,133	) -> DispatchResultWithPostInfo {134		with_weight(135			<Pallet<T>>::create_item(136				self,137				&sender,138				map_create_data::<T>(data, &to)?,139				nesting_budget,140			),141			<CommonWeights<T>>::create_item(),142		)143	}144145	fn create_multiple_items(146		&self,147		sender: T::CrossAccountId,148		to: T::CrossAccountId,149		data: Vec<up_data_structs::CreateItemData>,150		nesting_budget: &dyn Budget,151	) -> DispatchResultWithPostInfo {152		let weight = <CommonWeights<T>>::create_multiple_items(&data);153		let data = data154			.into_iter()155			.map(|d| map_create_data::<T>(d, &to))156			.collect::<Result<Vec<_>, DispatchError>>()?;157158		with_weight(159			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),160			weight,161		)162	}163164	fn create_multiple_items_ex(165		&self,166		sender: <T>::CrossAccountId,167		data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,168		nesting_budget: &dyn Budget,169	) -> DispatchResultWithPostInfo {170		let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);171		let data = match data {172			up_data_structs::CreateItemExData::NFT(nft) => nft,173			_ => fail!(Error::<T>::NotNonfungibleDataUsedToMintFungibleCollectionToken),174		};175176		with_weight(177			<Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),178			weight,179		)180	}181182	fn set_collection_properties(183		&self,184		sender: T::CrossAccountId,185		properties: Vec<Property>,186	) -> DispatchResultWithPostInfo {187		let weight = <CommonWeights<T>>::set_collection_properties(properties.len() as u32);188189		with_weight(190			<Pallet<T>>::set_collection_properties(self, &sender, properties),191			weight,192		)193	}194195	fn delete_collection_properties(196		&self,197		sender: &T::CrossAccountId,198		property_keys: Vec<PropertyKey>,199	) -> DispatchResultWithPostInfo {200		let weight = <CommonWeights<T>>::delete_collection_properties(property_keys.len() as u32);201202		with_weight(203			<Pallet<T>>::delete_collection_properties(self, sender, property_keys),204			weight,205		)206	}207208	fn set_token_properties(209		&self,210		sender: T::CrossAccountId,211		token_id: TokenId,212		properties: Vec<Property>,213	) -> DispatchResultWithPostInfo {214		let weight = <CommonWeights<T>>::set_token_properties(properties.len() as u32);215216		with_weight(217			<Pallet<T>>::set_token_properties(self, &sender, token_id, properties),218			weight,219		)220	}221222	fn delete_token_properties(223		&self,224		sender: T::CrossAccountId,225		token_id: TokenId,226		property_keys: Vec<PropertyKey>,227	) -> DispatchResultWithPostInfo {228		let weight = <CommonWeights<T>>::delete_token_properties(property_keys.len() as u32);229230		with_weight(231			<Pallet<T>>::delete_token_properties(self, &sender, token_id, property_keys),232			weight,233		)234	}235236	fn set_property_permissions(237		&self,238		sender: &T::CrossAccountId,239		property_permissions: Vec<PropertyKeyPermission>,240	) -> DispatchResultWithPostInfo {241		let weight =242			<CommonWeights<T>>::set_property_permissions(property_permissions.len() as u32);243244		with_weight(245			<Pallet<T>>::set_property_permissions(self, sender, property_permissions),246			weight,247		)248	}249250	fn burn_item(251		&self,252		sender: T::CrossAccountId,253		token: TokenId,254		amount: u128,255	) -> DispatchResultWithPostInfo {256		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);257		if amount == 1 {258			with_weight(259				<Pallet<T>>::burn(self, &sender, token),260				<CommonWeights<T>>::burn_item(),261			)262		} else {263			Ok(().into())264		}265	}266267	fn transfer(268		&self,269		from: T::CrossAccountId,270		to: T::CrossAccountId,271		token: TokenId,272		amount: u128,273		nesting_budget: &dyn Budget,274	) -> DispatchResultWithPostInfo {275		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);276		if amount == 1 {277			with_weight(278				<Pallet<T>>::transfer(self, &from, &to, token, nesting_budget),279				<CommonWeights<T>>::transfer(),280			)281		} else {282			Ok(().into())283		}284	}285286	fn approve(287		&self,288		sender: T::CrossAccountId,289		spender: T::CrossAccountId,290		token: TokenId,291		amount: u128,292	) -> DispatchResultWithPostInfo {293		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);294295		with_weight(296			if amount == 1 {297				<Pallet<T>>::set_allowance(self, &sender, token, Some(&spender))298			} else {299				<Pallet<T>>::set_allowance(self, &sender, token, None)300			},301			<CommonWeights<T>>::approve(),302		)303	}304305	fn transfer_from(306		&self,307		sender: T::CrossAccountId,308		from: T::CrossAccountId,309		to: T::CrossAccountId,310		token: TokenId,311		amount: u128,312		nesting_budget: &dyn Budget,313	) -> DispatchResultWithPostInfo {314		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);315316		if amount == 1 {317			with_weight(318				<Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget),319				<CommonWeights<T>>::transfer_from(),320			)321		} else {322			Ok(().into())323		}324	}325326	fn burn_from(327		&self,328		sender: T::CrossAccountId,329		from: T::CrossAccountId,330		token: TokenId,331		amount: u128,332		nesting_budget: &dyn Budget,333	) -> DispatchResultWithPostInfo {334		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);335336		if amount == 1 {337			with_weight(338				<Pallet<T>>::burn_from(self, &sender, &from, token, nesting_budget),339				<CommonWeights<T>>::burn_from(),340			)341		} else {342			Ok(().into())343		}344	}345346	fn check_nesting(347		&self,348		sender: T::CrossAccountId,349		from: (CollectionId, TokenId),350		under: TokenId,351		budget: &dyn Budget,352	) -> sp_runtime::DispatchResult {353		<Pallet<T>>::check_nesting(self, sender, from, under, budget)354	}355356	fn nest(357		&self,358		under: TokenId,359		to_nest: (CollectionId, TokenId)360	) {361		<Pallet<T>>::nest((self.id, under), to_nest);362	}363364	fn unnest(365		&self,366		under: TokenId,367		to_unnest: (CollectionId, TokenId)368	) {369		<Pallet<T>>::unnest((self.id, under), to_unnest);370	}371372	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {373		<Owned<T>>::iter_prefix((self.id, account))374			.map(|(id, _)| id)375			.collect()376	}377378	fn collection_tokens(&self) -> Vec<TokenId> {379		<TokenData<T>>::iter_prefix((self.id,))380			.map(|(id, _)| id)381			.collect()382	}383384	fn token_exists(&self, token: TokenId) -> bool {385		<Pallet<T>>::token_exists(self, token)386	}387388	fn last_token_id(&self) -> TokenId {389		TokenId(<TokensMinted<T>>::get(self.id))390	}391392	fn token_owner(&self, token: TokenId) -> Option<T::CrossAccountId> {393		<TokenData<T>>::get((self.id, token)).map(|t| t.owner)394	}395396	fn token_property(&self, token_id: TokenId, key: &PropertyKey) -> Option<PropertyValue> {397		<Pallet<T>>::token_properties((self.id, token_id))398			.get(key)399			.cloned()400	}401402	fn token_properties(&self, token_id: TokenId, keys: Option<Vec<PropertyKey>>) -> Vec<Property> {403		let properties = <Pallet<T>>::token_properties((self.id, token_id));404405		keys.map(|keys| {406			keys.into_iter()407				.filter_map(|key| {408					properties.get(&key).map(|value| Property {409						key,410						value: value.clone(),411					})412				})413				.collect()414		})415		.unwrap_or_else(|| {416			properties417				.into_iter()418				.map(|(key, value)| Property {419					key: key.clone(),420					value: value.clone(),421				})422				.collect()423		})424	}425426	fn total_supply(&self) -> u32 {427		<Pallet<T>>::total_supply(self)428	}429430	fn account_balance(&self, account: T::CrossAccountId) -> u32 {431		<AccountBalance<T>>::get((self.id, account))432	}433434	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {435		if <TokenData<T>>::get((self.id, token))436			.map(|a| a.owner == account)437			.unwrap_or(false)438		{439			1440		} else {441			0442		}443	}444445	fn allowance(446		&self,447		sender: T::CrossAccountId,448		spender: T::CrossAccountId,449		token: TokenId,450	) -> u128 {451		if <TokenData<T>>::get((self.id, token))452			.map(|a| a.owner != sender)453			.unwrap_or(true)454		{455			0456		} else if <Allowance<T>>::get((self.id, token)) == Some(spender) {457			1458		} else {459			0460		}461	}462}
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -27,7 +27,6 @@
 use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
 use pallet_common::{
 	Error as CommonError, Pallet as PalletCommon, Event as CommonEvent, CollectionHandle,
-	dispatch::CollectionDispatch,
 	eth::collection_id_to_address,
 };
 use pallet_structure::Pallet as PalletStructure;
@@ -80,8 +79,6 @@
 		NonfungibleItemsHaveNoAmount,
 		/// Unable to burn NFT with children
 		CantBurnNftWithChildren,
-		/// Too many children to burn when destroying a collection
-		TooManyChildrenToBurn,
 	}
 
 	#[pallet::config]
@@ -293,14 +290,13 @@
 	pub fn destroy_collection(
 		collection: NonfungibleHandle<T>,
 		sender: &T::CrossAccountId,
-		nesting_budget: &dyn Budget,
 	) -> DispatchResult {
 		let id = collection.id;
 
 		// =========
 
-		Self::burn_children_in_collection(id, nesting_budget)?;
 		PalletCommon::destroy_collection(collection.0, sender)?;
+
 		<TokenData<T>>::remove_prefix((id,), None);
 		<TokenChildren<T>>::remove_prefix((id,), None);
 		<Owned<T>>::remove_prefix((id,), None);
@@ -308,47 +304,9 @@
 		<TokensBurnt<T>>::remove(id);
 		<Allowance<T>>::remove_prefix((id,), None);
 		<AccountBalance<T>>::remove_prefix((id,), None);
-		Ok(())
-	}
-
-	#[transactional]
-	fn burn_children_in_collection(collection_id: CollectionId, nesting_budget: &dyn Budget) -> DispatchResult {
-		for (parent_id, child) in <TokenChildren<T>>::drain_prefix((collection_id,))
-			.map(|((parent_id, child), _)| (parent_id, child)) {
-
-			let parent_address = T::CrossTokenAddressMapping::token_to_address(collection_id, parent_id);
-			Self::burn_tree(parent_address, child.0, child.1, nesting_budget)?;
-		}
-
 		Ok(())
 	}
 
-	fn burn_tree(
-		parent: T::CrossAccountId,
-		collection_id: CollectionId,
-		token_id: TokenId,
-		nesting_budget: &dyn Budget
-	) -> DispatchResult {
-		if !nesting_budget.consume() {
-			return Err(<Error<T>>::TooManyChildrenToBurn.into());
-		}
-
-		let handle = <CollectionHandle<T>>::try_get(collection_id)?;
-		let handle = T::CollectionDispatch::dispatch(handle);
-		let handle = handle.as_dyn();
-
-		let amount = handle.balance(parent.clone(), token_id);
-
-		handle.burn_item_unchecked(&parent, token_id, amount)?;
-
-		for child in <TokenChildren<T>>::drain_prefix((collection_id, token_id)).map(|(child, _)| child) {
-			let parent = T::CrossTokenAddressMapping::token_to_address(collection_id, token_id);
-			Self::burn_tree(parent, child.0, child.1, nesting_budget)?;
-		}
-
-		Ok(())
-	}
-
 	pub fn burn(
 		collection: &NonfungibleHandle<T>,
 		sender: &T::CrossAccountId,
@@ -370,11 +328,31 @@
 			return Err(<Error<T>>::CantBurnNftWithChildren.into());
 		}
 
-		let old_spender = <Allowance<T>>::get((collection.id, token));
+		let burnt = <TokensBurnt<T>>::get(collection.id)
+			.checked_add(1)
+			.ok_or(ArithmeticError::Overflow)?;
+
+		let balance = <AccountBalance<T>>::get((collection.id, token_data.owner.clone()))
+			.checked_sub(1)
+			.ok_or(ArithmeticError::Overflow)?;
+
+		if balance == 0 {
+			<AccountBalance<T>>::remove((collection.id, token_data.owner.clone()));
+		} else {
+			<AccountBalance<T>>::insert((collection.id, token_data.owner.clone()), balance);
+		}
+
+		if let Some(owner) = T::CrossTokenAddressMapping::address_to_token(&token_data.owner) {
+			Self::unnest(owner, (collection.id, token));
+		}
 
 		// =========
 
-		Self::burn_item_unchecked(collection, &token_data.owner, token)?;
+		<Owned<T>>::remove((collection.id, &token_data.owner, token));
+		<TokensBurnt<T>>::insert(collection.id, burnt);
+		<TokenData<T>>::remove((collection.id, token));
+		<TokenProperties<T>>::remove((collection.id, token));
+		let old_spender = <Allowance<T>>::take((collection.id, token));
 
 		if let Some(old_spender) = old_spender {
 			<PalletCommon<T>>::deposit_event(CommonEvent::Approved(
@@ -400,40 +378,6 @@
 			token_data.owner,
 			1,
 		));
-		Ok(())
-	}
-
-	pub fn burn_item_unchecked(
-		collection: &NonfungibleHandle<T>,
-		owner: &T::CrossAccountId,
-		token: TokenId,
-	) -> DispatchResult {
-		let burnt = <TokensBurnt<T>>::get(collection.id)
-			.checked_add(1)
-			.ok_or(ArithmeticError::Overflow)?;
-
-		let balance = <AccountBalance<T>>::get((collection.id, owner.clone()))
-			.checked_sub(1)
-			.ok_or(ArithmeticError::Overflow)?;
-
-		// =========
-
-		if let Some(owner) = T::CrossTokenAddressMapping::address_to_token(owner) {
-			Self::unnest(owner, (collection.id, token));
-		}
-
-		if balance == 0 {
-			<AccountBalance<T>>::remove((collection.id, owner.clone()));
-		} else {
-			<AccountBalance<T>>::insert((collection.id, owner.clone()), balance);
-		}
-
-		<Owned<T>>::remove((collection.id, owner, token));
-		<TokensBurnt<T>>::insert(collection.id, burnt);
-		<TokenData<T>>::remove((collection.id, token));
-		<TokenProperties<T>>::remove((collection.id, token));
-		<Allowance<T>>::remove((collection.id, token));
-
 		Ok(())
 	}
 
modifiedpallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-core/src/lib.rs
+++ b/pallets/proxy-rmrk-core/src/lib.rs
@@ -179,8 +179,7 @@
 
             ensure!(collection.total_supply() == 0, <Error<T>>::CollectionNotEmpty);
 
-            let empty_budget = budget::Value::new(0);
-            <PalletNft<T>>::destroy_collection(collection, &cross_sender, &empty_budget)
+            <PalletNft<T>>::destroy_collection(collection, &cross_sender)
                 .map_err(Self::map_common_err_to_proxy)?;
 
             Self::deposit_event(Event::CollectionDestroyed { issuer: sender, collection_id });
modifiedpallets/refungible/src/common.rsdiffbeforeafterboth
--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -205,15 +205,6 @@
 		)
 	}
 
-	fn burn_item_unchecked(
-		&self,
-		owner: &T::CrossAccountId,
-		token: TokenId,
-		amount: u128,
-	) -> sp_runtime::DispatchResult {
-		<Pallet<T>>::burn_item_unchecked(self, owner, token, amount)
-	}
-
 	fn transfer(
 		&self,
 		from: T::CrossAccountId,
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -245,25 +245,6 @@
 		token: TokenId,
 		amount: u128,
 	) -> DispatchResult {
-		Self::burn_item_unchecked(collection, owner, token, amount)?;
-
-		// TODO: ERC20 transfer event
-		<PalletCommon<T>>::deposit_event(CommonEvent::ItemDestroyed(
-			collection.id,
-			token,
-			owner.clone(),
-			amount,
-		));
-
-		Ok(())
-	}
-
-	pub fn burn_item_unchecked(
-		collection: &RefungibleHandle<T>,
-		owner: &T::CrossAccountId,
-		token: TokenId,
-		amount: u128,
-	) -> DispatchResult {
 		let total_supply = <TotalSupply<T>>::get((collection.id, token))
 			.checked_sub(amount)
 			.ok_or(<CommonError<T>>::TokenValueTooLow)?;
@@ -318,6 +299,13 @@
 			<Balance<T>>::insert((collection.id, token, owner), balance);
 		}
 		<TotalSupply<T>>::insert((collection.id, token), total_supply);
+		// TODO: ERC20 transfer event
+		<PalletCommon<T>>::deposit_event(CommonEvent::ItemDestroyed(
+			collection.id,
+			token,
+			owner.clone(),
+			amount,
+		));
 		Ok(())
 	}
 
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -332,24 +332,15 @@
 		/// # Arguments
 		///
 		/// * collection_id: collection to destroy.
-		#[weight =
-			<SelfWeightOf<T>>::destroy_collection()
-			+ <SelfWeightOf<T>>::burn_children_in_collection(*max_children_to_burn)
-		]
+		#[weight = <SelfWeightOf<T>>::destroy_collection()]
 		#[transactional]
-		pub fn destroy_collection(
-			origin,
-			collection_id: CollectionId,
-			max_children_to_burn: u32,
-		) -> DispatchResult {
+		pub fn destroy_collection(origin, collection_id: CollectionId) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			let collection = <CollectionHandle<T>>::try_get(collection_id)?;
 
-			let budget = budget::Value::new(max_children_to_burn);
-
 			// =========
 
-			T::CollectionDispatch::destroy(sender, collection, &budget)?;
+			T::CollectionDispatch::destroy(sender, collection)?;
 
 			<NftTransferBasket<T>>::remove_prefix(collection_id, None);
 			<FungibleTransferBasket<T>>::remove_prefix(collection_id, None);
modifiedpallets/unique/src/weights.rsdiffbeforeafterboth
--- a/pallets/unique/src/weights.rs
+++ b/pallets/unique/src/weights.rs
@@ -34,7 +34,6 @@
 pub trait WeightInfo {
 	fn create_collection() -> Weight;
 	fn destroy_collection() -> Weight;
-	fn burn_children_in_collection(max: u32) -> Weight;
 	fn add_to_allow_list() -> Weight;
 	fn remove_from_allow_list() -> Weight;
 	fn set_public_access_mode() -> Weight;
@@ -74,12 +73,6 @@
 			.saturating_add(T::DbWeight::get().reads(2 as Weight))
 			.saturating_add(T::DbWeight::get().writes(5 as Weight))
 	}
-
-	fn burn_children_in_collection(max: u32) -> Weight {
-		// TODO
-		(50_000_000 as Weight).saturating_mul(max as Weight)
-	}
-
 	// Storage: Common CollectionById (r:1 w:0)
 	// Storage: Common Allowlist (r:0 w:1)
 	fn add_to_allow_list() -> Weight {
@@ -199,12 +192,6 @@
 			.saturating_add(RocksDbWeight::get().reads(2 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(5 as Weight))
 	}
-
-	fn burn_children_in_collection(max: u32) -> Weight {
-		// TODO
-		(50_000_000 as Weight).saturating_mul(max as Weight)
-	}
-
 	// Storage: Common CollectionById (r:1 w:0)
 	// Storage: Common Allowlist (r:0 w:1)
 	fn add_to_allow_list() -> Weight {
modifiedruntime/common/src/dispatch.rsdiffbeforeafterboth
--- a/runtime/common/src/dispatch.rs
+++ b/runtime/common/src/dispatch.rs
@@ -1,4 +1,4 @@
-use frame_support::{dispatch::{DispatchResult}, ensure};
+use frame_support::{dispatch::DispatchResult, ensure};
 use pallet_evm::PrecompileResult;
 use sp_core::{H160, U256};
 use sp_std::{borrow::ToOwned, vec::Vec};
@@ -12,7 +12,6 @@
 use pallet_refungible::{Pallet as PalletRefungible, RefungibleHandle, erc::RefungibleTokenHandle};
 use up_data_structs::{
 	CollectionMode, CreateCollectionData, MAX_DECIMAL_POINTS, mapping::TokenAddressMapping,
-	budget::Budget,
 };
 
 pub enum CollectionDispatchT<T>
@@ -47,11 +46,7 @@
 		Ok(())
 	}
 
-	fn destroy(
-		sender: T::CrossAccountId,
-		collection: CollectionHandle<T>,
-		nesting_budget: &dyn Budget,
-	) -> DispatchResult {
+	fn destroy(sender: T::CrossAccountId, collection: CollectionHandle<T>) -> DispatchResult {
 		match collection.mode {
 			CollectionMode::ReFungible => {
 				PalletRefungible::destroy_collection(RefungibleHandle::cast(collection), &sender)?
@@ -60,11 +55,7 @@
 				PalletFungible::destroy_collection(FungibleHandle::cast(collection), &sender)?
 			}
 			CollectionMode::NFT => {
-				PalletNonfungible::destroy_collection(
-					NonfungibleHandle::cast(collection),
-					&sender,
-					nesting_budget,
-				)?
+				PalletNonfungible::destroy_collection(NonfungibleHandle::cast(collection), &sender)?
 			}
 		}
 		Ok(())