Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
magecnion committed Oct 11, 2024
1 parent 4fb1746 commit 6fe507a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions xcm-simulator/src/tests/laosish_xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,33 @@ fn xcmp_create_foreign_asset() {
parachain::RuntimeEvent::ForeignAssets(pallet_assets::Event::Created { .. })
)));
});
let withdraw_amount = 123;

Laosish::execute_with(|| {
// let destination = xcm::v3::Location::new(1, [xcm::v3::Junction::Parachain(PARA_B_ID)]); // destination (AssetHub) from source (Laos)
// let beneficiary = xcm::v3::Location::new(0, [xcm::v3::Junction::AccountId32 { network: None, id: ALICE.into() }]); // Address from (AssetHub)
assert_ok!(LaosishPalletXcm::limited_reserve_transfer_assets(
laosish::RuntimeOrigin::signed(ALITH.into()),
Box::new((Parent, Parachain(PARA_B_ID)).into()),
Box::new(AccountId32 { network: None, id: ALICE.into() }.into()),
Box::new(vec![xcm::v3::MultiAsset {id: AssetId(Here.into()).into(), fun: xcm::v3::Fungibility::Fungible(withdraw_amount)}.into()].into()),
// Fee asset item index: 0 (no specific fee asset)
0,
// Weight limit for execution: Unlimited
Unlimited,
));
// Assert that the para B sovereign account has increased by the transferred amount
assert_eq!(
parachain::Balances::free_balance(sibling_account_id(PARA_B_ID)),
INITIAL_BALANCE + withdraw_amount
);
});

ParaB::execute_with(|| {
// Verify that ALICE's balance on Parachain A has increased by the transferred amount
assert_eq!(
pallet_balances::Pallet::<parachain::Runtime>::free_balance(&ALICE),
INITIAL_BALANCE + withdraw_amount
);
});
}

0 comments on commit 6fe507a

Please sign in to comment.