From 94717a415be98b51207e8b58ccb207bbc4f3941f Mon Sep 17 00:00:00 2001 From: joepetrowski Date: Thu, 17 Nov 2022 10:41:47 +0100 Subject: [PATCH] fix AssetsToBlockAuthor --- parachains/common/src/impls.rs | 11 ++++++----- parachains/runtimes/assets/westmint/src/lib.rs | 14 ++++++++------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/parachains/common/src/impls.rs b/parachains/common/src/impls.rs index 284a431835..87edb28d9f 100644 --- a/parachains/common/src/impls.rs +++ b/parachains/common/src/impls.rs @@ -71,17 +71,18 @@ where /// A `HandleCredit` implementation that naively transfers the fees to the block author. /// Will drop and burn the assets in case the transfer fails. -pub struct AssetsToBlockAuthor(PhantomData); -impl HandleCredit, pallet_assets::Pallet> for AssetsToBlockAuthor +pub struct AssetsToBlockAuthor(PhantomData<(R, I)>); +impl HandleCredit, pallet_assets::Pallet> for AssetsToBlockAuthor where - R: pallet_authorship::Config + pallet_assets::Config, + I: 'static, + R: pallet_authorship::Config + pallet_assets::Config, AccountIdOf: From + Into, { - fn handle_credit(credit: CreditOf, pallet_assets::Pallet>) { + fn handle_credit(credit: CreditOf, pallet_assets::Pallet>) { if let Some(author) = pallet_authorship::Pallet::::author() { // In case of error: Will drop the result triggering the `OnDrop` of the imbalance. - let _ = pallet_assets::Pallet::::resolve(&author, credit); + let _ = pallet_assets::Pallet::::resolve(&author, credit); } } } diff --git a/parachains/runtimes/assets/westmint/src/lib.rs b/parachains/runtimes/assets/westmint/src/lib.rs index 34d53fb462..a0c225c391 100644 --- a/parachains/runtimes/assets/westmint/src/lib.rs +++ b/parachains/runtimes/assets/westmint/src/lib.rs @@ -535,14 +535,16 @@ impl pallet_collator_selection::Config for Runtime { impl pallet_asset_tx_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; - // TODO + // TODO https://github.com/paritytech/substrate/issues/12724 // This should be able to take assets from any pallet instance. - type Fungibles = (ForeignAssets, TrustBackedAssets); + type Fungibles = TrustBackedAssets; type OnChargeAssetTransaction = pallet_asset_tx_payment::FungiblesAdapter< - ( - ForeignAssets::BalanceToAssetBalance, - TrustBackedAssets::BalanceToAssetBalance, - ), + pallet_assets::BalanceToAssetBalance< + Balances, + Runtime, + ConvertInto, + pallet_assets::Instance1, + >, AssetsToBlockAuthor, >; }