From 413ee1397f1dc85d06c0cb096a90134733688e37 Mon Sep 17 00:00:00 2001 From: Grigoriy Simonov Date: Tue, 27 Sep 2022 10:13:26 +0000 Subject: [PATCH] chore: cargo fmt --- --- a/pallets/foreign-assets/src/lib.rs +++ b/pallets/foreign-assets/src/lib.rs @@ -310,11 +310,8 @@ ..Default::default() }; let owner = T::CrossAccountId::from_sub(owner); - let bounded_collection_id = >::init_foreign_collection( - owner.clone(), - owner, - data, - )?; + let bounded_collection_id = + >::init_foreign_collection(owner.clone(), owner, data)?; let foreign_asset_id = Self::do_register_foreign_asset(&location, &metadata, bounded_collection_id)?; --- a/pallets/proxy-rmrk-equip/src/lib.rs +++ b/pallets/proxy-rmrk-equip/src/lib.rs @@ -250,8 +250,12 @@ ..Default::default() }; - let collection_id_res = - >::init_collection(cross_sender.clone(), cross_sender.clone(), data, true); + let collection_id_res = >::init_collection( + cross_sender.clone(), + cross_sender.clone(), + data, + true, + ); if let Err(DispatchError::Arithmetic(_)) = &collection_id_res { return Err(>::NoAvailableBaseId.into()); --- a/pallets/unique/src/eth/mod.rs +++ b/pallets/unique/src/eth/mod.rs @@ -174,10 +174,12 @@ add_properties, )?; check_sent_amount_equals_collection_creation_price::(value)?; - let collection_helpers_address = T::CrossAccountId::from_eth(::ContractAddress::get()); + let collection_helpers_address = + T::CrossAccountId::from_eth(::ContractAddress::get()); - let collection_id = T::CollectionDispatch::create(caller.clone(), collection_helpers_address, data) - .map_err(pallet_evm_coder_substrate::dispatch_to_evm::)?; + let collection_id = + T::CollectionDispatch::create(caller.clone(), collection_helpers_address, data) + .map_err(pallet_evm_coder_substrate::dispatch_to_evm::)?; let address = pallet_common::eth::collection_id_to_address(collection_id); Ok(address) } @@ -189,7 +191,11 @@ .map_err(|_| ()) // workaround for `expect` requiring `Debug` trait .expect("Collection creation price should be convertible to u128"); if value != creation_price { - return Err(format!("Sent amount not equals to collection creation price ({0})", creation_price).into()); + return Err(format!( + "Sent amount not equals to collection creation price ({0})", + creation_price + ) + .into()); } Ok(()) } @@ -225,9 +231,10 @@ false, )?; check_sent_amount_equals_collection_creation_price::(value)?; - let collection_helpers_address = T::CrossAccountId::from_eth(::ContractAddress::get()); - let collection_id = - T::CollectionDispatch::create(caller, collection_helpers_address, data).map_err(dispatch_to_evm::)?; + let collection_helpers_address = + T::CrossAccountId::from_eth(::ContractAddress::get()); + let collection_id = T::CollectionDispatch::create(caller, collection_helpers_address, data) + .map_err(dispatch_to_evm::)?; let address = pallet_common::eth::collection_id_to_address(collection_id); Ok(address) @@ -255,7 +262,8 @@ true, )?; check_sent_amount_equals_collection_creation_price::(value)?; - let collection_helpers_address = T::CrossAccountId::from_eth(::ContractAddress::get()); + let collection_helpers_address = + T::CrossAccountId::from_eth(::ContractAddress::get()); let collection_id = T::CollectionDispatch::create(caller, collection_helpers_address, data) .map_err(pallet_evm_coder_substrate::dispatch_to_evm::)?; @@ -317,6 +325,14 @@ Ok(false) } + + fn collection_creation_fee(&self) -> Result { + let price: u128 = T::CollectionCreationPrice::get() + .try_into() + .map_err(|_| ()) // workaround for `expect` requiring `Debug` trait + .expect("Collection creation price should be convertible to u128"); + Ok(price.into()) + } } /// Implements [`OnMethodCall`], which delegates call to [`EvmCollectionHelpers`] --- a/runtime/common/dispatch.rs +++ b/runtime/common/dispatch.rs @@ -59,7 +59,9 @@ data: CreateCollectionData, ) -> Result { let id = match data.mode { - CollectionMode::NFT => >::init_collection(sender, payer, data, false)?, + CollectionMode::NFT => { + >::init_collection(sender, payer, data, false)? + } CollectionMode::Fungible(decimal_points) => { // check params ensure!( -- gitstuff