diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs index a5790335dd53a..922b6cbcf93c6 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs @@ -54,6 +54,7 @@ use snowbridge_router_primitives::{ inbound::GlobalConsensusEthereumConvertsFor, outbound::EthereumBlobExporter, }; +use snowbridge_core::outbound::OutboundQueueLocalFee; use sp_core::{Get, H256}; use sp_runtime::traits::AccountIdConversion; use sp_std::marker::PhantomData; @@ -325,6 +326,7 @@ impl xcm_executor::Config for XcmConfig { EthereumNetwork, SnowbridgeTreasuryAccount, Self::AssetTransactor, + crate::EthereumOutboundQueue, >, XcmFeeToAccount, ), @@ -584,15 +586,16 @@ impl< /// A `HandleFee` implementation that takes fees from `ExportMessage` XCM instructions /// to Snowbridge and holds it in a receiver account. Burns the fees in case of a failure. -pub struct XcmExportFeeToSnowbridge( - PhantomData<(EthereumNetwork, ReceiverAccount, AssetTransactor)>, +pub struct XcmExportFeeToSnowbridge( + PhantomData<(EthereumNetwork, ReceiverAccount, AssetTransactor, OutboundQueue)>, ); impl< EthereumNetwork: Get, ReceiverAccount: Get, AssetTransactor: TransactAsset, - > HandleFee for XcmExportFeeToSnowbridge + OutboundQueue: OutboundQueueLocalFee, + > HandleFee for XcmExportFeeToSnowbridge { fn handle_fee( fees: MultiAssets, @@ -608,13 +611,21 @@ impl< ); let receiver = ReceiverAccount::get(); - deposit_or_burn_fee::( - fees, - context, - receiver, - ); - return MultiAssets::new() + if let Some(XcmContext{ origin: Some(origin), ..}) = context { + // There is an origin so split fee into parts. + let local_fee = OutboundQueue::calculate_local_fee(); + + } else { + // There is no context so send the full fee to the receiver + deposit_or_burn_fee::( + fees, + context, + receiver, + ); + } + + return fees; } fees