difftreelog
chore cargo fmt
in: master
4 files changed
pallets/foreign-assets/src/lib.rsdiffbeforeafterboth--- 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 = <PalletFungible<T>>::init_foreign_collection(
- owner.clone(),
- owner,
- data,
- )?;
+ let bounded_collection_id =
+ <PalletFungible<T>>::init_foreign_collection(owner.clone(), owner, data)?;
let foreign_asset_id =
Self::do_register_foreign_asset(&location, &metadata, bounded_collection_id)?;
pallets/proxy-rmrk-equip/src/lib.rsdiffbeforeafterbothno syntactic changes
pallets/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`]
runtime/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!(