Skip to content

Commit

Permalink
fix fee manager
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden authored and claravanstaden committed Nov 22, 2023
1 parent 1745236 commit 15da5e1
Showing 1 changed file with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ use xcm_builder::{
ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
XcmFeeManagerFromComponents, XcmFeeToAccount,
XcmFeeToAccount,
};
use xcm_executor::{
traits::{FeeReason, TransactAsset, WithOriginFilter},
traits::{FeeManager, FeeReason, FeeReason::Export, TransactAsset, WithOriginFilter},
XcmExecutor,
};

Expand Down Expand Up @@ -281,7 +281,7 @@ impl xcm_executor::Config for XcmConfig {
type SubscriptionService = PolkadotXcm;
type PalletInstancesInfo = AllPalletsWithSystem;
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type FeeManager = XcmFeeManagerFromComponents<
type FeeManager = XcmFeeManagerFromComponentsBridgeHub<
WaivedLocations,
(
XcmExportFeeToRelayerRewardAccounts<
Expand Down Expand Up @@ -460,6 +460,25 @@ impl<
}
}

pub struct XcmFeeManagerFromComponentsBridgeHub<WaivedLocations, HandleFee>(
PhantomData<(WaivedLocations, HandleFee)>,
);
impl<WaivedLocations: Contains<MultiLocation>, FeeHandler: HandleFee> FeeManager
for XcmFeeManagerFromComponentsBridgeHub<WaivedLocations, FeeHandler>
{
fn is_waived(origin: Option<&MultiLocation>, fee_reason: FeeReason) -> bool {
let Some(loc) = origin else { return false };
if let Export { network: Ethereum { chain_id: 15 }, destination: Here } = fee_reason {
return false
}
WaivedLocations::contains(loc)
}

fn handle_fee(fee: MultiAssets, context: Option<&XcmContext>, reason: FeeReason) {
FeeHandler::handle_fee(fee, context, reason);
}
}

pub struct DoNothingRouter;
impl SendXcm for DoNothingRouter {
type Ticket = ();
Expand Down

0 comments on commit 15da5e1

Please sign in to comment.