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
204 misc::CollectionType::Regular,204 misc::CollectionType::Regular,
205 )?;205 )?;
206
207 ensure!(
208 collection.total_supply() == 0,
209 <Error<T>>::CollectionNotEmpty
210 );
211206
212 <PalletNft<T>>::destroy_collection(collection, &cross_sender)207 <PalletNft<T>>::destroy_collection(collection, &cross_sender)
213 .map_err(Self::map_unique_err_to_proxy)?;208 .map_err(Self::map_unique_err_to_proxy)?;
1142 CommonError::PublicMintingNotAllowed => NoPermission,1137 CommonError::PublicMintingNotAllowed => NoPermission,
1143 CommonError::TokenNotFound => NoAvailableNftId,1138 CommonError::TokenNotFound => NoAvailableNftId,
1144 CommonError::ApprovedValueTooLow => NoPermission,1139 CommonError::ApprovedValueTooLow => NoPermission,
1140 CommonError::CantDestroyNotEmptyCollection => CollectionNotEmpty,
1145 StructureError::TokenNotFound => NoAvailableNftId,1141 StructureError::TokenNotFound => NoAvailableNftId,
1146 StructureError::OuroborosDetected => CannotSendToDescendentOrSelf1142 StructureError::OuroborosDetected => CannotSendToDescendentOrSelf,
1147 }1143 }
1148 }1144 }
1149 }1145 }
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()