Skip to content

Commit

Permalink
fix bridge test
Browse files Browse the repository at this point in the history
  • Loading branch information
acatangiu committed Sep 30, 2024
1 parent ff433b6 commit b837000
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,9 @@ fn do_send_pens_and_wnds_from_penpal_westend_via_ahw_to_asset_hub_rococo(
AssetHubWestend::force_xcm_version(destination.clone(), XCM_VERSION);
BridgeHubWestend::force_xcm_version(bridge_hub_rococo_location(), XCM_VERSION);

// open bridge
open_bridge_between_asset_hub_rococo_and_asset_hub_westend();

// send message over bridge
assert_ok!(PenpalB::execute_with(|| {
let signed_origin = <PenpalB as Chain>::RuntimeOrigin::signed(PenpalBSender::get());
Expand All @@ -586,17 +589,18 @@ fn do_send_pens_and_wnds_from_penpal_westend_via_ahw_to_asset_hub_rococo(
// XCM to be executed at (intermediary) Westend Asset Hub
let context = PenpalUniversalLocation::get();
let reanchored_dest = destination.clone().reanchored(&local_asset_hub, &context).unwrap();
// Pay up to half the WNDs in fees on AHW
let mut reanchored_wnds = wnds.clone().reanchored(&local_asset_hub, &context).unwrap();
reanchored_wnds.fun = Fungible(wnds_amount / 2);
let reanchored_pens = pens.clone().reanchored(&local_asset_hub, &context).unwrap();
let mut onward_wnds = wnds.clone().reanchored(&local_asset_hub, &context).unwrap();
// reserve 100_000_000_000 WNDs in fees on AHW
// (exec fees: 3_593_000_000, transpo fees: 69_021_561_290 = 72_614_561_290)
// TODO: make this exact once we have PayFees + bridge dry-running
onward_wnds.fun = Fungible(wnds_amount - 100_000_000_000);
let xcm_on_ahw = Xcm(vec![
// both WNDs and PENs are local-reserve transferred to Rococo Asset Hub
InitiateTransfer {
destination: reanchored_dest,
// use up to half the WNDs for fees
remote_fees: Some(AssetTransferFilter::ReserveDeposit(reanchored_wnds.into())),
// transfer everything else (including unspent WNDs) further
assets: vec![AssetTransferFilter::ReserveDeposit(AssetFilter::Wild(All))],
remote_fees: Some(AssetTransferFilter::ReserveDeposit(onward_wnds.into())),
assets: vec![AssetTransferFilter::ReserveDeposit(reanchored_pens.into())],
remote_xcm: xcm_on_dest,
},
]);
Expand Down

0 comments on commit b837000

Please sign in to comment.