git.delta.rocks / unique-network / refs/commits / 866e42a32607

difftreelog

fix(rmrk) map CollectionNotEmpty error

Daniel Shiposha2022-06-05parent: #800b656.patch.diff
in: master

2 files changed

modifiedpallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-core/src/lib.rs
+++ b/pallets/proxy-rmrk-core/src/lib.rs
@@ -204,11 +204,6 @@
 				misc::CollectionType::Regular,
 			)?;
 
-			ensure!(
-				collection.total_supply() == 0,
-				<Error<T>>::CollectionNotEmpty
-			);
-
 			<PalletNft<T>>::destroy_collection(collection, &cross_sender)
 				.map_err(Self::map_unique_err_to_proxy)?;
 
@@ -1142,8 +1137,9 @@
 				CommonError::PublicMintingNotAllowed => NoPermission,
 				CommonError::TokenNotFound => NoAvailableNftId,
 				CommonError::ApprovedValueTooLow => NoPermission,
+				CommonError::CantDestroyNotEmptyCollection => CollectionNotEmpty,
 				StructureError::TokenNotFound => NoAvailableNftId,
-				StructureError::OuroborosDetected => CannotSendToDescendentOrSelf
+				StructureError::OuroborosDetected => CannotSendToDescendentOrSelf,
 			}
 		}
 	}
modifiedpallets/proxy-rmrk-core/src/misc.rsdiffbeforeafterboth
33
4#[macro_export]4#[macro_export]
5macro_rules! map_unique_err_to_proxy {5macro_rules! map_unique_err_to_proxy {
6 (match $err:ident { $($unique_err_ty:ident :: $unique_err:ident => $proxy_err:ident),+ }) => {6 (match $err:ident { $($unique_err_ty:ident :: $unique_err:ident => $proxy_err:ident),+ $(,)? }) => {
7 $(7 $(
8 if $err == <$unique_err_ty<T>>::$unique_err.into() {8 if $err == <$unique_err_ty<T>>::$unique_err.into() {
9 return <Error<T>>::$proxy_err.into()9 return <Error<T>>::$proxy_err.into()