git.delta.rocks / unique-network / refs/commits / 413ee1397f1d

difftreelog

chore cargo fmt

Grigoriy Simonov2022-09-27parent: #624d281.patch.diff
in: master

4 files changed

modifiedpallets/foreign-assets/src/lib.rsdiffbeforeafterboth

no syntactic changes

modifiedpallets/proxy-rmrk-equip/src/lib.rsdiffbeforeafterboth
--- 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 =
-				<PalletNft<T>>::init_collection(cross_sender.clone(), cross_sender.clone(), data, true);
+			let collection_id_res = <PalletNft<T>>::init_collection(
+				cross_sender.clone(),
+				cross_sender.clone(),
+				data,
+				true,
+			);
 
 			if let Err(DispatchError::Arithmetic(_)) = &collection_id_res {
 				return Err(<Error<T>>::NoAvailableBaseId.into());
modifiedpallets/unique/src/eth/mod.rsdiffbeforeafterboth
--- 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::<T>(value)?;
-	let collection_helpers_address =  T::CrossAccountId::from_eth(<T as pallet_common::Config>::ContractAddress::get());
+	let collection_helpers_address =
+		T::CrossAccountId::from_eth(<T as pallet_common::Config>::ContractAddress::get());
 
-	let collection_id = T::CollectionDispatch::create(caller.clone(), collection_helpers_address, data)
-		.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
+	let collection_id =
+		T::CollectionDispatch::create(caller.clone(), collection_helpers_address, data)
+			.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
 	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::<T>(value)?;
-		let collection_helpers_address =  T::CrossAccountId::from_eth(<T as pallet_common::Config>::ContractAddress::get());
-		let collection_id =
-			T::CollectionDispatch::create(caller, collection_helpers_address, data).map_err(dispatch_to_evm::<T>)?;
+		let collection_helpers_address =
+			T::CrossAccountId::from_eth(<T as pallet_common::Config>::ContractAddress::get());
+		let collection_id = T::CollectionDispatch::create(caller, collection_helpers_address, data)
+			.map_err(dispatch_to_evm::<T>)?;
 
 		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::<T>(value)?;
-		let collection_helpers_address =  T::CrossAccountId::from_eth(<T as pallet_common::Config>::ContractAddress::get());
+		let collection_helpers_address =
+			T::CrossAccountId::from_eth(<T as pallet_common::Config>::ContractAddress::get());
 		let collection_id = T::CollectionDispatch::create(caller, collection_helpers_address, data)
 			.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
 
@@ -317,6 +325,14 @@
 
 		Ok(false)
 	}
+
+	fn collection_creation_fee(&self) -> Result<value> {
+		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`]
modifiedruntime/common/dispatch.rsdiffbeforeafterboth
--- a/runtime/common/dispatch.rs
+++ b/runtime/common/dispatch.rs
@@ -59,7 +59,9 @@
 		data: CreateCollectionData<T::AccountId>,
 	) -> Result<CollectionId, DispatchError> {
 		let id = match data.mode {
-			CollectionMode::NFT => <PalletNonfungible<T>>::init_collection(sender, payer, data, false)?,
+			CollectionMode::NFT => {
+				<PalletNonfungible<T>>::init_collection(sender, payer, data, false)?
+			}
 			CollectionMode::Fungible(decimal_points) => {
 				// check params
 				ensure!(