diff --git a/runtime/astar/src/lib.rs b/runtime/astar/src/lib.rs index 7416768745..98834e4784 100644 --- a/runtime/astar/src/lib.rs +++ b/runtime/astar/src/lib.rs @@ -668,6 +668,18 @@ impl WeightToFeePolynomial for WeightToFee { } } +/// Handles coverting weight consumed by XCM into native currency fee. +/// +/// Similar to standard `WeightToFee` handler, but force uses the minimum multiplier. +pub struct XcmWeightToFee; +impl frame_support::weights::WeightToFee for XcmWeightToFee { + type Balance = Balance; + + fn weight_to_fee(n: &Weight) -> Self::Balance { + MinimumMultiplier::get().saturating_mul_int(WeightToFee::weight_to_fee(&n)) + } +} + pub struct DealWithFees; impl OnUnbalanced for DealWithFees { fn on_unbalanceds(mut fees_then_tips: impl Iterator) { diff --git a/runtime/astar/src/xcm_config.rs b/runtime/astar/src/xcm_config.rs index 62299f6b77..8cc1ba9c06 100644 --- a/runtime/astar/src/xcm_config.rs +++ b/runtime/astar/src/xcm_config.rs @@ -19,7 +19,7 @@ use super::{ AccountId, AllPalletsWithSystem, AssetId, Assets, AstarAssetLocationIdConverter, Balance, Balances, DealWithFees, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, - RuntimeEvent, RuntimeOrigin, TreasuryAccountId, WeightToFee, XcAssetConfig, XcmpQueue, + RuntimeEvent, RuntimeOrigin, TreasuryAccountId, XcAssetConfig, XcmWeightToFee, XcmpQueue, }; use crate::weights; use frame_support::{ @@ -251,7 +251,7 @@ impl xcm_executor::Config for XcmConfig { type Barrier = XcmBarrier; type Weigher = Weigher; type Trader = ( - UsingComponents, + UsingComponents, FixedRateOfForeignAsset, ); type ResponseHandler = PolkadotXcm; diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index 2f80464e8d..b0532f7cc7 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -715,6 +715,18 @@ impl WeightToFeePolynomial for WeightToFee { } } +/// Handles coverting weight consumed by XCM into native currency fee. +/// +/// Similar to standard `WeightToFee` handler, but force uses the minimum multiplier. +pub struct XcmWeightToFee; +impl frame_support::weights::WeightToFee for XcmWeightToFee { + type Balance = Balance; + + fn weight_to_fee(n: &Weight) -> Self::Balance { + MinimumMultiplier::get().saturating_mul_int(WeightToFee::weight_to_fee(&n)) + } +} + pub struct DealWithFees; impl OnUnbalanced for DealWithFees { fn on_unbalanceds(mut fees_then_tips: impl Iterator) { diff --git a/runtime/shibuya/src/xcm_config.rs b/runtime/shibuya/src/xcm_config.rs index 32c66e08af..8a5f5ba881 100644 --- a/runtime/shibuya/src/xcm_config.rs +++ b/runtime/shibuya/src/xcm_config.rs @@ -19,7 +19,7 @@ use super::{ AccountId, AllPalletsWithSystem, AssetId, Assets, Balance, Balances, DealWithFees, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, - ShibuyaAssetLocationIdConverter, TreasuryAccountId, WeightToFee, XcAssetConfig, XcmpQueue, + ShibuyaAssetLocationIdConverter, TreasuryAccountId, XcAssetConfig, XcmWeightToFee, XcmpQueue, }; use crate::weights; use frame_support::{ @@ -185,7 +185,7 @@ impl xcm_executor::Config for XcmConfig { type Barrier = XcmBarrier; type Weigher = Weigher; type Trader = ( - UsingComponents, + UsingComponents, FixedRateOfForeignAsset, ); type ResponseHandler = PolkadotXcm; diff --git a/runtime/shiden/src/lib.rs b/runtime/shiden/src/lib.rs index 52e7134b23..d2a3e2c971 100644 --- a/runtime/shiden/src/lib.rs +++ b/runtime/shiden/src/lib.rs @@ -660,8 +660,20 @@ impl WeightToFeePolynomial for WeightToFee { } } -pub struct BurnFees; -impl OnUnbalanced for BurnFees { +/// Handles coverting weight consumed by XCM into native currency fee. +/// +/// Similar to standard `WeightToFee` handler, but force uses the minimum multiplier. +pub struct XcmWeightToFee; +impl frame_support::weights::WeightToFee for XcmWeightToFee { + type Balance = Balance; + + fn weight_to_fee(n: &Weight) -> Self::Balance { + MinimumMultiplier::get().saturating_mul_int(WeightToFee::weight_to_fee(&n)) + } +} + +pub struct DealWithFees; +impl OnUnbalanced for DealWithFees { /// Payout tips but burn all the fees fn on_unbalanceds(mut fees_then_tips: impl Iterator) { if let Some(fees) = fees_then_tips.next() { @@ -682,7 +694,7 @@ impl OnUnbalanced for BurnFees { impl pallet_transaction_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; + type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; type WeightToFee = WeightToFee; type OperationalFeeMultiplier = OperationalFeeMultiplier; type FeeMultiplierUpdate = TargetedFeeAdjustment< diff --git a/runtime/shiden/src/xcm_config.rs b/runtime/shiden/src/xcm_config.rs index a38ec8091d..b1c512c41f 100644 --- a/runtime/shiden/src/xcm_config.rs +++ b/runtime/shiden/src/xcm_config.rs @@ -17,9 +17,9 @@ // along with Astar. If not, see . use super::{ - AccountId, AllPalletsWithSystem, AssetId, Assets, Balance, Balances, BurnFees, ParachainInfo, - ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, - ShidenAssetLocationIdConverter, TreasuryAccountId, WeightToFee, XcAssetConfig, XcmpQueue, + AccountId, AllPalletsWithSystem, AssetId, Assets, Balance, Balances, DealWithFees, + ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, + ShidenAssetLocationIdConverter, TreasuryAccountId, XcAssetConfig, XcmWeightToFee, XcmpQueue, }; use crate::weights; use frame_support::{ @@ -255,7 +255,7 @@ impl xcm_executor::Config for XcmConfig { type Barrier = XcmBarrier; type Weigher = Weigher; type Trader = ( - UsingComponents, + UsingComponents, FixedRateOfForeignAsset, ); type ResponseHandler = PolkadotXcm;