--- a/pallets/proxy-rmrk-core/src/benchmarking.rs +++ b/pallets/proxy-rmrk-core/src/benchmarking.rs @@ -54,16 +54,27 @@ } fn create_max_collection(owner: &T::AccountId) -> DispatchResult { - ::Currency::deposit_creating(owner, T::CollectionCreationPrice::get()); + ::Currency::deposit_creating( + owner, + T::CollectionCreationPrice::get(), + ); let metadata = create_data(); let max = None; let symbol = create_data(); - >::create_collection(RawOrigin::Signed(owner.clone()).into(), metadata, max, symbol) + >::create_collection( + RawOrigin::Signed(owner.clone()).into(), + metadata, + max, + symbol, + ) } -fn create_max_nft(owner: &T::AccountId, collection_id: RmrkCollectionId) -> DispatchResult { +fn create_max_nft( + owner: &T::AccountId, + collection_id: RmrkCollectionId, +) -> DispatchResult { let royalty_recipient = Some(owner.clone()); let royalty_amount = Some(Permill::from_percent(25)); let metadata = create_data(); @@ -76,20 +87,20 @@ royalty_recipient, royalty_amount, metadata, - transferable + transferable, ) } struct NftBuilder { collection_id: RmrkCollectionId, - current_nft_id: RmrkNftId + current_nft_id: RmrkNftId, } impl NftBuilder { fn new(collection_id: RmrkCollectionId) -> Self { Self { collection_id, - current_nft_id: 0 + current_nft_id: 0, } } @@ -100,19 +111,24 @@ Ok(self.current_nft_id) } - fn build_tower(&mut self, owner: &T::AccountId, height: u32) -> Result { + fn build_tower( + &mut self, + owner: &T::AccountId, + height: u32, + ) -> Result { self.build::(owner)?; let mut prev_nft_id = self.current_nft_id; for _ in 0..height { self.build::(owner)?; - - let new_owner = >::CollectionAndNftTuple( - self.collection_id, - prev_nft_id - ); + let new_owner = + >::CollectionAndNftTuple( + self.collection_id, + prev_nft_id, + ); + >::send( RawOrigin::Signed(owner.clone()).into(), self.collection_id, @@ -140,7 +156,7 @@ destroy_collection { let caller = account("caller", 0, SEED); - + create_max_collection::(&caller)?; let collection_id = 0; }: _(RawOrigin::Signed(caller), collection_id) @@ -169,7 +185,7 @@ create_max_collection::(&caller)?; let collection_id = 0; let owner = caller.clone(); - + let royalty_recipient = Some(caller.clone()); let royalty_amount = Some(Permill::from_percent(25)); let metadata = create_data(); --- a/pallets/proxy-rmrk-core/src/lib.rs +++ b/pallets/proxy-rmrk-core/src/lib.rs @@ -693,9 +693,10 @@ let resource_collection_id: Option = Self::get_nft_property_decoded(collection_id, nft_id, ResourceCollection) .map_err(|_| >::ResourceDoesntExist)?; - - let resource_collection_id = resource_collection_id.ok_or(>::ResourceDoesntExist)?; + let resource_collection_id = + resource_collection_id.ok_or(>::ResourceDoesntExist)?; + let is_pending: bool = Self::get_nft_property_decoded( resource_collection_id, resource_id, @@ -755,7 +756,8 @@ Self::get_nft_property_decoded(collection_id, nft_id, ResourceCollection) .map_err(|_| >::ResourceDoesntExist)?; - let resource_collection_id = resource_collection_id.ok_or(>::ResourceDoesntExist)?; + let resource_collection_id = + resource_collection_id.ok_or(>::ResourceDoesntExist)?; let is_pending: bool = Self::get_nft_property_decoded( resource_collection_id, @@ -771,13 +773,17 @@ misc::CollectionType::Resource, )?; - let resource_data = - >::get((resource_collection_id, resource_id)).ok_or(>::ResourceDoesntExist)?; - + let resource_data = >::get((resource_collection_id, resource_id)) + .ok_or(>::ResourceDoesntExist)?; + let resource_owner = resource_data.owner; - >::burn(&resource_collection, &resource_owner, rmrk_resource_id.into()) - .map_err(Self::map_unique_err_to_proxy)?; + >::burn( + &resource_collection, + &resource_owner, + rmrk_resource_id.into(), + ) + .map_err(Self::map_unique_err_to_proxy)?; Self::deposit_event(Event::::ResourceRemovalAccepted { nft_id: rmrk_nft_id, @@ -1188,12 +1194,10 @@ CreateCollectionData { ..Default::default() }, - [ - Self::rmrk_property( - CollectionType, - &misc::CollectionType::Resource, - )? - ] + [Self::rmrk_property( + CollectionType, + &misc::CollectionType::Resource, + )?] .into_iter(), )?; @@ -1201,7 +1205,7 @@ collection_id, token_id, PropertyScope::Rmrk, - Self::rmrk_property(ResourceCollection, &Some(resource_collection_id))? + Self::rmrk_property(ResourceCollection, &Some(resource_collection_id))?, )?; resource_collection_id @@ -1246,8 +1250,9 @@ let resource_collection_id: Option = Self::get_nft_property_decoded(collection_id, nft_id, ResourceCollection)?; - let resource_collection_id = resource_collection_id.ok_or(Error::::ResourceDoesntExist)?; - + let resource_collection_id = + resource_collection_id.ok_or(Error::::ResourceDoesntExist)?; + let resource_collection = Self::get_typed_nft_collection(resource_collection_id, misc::CollectionType::Resource)?; ensure!(