mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 12:11:02 +00:00
Remove xcm::v3 from assets-common nits (#4037)
This PR mainly removes `xcm::v3` stuff from `assets-common` to make it
more generic and facilitate the transition to newer XCM versions. Some
of the implementations here used hard-coded `xcm::v3::Location`, but now
it's up to the runtime to configure according to its needs.
Additional/consequent changes:
- `penpal` runtime uses now `xcm::latest::Location` for `pallet_assets`
as `AssetId`, because we don't care about migrations here
- it pretty much simplify xcm-emulator integration tests, where we don't
need now a lots of boilerplate conversions:
```
v3::Location::try_from(...).expect("conversion works")`
```
- xcm-emulator tests
- split macro `impl_assets_helpers_for_parachain` to the
`impl_assets_helpers_for_parachain` and
`impl_foreign_assets_helpers_for_parachain` (avoids using hard-coded
`xcm::v3::Location`)
This commit is contained in:
+68
-48
@@ -137,14 +137,13 @@ fn transfer_foreign_assets_from_asset_hub_to_para() {
|
||||
let destination = AssetHubWestend::sibling_location_of(PenpalA::para_id());
|
||||
let sender = AssetHubWestendSender::get();
|
||||
let native_amount_to_send: Balance = ASSET_HUB_WESTEND_ED * 1000;
|
||||
let native_asset_location = v3::Location::try_from(RelayLocation::get()).unwrap();
|
||||
let native_asset_location = RelayLocation::get();
|
||||
let receiver = PenpalAReceiver::get();
|
||||
let assets_owner = PenpalAssetOwner::get();
|
||||
// Foreign asset used: bridged ROC
|
||||
let foreign_amount_to_send = ASSET_HUB_WESTEND_ED * 10_000_000;
|
||||
let roc_at_westend_parachains =
|
||||
v3::Location::new(2, [v3::Junction::GlobalConsensus(v3::NetworkId::Rococo)]);
|
||||
let roc_at_westend_parachains_latest: Location = roc_at_westend_parachains.try_into().unwrap();
|
||||
Location::new(2, [Junction::GlobalConsensus(NetworkId::Rococo)]);
|
||||
|
||||
// Configure destination chain to trust AH as reserve of ROC
|
||||
PenpalA::execute_with(|| {
|
||||
@@ -157,14 +156,14 @@ fn transfer_foreign_assets_from_asset_hub_to_para() {
|
||||
));
|
||||
});
|
||||
PenpalA::force_create_foreign_asset(
|
||||
roc_at_westend_parachains,
|
||||
roc_at_westend_parachains.clone(),
|
||||
assets_owner.clone(),
|
||||
false,
|
||||
ASSET_MIN_BALANCE,
|
||||
vec![],
|
||||
);
|
||||
AssetHubWestend::force_create_foreign_asset(
|
||||
roc_at_westend_parachains,
|
||||
roc_at_westend_parachains.clone().try_into().unwrap(),
|
||||
assets_owner.clone(),
|
||||
false,
|
||||
ASSET_MIN_BALANCE,
|
||||
@@ -172,7 +171,7 @@ fn transfer_foreign_assets_from_asset_hub_to_para() {
|
||||
);
|
||||
AssetHubWestend::mint_foreign_asset(
|
||||
<AssetHubWestend as Chain>::RuntimeOrigin::signed(assets_owner),
|
||||
roc_at_westend_parachains,
|
||||
roc_at_westend_parachains.clone().try_into().unwrap(),
|
||||
sender.clone(),
|
||||
foreign_amount_to_send * 2,
|
||||
);
|
||||
@@ -180,7 +179,7 @@ fn transfer_foreign_assets_from_asset_hub_to_para() {
|
||||
// Assets to send
|
||||
let assets: Vec<Asset> = vec![
|
||||
(Parent, native_amount_to_send).into(),
|
||||
(roc_at_westend_parachains_latest, foreign_amount_to_send).into(),
|
||||
(roc_at_westend_parachains.clone(), foreign_amount_to_send).into(),
|
||||
];
|
||||
let fee_asset_id = AssetId(Parent.into());
|
||||
let fee_asset_item = assets.iter().position(|a| a.id == fee_asset_id).unwrap() as u32;
|
||||
@@ -204,15 +203,18 @@ fn transfer_foreign_assets_from_asset_hub_to_para() {
|
||||
let sender_balance_before = test.sender.balance;
|
||||
let sender_rocs_before = AssetHubWestend::execute_with(|| {
|
||||
type ForeignAssets = <AssetHubWestend as AssetHubWestendPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(roc_at_westend_parachains, &sender)
|
||||
<ForeignAssets as Inspect<_>>::balance(
|
||||
roc_at_westend_parachains.clone().try_into().unwrap(),
|
||||
&sender,
|
||||
)
|
||||
});
|
||||
let receiver_assets_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(native_asset_location.into(), &receiver)
|
||||
<ForeignAssets as Inspect<_>>::balance(native_asset_location.clone(), &receiver)
|
||||
});
|
||||
let receiver_rocs_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(roc_at_westend_parachains, &receiver)
|
||||
<ForeignAssets as Inspect<_>>::balance(roc_at_westend_parachains.clone(), &receiver)
|
||||
});
|
||||
|
||||
// Set assertions and dispatchables
|
||||
@@ -225,7 +227,10 @@ fn transfer_foreign_assets_from_asset_hub_to_para() {
|
||||
let sender_balance_after = test.sender.balance;
|
||||
let sender_rocs_after = AssetHubWestend::execute_with(|| {
|
||||
type ForeignAssets = <AssetHubWestend as AssetHubWestendPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(roc_at_westend_parachains, &sender)
|
||||
<ForeignAssets as Inspect<_>>::balance(
|
||||
roc_at_westend_parachains.clone().try_into().unwrap(),
|
||||
&sender,
|
||||
)
|
||||
});
|
||||
let receiver_assets_after = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
@@ -262,14 +267,13 @@ fn transfer_foreign_assets_from_para_to_asset_hub() {
|
||||
let destination = PenpalA::sibling_location_of(AssetHubWestend::para_id());
|
||||
let sender = PenpalASender::get();
|
||||
let native_amount_to_send: Balance = ASSET_HUB_WESTEND_ED * 10000;
|
||||
let native_asset_location = v3::Location::try_from(RelayLocation::get()).unwrap();
|
||||
let native_asset_location = RelayLocation::get();
|
||||
let assets_owner = PenpalAssetOwner::get();
|
||||
|
||||
// Foreign asset used: bridged ROC
|
||||
let foreign_amount_to_send = ASSET_HUB_WESTEND_ED * 10_000_000;
|
||||
let roc_at_westend_parachains =
|
||||
v3::Location::new(2, [v3::Junction::GlobalConsensus(v3::NetworkId::Rococo)]);
|
||||
let roc_at_westend_parachains_latest: Location = roc_at_westend_parachains.try_into().unwrap();
|
||||
Location::new(2, [Junction::GlobalConsensus(NetworkId::Rococo)]);
|
||||
|
||||
// Configure destination chain to trust AH as reserve of ROC
|
||||
PenpalA::execute_with(|| {
|
||||
@@ -282,14 +286,14 @@ fn transfer_foreign_assets_from_para_to_asset_hub() {
|
||||
));
|
||||
});
|
||||
PenpalA::force_create_foreign_asset(
|
||||
roc_at_westend_parachains,
|
||||
roc_at_westend_parachains.clone(),
|
||||
assets_owner.clone(),
|
||||
false,
|
||||
ASSET_MIN_BALANCE,
|
||||
vec![],
|
||||
);
|
||||
AssetHubWestend::force_create_foreign_asset(
|
||||
roc_at_westend_parachains,
|
||||
roc_at_westend_parachains.clone().try_into().unwrap(),
|
||||
assets_owner.clone(),
|
||||
false,
|
||||
ASSET_MIN_BALANCE,
|
||||
@@ -299,13 +303,13 @@ fn transfer_foreign_assets_from_para_to_asset_hub() {
|
||||
// fund Parachain's sender account
|
||||
PenpalA::mint_foreign_asset(
|
||||
<PenpalA as Chain>::RuntimeOrigin::signed(assets_owner.clone()),
|
||||
native_asset_location,
|
||||
native_asset_location.clone(),
|
||||
sender.clone(),
|
||||
native_amount_to_send * 2,
|
||||
);
|
||||
PenpalA::mint_foreign_asset(
|
||||
<PenpalA as Chain>::RuntimeOrigin::signed(assets_owner.clone()),
|
||||
roc_at_westend_parachains,
|
||||
roc_at_westend_parachains.clone(),
|
||||
sender.clone(),
|
||||
foreign_amount_to_send * 2,
|
||||
);
|
||||
@@ -323,7 +327,7 @@ fn transfer_foreign_assets_from_para_to_asset_hub() {
|
||||
)]);
|
||||
AssetHubWestend::mint_foreign_asset(
|
||||
<AssetHubWestend as Chain>::RuntimeOrigin::signed(assets_owner),
|
||||
roc_at_westend_parachains,
|
||||
roc_at_westend_parachains.clone().try_into().unwrap(),
|
||||
sov_penpal_on_ahr,
|
||||
foreign_amount_to_send * 2,
|
||||
);
|
||||
@@ -331,7 +335,7 @@ fn transfer_foreign_assets_from_para_to_asset_hub() {
|
||||
// Assets to send
|
||||
let assets: Vec<Asset> = vec![
|
||||
(Parent, native_amount_to_send).into(),
|
||||
(roc_at_westend_parachains_latest, foreign_amount_to_send).into(),
|
||||
(roc_at_westend_parachains.clone(), foreign_amount_to_send).into(),
|
||||
];
|
||||
let fee_asset_id = AssetId(Parent.into());
|
||||
let fee_asset_item = assets.iter().position(|a| a.id == fee_asset_id).unwrap() as u32;
|
||||
@@ -354,16 +358,19 @@ fn transfer_foreign_assets_from_para_to_asset_hub() {
|
||||
// Query initial balances
|
||||
let sender_native_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(native_asset_location, &sender)
|
||||
<ForeignAssets as Inspect<_>>::balance(native_asset_location.clone(), &sender)
|
||||
});
|
||||
let sender_rocs_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(roc_at_westend_parachains, &sender)
|
||||
<ForeignAssets as Inspect<_>>::balance(roc_at_westend_parachains.clone(), &sender)
|
||||
});
|
||||
let receiver_native_before = test.receiver.balance;
|
||||
let receiver_rocs_before = AssetHubWestend::execute_with(|| {
|
||||
type ForeignAssets = <AssetHubWestend as AssetHubWestendPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(roc_at_westend_parachains, &receiver)
|
||||
<ForeignAssets as Inspect<_>>::balance(
|
||||
roc_at_westend_parachains.clone().try_into().unwrap(),
|
||||
&receiver,
|
||||
)
|
||||
});
|
||||
|
||||
// Set assertions and dispatchables
|
||||
@@ -379,12 +386,15 @@ fn transfer_foreign_assets_from_para_to_asset_hub() {
|
||||
});
|
||||
let sender_rocs_after = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(roc_at_westend_parachains, &sender)
|
||||
<ForeignAssets as Inspect<_>>::balance(roc_at_westend_parachains.clone(), &sender)
|
||||
});
|
||||
let receiver_native_after = test.receiver.balance;
|
||||
let receiver_rocs_after = AssetHubWestend::execute_with(|| {
|
||||
type ForeignAssets = <AssetHubWestend as AssetHubWestendPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(roc_at_westend_parachains, &receiver)
|
||||
<ForeignAssets as Inspect<_>>::balance(
|
||||
roc_at_westend_parachains.try_into().unwrap(),
|
||||
&receiver,
|
||||
)
|
||||
});
|
||||
|
||||
// Sender's balance is reduced by amount sent plus delivery fees
|
||||
@@ -413,8 +423,7 @@ fn transfer_foreign_assets_from_para_to_para_through_asset_hub() {
|
||||
let sender = PenpalASender::get();
|
||||
let wnd_to_send: Balance = WESTEND_ED * 10000;
|
||||
let assets_owner = PenpalAssetOwner::get();
|
||||
let wnd_location = v3::Location::try_from(RelayLocation::get()).unwrap();
|
||||
let wnd_location_latest: Location = wnd_location.try_into().unwrap();
|
||||
let wnd_location = RelayLocation::get();
|
||||
let sender_as_seen_by_ah = AssetHubWestend::sibling_location_of(PenpalA::para_id());
|
||||
let sov_of_sender_on_ah = AssetHubWestend::sovereign_account_id_of(sender_as_seen_by_ah);
|
||||
let receiver_as_seen_by_ah = AssetHubWestend::sibling_location_of(PenpalB::para_id());
|
||||
@@ -434,24 +443,23 @@ fn transfer_foreign_assets_from_para_to_para_through_asset_hub() {
|
||||
|
||||
// Register ROC as foreign asset and transfer it around the Westend ecosystem
|
||||
let roc_at_westend_parachains =
|
||||
v3::Location::new(2, [v3::Junction::GlobalConsensus(v3::NetworkId::Rococo)]);
|
||||
let roc_at_westend_parachains_latest: Location = roc_at_westend_parachains.try_into().unwrap();
|
||||
Location::new(2, [Junction::GlobalConsensus(NetworkId::Rococo)]);
|
||||
AssetHubWestend::force_create_foreign_asset(
|
||||
roc_at_westend_parachains,
|
||||
roc_at_westend_parachains.clone().try_into().unwrap(),
|
||||
assets_owner.clone(),
|
||||
false,
|
||||
ASSET_MIN_BALANCE,
|
||||
vec![],
|
||||
);
|
||||
PenpalA::force_create_foreign_asset(
|
||||
roc_at_westend_parachains,
|
||||
roc_at_westend_parachains.clone(),
|
||||
assets_owner.clone(),
|
||||
false,
|
||||
ASSET_MIN_BALANCE,
|
||||
vec![],
|
||||
);
|
||||
PenpalB::force_create_foreign_asset(
|
||||
roc_at_westend_parachains,
|
||||
roc_at_westend_parachains.clone(),
|
||||
assets_owner.clone(),
|
||||
false,
|
||||
ASSET_MIN_BALANCE,
|
||||
@@ -461,13 +469,13 @@ fn transfer_foreign_assets_from_para_to_para_through_asset_hub() {
|
||||
// fund Parachain's sender account
|
||||
PenpalA::mint_foreign_asset(
|
||||
<PenpalA as Chain>::RuntimeOrigin::signed(assets_owner.clone()),
|
||||
wnd_location,
|
||||
wnd_location.clone(),
|
||||
sender.clone(),
|
||||
wnd_to_send * 2,
|
||||
);
|
||||
PenpalA::mint_foreign_asset(
|
||||
<PenpalA as Chain>::RuntimeOrigin::signed(assets_owner.clone()),
|
||||
roc_at_westend_parachains,
|
||||
roc_at_westend_parachains.clone(),
|
||||
sender.clone(),
|
||||
roc_to_send * 2,
|
||||
);
|
||||
@@ -475,7 +483,7 @@ fn transfer_foreign_assets_from_para_to_para_through_asset_hub() {
|
||||
AssetHubWestend::fund_accounts(vec![(sov_of_sender_on_ah.clone().into(), wnd_to_send * 2)]);
|
||||
AssetHubWestend::mint_foreign_asset(
|
||||
<AssetHubWestend as Chain>::RuntimeOrigin::signed(assets_owner),
|
||||
roc_at_westend_parachains,
|
||||
roc_at_westend_parachains.clone().try_into().unwrap(),
|
||||
sov_of_sender_on_ah.clone(),
|
||||
roc_to_send * 2,
|
||||
);
|
||||
@@ -485,10 +493,10 @@ fn transfer_foreign_assets_from_para_to_para_through_asset_hub() {
|
||||
|
||||
// Assets to send
|
||||
let assets: Vec<Asset> = vec![
|
||||
(wnd_location_latest.clone(), wnd_to_send).into(),
|
||||
(roc_at_westend_parachains_latest, roc_to_send).into(),
|
||||
(wnd_location.clone(), wnd_to_send).into(),
|
||||
(roc_at_westend_parachains.clone(), roc_to_send).into(),
|
||||
];
|
||||
let fee_asset_id: AssetId = wnd_location_latest.into();
|
||||
let fee_asset_id: AssetId = wnd_location.clone().into();
|
||||
let fee_asset_item = assets.iter().position(|a| a.id == fee_asset_id).unwrap() as u32;
|
||||
|
||||
// Init Test
|
||||
@@ -509,31 +517,37 @@ fn transfer_foreign_assets_from_para_to_para_through_asset_hub() {
|
||||
// Query initial balances
|
||||
let sender_wnds_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(wnd_location, &sender)
|
||||
<ForeignAssets as Inspect<_>>::balance(wnd_location.clone(), &sender)
|
||||
});
|
||||
let sender_rocs_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(roc_at_westend_parachains, &sender)
|
||||
<ForeignAssets as Inspect<_>>::balance(roc_at_westend_parachains.clone(), &sender)
|
||||
});
|
||||
let wnds_in_sender_reserve_on_ah_before =
|
||||
<AssetHubWestend as Chain>::account_data_of(sov_of_sender_on_ah.clone()).free;
|
||||
let rocs_in_sender_reserve_on_ah_before = AssetHubWestend::execute_with(|| {
|
||||
type Assets = <AssetHubWestend as AssetHubWestendPallet>::ForeignAssets;
|
||||
<Assets as Inspect<_>>::balance(roc_at_westend_parachains, &sov_of_sender_on_ah)
|
||||
<Assets as Inspect<_>>::balance(
|
||||
roc_at_westend_parachains.clone().try_into().unwrap(),
|
||||
&sov_of_sender_on_ah,
|
||||
)
|
||||
});
|
||||
let wnds_in_receiver_reserve_on_ah_before =
|
||||
<AssetHubWestend as Chain>::account_data_of(sov_of_receiver_on_ah.clone()).free;
|
||||
let rocs_in_receiver_reserve_on_ah_before = AssetHubWestend::execute_with(|| {
|
||||
type Assets = <AssetHubWestend as AssetHubWestendPallet>::ForeignAssets;
|
||||
<Assets as Inspect<_>>::balance(roc_at_westend_parachains, &sov_of_receiver_on_ah)
|
||||
<Assets as Inspect<_>>::balance(
|
||||
roc_at_westend_parachains.clone().try_into().unwrap(),
|
||||
&sov_of_receiver_on_ah,
|
||||
)
|
||||
});
|
||||
let receiver_wnds_before = PenpalB::execute_with(|| {
|
||||
type ForeignAssets = <PenpalB as PenpalBPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(wnd_location, &receiver)
|
||||
<ForeignAssets as Inspect<_>>::balance(wnd_location.clone(), &receiver)
|
||||
});
|
||||
let receiver_rocs_before = PenpalB::execute_with(|| {
|
||||
type ForeignAssets = <PenpalB as PenpalBPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(roc_at_westend_parachains, &receiver)
|
||||
<ForeignAssets as Inspect<_>>::balance(roc_at_westend_parachains.clone(), &receiver)
|
||||
});
|
||||
|
||||
// Set assertions and dispatchables
|
||||
@@ -546,21 +560,27 @@ fn transfer_foreign_assets_from_para_to_para_through_asset_hub() {
|
||||
// Query final balances
|
||||
let sender_wnds_after = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(wnd_location, &sender)
|
||||
<ForeignAssets as Inspect<_>>::balance(wnd_location.clone(), &sender)
|
||||
});
|
||||
let sender_rocs_after = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(roc_at_westend_parachains, &sender)
|
||||
<ForeignAssets as Inspect<_>>::balance(roc_at_westend_parachains.clone(), &sender)
|
||||
});
|
||||
let rocs_in_sender_reserve_on_ah_after = AssetHubWestend::execute_with(|| {
|
||||
type Assets = <AssetHubWestend as AssetHubWestendPallet>::ForeignAssets;
|
||||
<Assets as Inspect<_>>::balance(roc_at_westend_parachains, &sov_of_sender_on_ah)
|
||||
<Assets as Inspect<_>>::balance(
|
||||
roc_at_westend_parachains.clone().try_into().unwrap(),
|
||||
&sov_of_sender_on_ah,
|
||||
)
|
||||
});
|
||||
let wnds_in_sender_reserve_on_ah_after =
|
||||
<AssetHubWestend as Chain>::account_data_of(sov_of_sender_on_ah).free;
|
||||
let rocs_in_receiver_reserve_on_ah_after = AssetHubWestend::execute_with(|| {
|
||||
type Assets = <AssetHubWestend as AssetHubWestendPallet>::ForeignAssets;
|
||||
<Assets as Inspect<_>>::balance(roc_at_westend_parachains, &sov_of_receiver_on_ah)
|
||||
<Assets as Inspect<_>>::balance(
|
||||
roc_at_westend_parachains.clone().try_into().unwrap(),
|
||||
&sov_of_receiver_on_ah,
|
||||
)
|
||||
});
|
||||
let wnds_in_receiver_reserve_on_ah_after =
|
||||
<AssetHubWestend as Chain>::account_data_of(sov_of_receiver_on_ah).free;
|
||||
|
||||
+39
-41
@@ -47,7 +47,7 @@ fn para_to_relay_sender_assertions(t: ParaToRelayTest) {
|
||||
RuntimeEvent::ForeignAssets(
|
||||
pallet_assets::Event::Burned { asset_id, owner, balance, .. }
|
||||
) => {
|
||||
asset_id: *asset_id == v3::Location::try_from(RelayLocation::get()).unwrap(),
|
||||
asset_id: *asset_id == RelayLocation::get(),
|
||||
owner: *owner == t.sender.account_id,
|
||||
balance: *balance == t.args.amount,
|
||||
},
|
||||
@@ -106,6 +106,7 @@ pub fn system_para_to_para_sender_assertions(t: SystemParaToParaTest) {
|
||||
|
||||
pub fn system_para_to_para_receiver_assertions(t: SystemParaToParaTest) {
|
||||
type RuntimeEvent = <PenpalA as Chain>::RuntimeEvent;
|
||||
|
||||
PenpalA::assert_xcmp_queue_success(None);
|
||||
for asset in t.args.assets.into_inner().into_iter() {
|
||||
let expected_id = asset.id.0.try_into().unwrap();
|
||||
@@ -125,7 +126,7 @@ pub fn para_to_system_para_sender_assertions(t: ParaToSystemParaTest) {
|
||||
type RuntimeEvent = <PenpalA as Chain>::RuntimeEvent;
|
||||
PenpalA::assert_xcm_pallet_attempted_complete(None);
|
||||
for asset in t.args.assets.into_inner().into_iter() {
|
||||
let expected_id = asset.id.0.try_into().unwrap();
|
||||
let expected_id = asset.id.0;
|
||||
let asset_amount = if let Fungible(a) = asset.fun { Some(a) } else { None }.unwrap();
|
||||
assert_expected_events!(
|
||||
PenpalA,
|
||||
@@ -265,9 +266,8 @@ fn system_para_to_para_assets_sender_assertions(t: SystemParaToParaTest) {
|
||||
|
||||
fn para_to_system_para_assets_sender_assertions(t: ParaToSystemParaTest) {
|
||||
type RuntimeEvent = <PenpalA as Chain>::RuntimeEvent;
|
||||
let system_para_native_asset_location = v3::Location::try_from(RelayLocation::get()).unwrap();
|
||||
let reservable_asset_location =
|
||||
v3::Location::try_from(PenpalLocalReservableFromAssetHub::get()).unwrap();
|
||||
let system_para_native_asset_location = RelayLocation::get();
|
||||
let reservable_asset_location = PenpalLocalReservableFromAssetHub::get();
|
||||
PenpalA::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(864_610_000, 8799)));
|
||||
assert_expected_events!(
|
||||
PenpalA,
|
||||
@@ -297,14 +297,13 @@ fn para_to_system_para_assets_sender_assertions(t: ParaToSystemParaTest) {
|
||||
|
||||
fn system_para_to_para_assets_receiver_assertions(t: SystemParaToParaTest) {
|
||||
type RuntimeEvent = <PenpalA as Chain>::RuntimeEvent;
|
||||
let system_para_asset_location =
|
||||
v3::Location::try_from(PenpalLocalReservableFromAssetHub::get()).unwrap();
|
||||
let system_para_asset_location = PenpalLocalReservableFromAssetHub::get();
|
||||
PenpalA::assert_xcmp_queue_success(None);
|
||||
assert_expected_events!(
|
||||
PenpalA,
|
||||
vec![
|
||||
RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, .. }) => {
|
||||
asset_id: *asset_id == v3::Location::try_from(RelayLocation::get()).unwrap(),
|
||||
asset_id: *asset_id == RelayLocation::get(),
|
||||
owner: *owner == t.receiver.account_id,
|
||||
},
|
||||
RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, amount }) => {
|
||||
@@ -356,7 +355,7 @@ fn relay_to_para_assets_receiver_assertions(t: RelayToParaTest) {
|
||||
PenpalA,
|
||||
vec![
|
||||
RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, .. }) => {
|
||||
asset_id: *asset_id == v3::Location::try_from(RelayLocation::get()).unwrap(),
|
||||
asset_id: *asset_id == RelayLocation::get(),
|
||||
owner: *owner == t.receiver.account_id,
|
||||
},
|
||||
RuntimeEvent::MessageQueue(
|
||||
@@ -576,7 +575,7 @@ fn reserve_transfer_native_asset_from_relay_to_para() {
|
||||
let amount_to_send: Balance = WESTEND_ED * 1000;
|
||||
|
||||
// Init values fot Parachain
|
||||
let relay_native_asset_location = v3::Location::try_from(RelayLocation::get()).unwrap();
|
||||
let relay_native_asset_location = RelayLocation::get();
|
||||
let receiver = PenpalAReceiver::get();
|
||||
|
||||
// Init Test
|
||||
@@ -591,7 +590,7 @@ fn reserve_transfer_native_asset_from_relay_to_para() {
|
||||
let sender_balance_before = test.sender.balance;
|
||||
let receiver_assets_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(relay_native_asset_location.into(), &receiver)
|
||||
<ForeignAssets as Inspect<_>>::balance(relay_native_asset_location.clone(), &receiver)
|
||||
});
|
||||
|
||||
// Set assertions and dispatchables
|
||||
@@ -604,7 +603,7 @@ fn reserve_transfer_native_asset_from_relay_to_para() {
|
||||
let sender_balance_after = test.sender.balance;
|
||||
let receiver_assets_after = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(relay_native_asset_location.into(), &receiver)
|
||||
<ForeignAssets as Inspect<_>>::balance(relay_native_asset_location, &receiver)
|
||||
});
|
||||
|
||||
// Sender's balance is reduced by amount sent plus delivery fees
|
||||
@@ -626,12 +625,12 @@ fn reserve_transfer_native_asset_from_para_to_relay() {
|
||||
let amount_to_send: Balance = WESTEND_ED * 1000;
|
||||
let assets: Assets = (Parent, amount_to_send).into();
|
||||
let asset_owner = PenpalAssetOwner::get();
|
||||
let relay_native_asset_location = v3::Location::try_from(RelayLocation::get()).unwrap();
|
||||
let relay_native_asset_location = RelayLocation::get();
|
||||
|
||||
// fund Parachain's sender account
|
||||
PenpalA::mint_foreign_asset(
|
||||
<PenpalA as Chain>::RuntimeOrigin::signed(asset_owner),
|
||||
relay_native_asset_location,
|
||||
relay_native_asset_location.clone(),
|
||||
sender.clone(),
|
||||
amount_to_send * 2,
|
||||
);
|
||||
@@ -662,7 +661,7 @@ fn reserve_transfer_native_asset_from_para_to_relay() {
|
||||
// Query initial balances
|
||||
let sender_assets_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(relay_native_asset_location.into(), &sender)
|
||||
<ForeignAssets as Inspect<_>>::balance(relay_native_asset_location.clone(), &sender)
|
||||
});
|
||||
let receiver_balance_before = test.receiver.balance;
|
||||
|
||||
@@ -675,7 +674,7 @@ fn reserve_transfer_native_asset_from_para_to_relay() {
|
||||
// Query final balances
|
||||
let sender_assets_after = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(relay_native_asset_location.into(), &sender)
|
||||
<ForeignAssets as Inspect<_>>::balance(relay_native_asset_location, &sender)
|
||||
});
|
||||
let receiver_balance_after = test.receiver.balance;
|
||||
|
||||
@@ -702,7 +701,7 @@ fn reserve_transfer_native_asset_from_system_para_to_para() {
|
||||
let assets: Assets = (Parent, amount_to_send).into();
|
||||
|
||||
// Init values for Parachain
|
||||
let system_para_native_asset_location = v3::Location::try_from(RelayLocation::get()).unwrap();
|
||||
let system_para_native_asset_location = RelayLocation::get();
|
||||
let receiver = PenpalAReceiver::get();
|
||||
|
||||
// Init Test
|
||||
@@ -724,7 +723,7 @@ fn reserve_transfer_native_asset_from_system_para_to_para() {
|
||||
let sender_balance_before = test.sender.balance;
|
||||
let receiver_assets_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(system_para_native_asset_location.into(), &receiver)
|
||||
<ForeignAssets as Inspect<_>>::balance(system_para_native_asset_location.clone(), &receiver)
|
||||
});
|
||||
|
||||
// Set assertions and dispatchables
|
||||
@@ -758,13 +757,13 @@ fn reserve_transfer_native_asset_from_para_to_system_para() {
|
||||
let sender = PenpalASender::get();
|
||||
let amount_to_send: Balance = ASSET_HUB_WESTEND_ED * 1000;
|
||||
let assets: Assets = (Parent, amount_to_send).into();
|
||||
let system_para_native_asset_location = v3::Location::try_from(RelayLocation::get()).unwrap();
|
||||
let system_para_native_asset_location = RelayLocation::get();
|
||||
let asset_owner = PenpalAssetOwner::get();
|
||||
|
||||
// fund Parachain's sender account
|
||||
PenpalA::mint_foreign_asset(
|
||||
<PenpalA as Chain>::RuntimeOrigin::signed(asset_owner),
|
||||
system_para_native_asset_location,
|
||||
system_para_native_asset_location.clone(),
|
||||
sender.clone(),
|
||||
amount_to_send * 2,
|
||||
);
|
||||
@@ -796,7 +795,7 @@ fn reserve_transfer_native_asset_from_para_to_system_para() {
|
||||
// Query initial balances
|
||||
let sender_assets_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(system_para_native_asset_location, &sender)
|
||||
<ForeignAssets as Inspect<_>>::balance(system_para_native_asset_location.clone(), &sender)
|
||||
});
|
||||
let receiver_balance_before = test.receiver.balance;
|
||||
|
||||
@@ -864,9 +863,8 @@ fn reserve_transfer_assets_from_system_para_to_para() {
|
||||
|
||||
// Init values for Parachain
|
||||
let receiver = PenpalAReceiver::get();
|
||||
let system_para_native_asset_location = v3::Location::try_from(RelayLocation::get()).unwrap();
|
||||
let system_para_foreign_asset_location =
|
||||
v3::Location::try_from(PenpalLocalReservableFromAssetHub::get()).unwrap();
|
||||
let system_para_native_asset_location = RelayLocation::get();
|
||||
let system_para_foreign_asset_location = PenpalLocalReservableFromAssetHub::get();
|
||||
|
||||
// Init Test
|
||||
let para_test_args = TestContext {
|
||||
@@ -891,11 +889,14 @@ fn reserve_transfer_assets_from_system_para_to_para() {
|
||||
});
|
||||
let receiver_system_native_assets_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(system_para_native_asset_location, &receiver)
|
||||
<ForeignAssets as Inspect<_>>::balance(system_para_native_asset_location.clone(), &receiver)
|
||||
});
|
||||
let receiver_foreign_assets_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(system_para_foreign_asset_location, &receiver)
|
||||
<ForeignAssets as Inspect<_>>::balance(
|
||||
system_para_foreign_asset_location.clone(),
|
||||
&receiver,
|
||||
)
|
||||
});
|
||||
|
||||
// Set assertions and dispatchables
|
||||
@@ -950,13 +951,11 @@ fn reserve_transfer_assets_from_para_to_system_para() {
|
||||
let asset_amount_to_send = ASSET_HUB_WESTEND_ED * 100;
|
||||
let penpal_asset_owner = PenpalAssetOwner::get();
|
||||
let penpal_asset_owner_signer = <PenpalA as Chain>::RuntimeOrigin::signed(penpal_asset_owner);
|
||||
let asset_location_on_penpal =
|
||||
v3::Location::try_from(PenpalLocalReservableFromAssetHub::get()).unwrap();
|
||||
let asset_location_on_penpal_latest: Location = asset_location_on_penpal.try_into().unwrap();
|
||||
let system_asset_location_on_penpal = v3::Location::try_from(RelayLocation::get()).unwrap();
|
||||
let asset_location_on_penpal = PenpalLocalReservableFromAssetHub::get();
|
||||
let system_asset_location_on_penpal = RelayLocation::get();
|
||||
let assets: Assets = vec![
|
||||
(Parent, fee_amount_to_send).into(),
|
||||
(asset_location_on_penpal_latest, asset_amount_to_send).into(),
|
||||
(asset_location_on_penpal.clone(), asset_amount_to_send).into(),
|
||||
]
|
||||
.into();
|
||||
let fee_asset_index = assets
|
||||
@@ -984,9 +983,8 @@ fn reserve_transfer_assets_from_para_to_system_para() {
|
||||
let penpal_location_as_seen_by_ahr = AssetHubWestend::sibling_location_of(PenpalA::para_id());
|
||||
let sov_penpal_on_ahr =
|
||||
AssetHubWestend::sovereign_account_id_of(penpal_location_as_seen_by_ahr);
|
||||
let system_para_native_asset_location = v3::Location::try_from(RelayLocation::get()).unwrap();
|
||||
let system_para_foreign_asset_location =
|
||||
v3::Location::try_from(PenpalLocalReservableFromAssetHub::get()).unwrap();
|
||||
let system_para_native_asset_location = RelayLocation::get();
|
||||
let system_para_foreign_asset_location = PenpalLocalReservableFromAssetHub::get();
|
||||
let ah_asset_owner = AssetHubWestendAssetOwner::get();
|
||||
let ah_asset_owner_signer = <AssetHubWestend as Chain>::RuntimeOrigin::signed(ah_asset_owner);
|
||||
|
||||
@@ -1021,11 +1019,11 @@ fn reserve_transfer_assets_from_para_to_system_para() {
|
||||
// Query initial balances
|
||||
let sender_system_assets_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(system_para_native_asset_location, &sender)
|
||||
<ForeignAssets as Inspect<_>>::balance(system_para_native_asset_location.clone(), &sender)
|
||||
});
|
||||
let sender_foreign_assets_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(system_para_foreign_asset_location, &sender)
|
||||
<ForeignAssets as Inspect<_>>::balance(system_para_foreign_asset_location.clone(), &sender)
|
||||
});
|
||||
let receiver_balance_before = test.receiver.balance;
|
||||
let receiver_assets_before = AssetHubWestend::execute_with(|| {
|
||||
@@ -1081,14 +1079,14 @@ fn reserve_transfer_native_asset_from_para_to_para_through_relay() {
|
||||
let amount_to_send: Balance = WESTEND_ED * 10000;
|
||||
let asset_owner = PenpalAssetOwner::get();
|
||||
let assets = (Parent, amount_to_send).into();
|
||||
let relay_native_asset_location = v3::Location::try_from(RelayLocation::get()).unwrap();
|
||||
let relay_native_asset_location = RelayLocation::get();
|
||||
let sender_as_seen_by_relay = Westend::child_location_of(PenpalA::para_id());
|
||||
let sov_of_sender_on_relay = Westend::sovereign_account_id_of(sender_as_seen_by_relay);
|
||||
|
||||
// fund Parachain's sender account
|
||||
PenpalA::mint_foreign_asset(
|
||||
<PenpalA as Chain>::RuntimeOrigin::signed(asset_owner),
|
||||
relay_native_asset_location,
|
||||
relay_native_asset_location.clone(),
|
||||
sender.clone(),
|
||||
amount_to_send * 2,
|
||||
);
|
||||
@@ -1110,11 +1108,11 @@ fn reserve_transfer_native_asset_from_para_to_para_through_relay() {
|
||||
// Query initial balances
|
||||
let sender_assets_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(relay_native_asset_location, &sender)
|
||||
<ForeignAssets as Inspect<_>>::balance(relay_native_asset_location.clone(), &sender)
|
||||
});
|
||||
let receiver_assets_before = PenpalB::execute_with(|| {
|
||||
type ForeignAssets = <PenpalB as PenpalBPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(relay_native_asset_location, &receiver)
|
||||
<ForeignAssets as Inspect<_>>::balance(relay_native_asset_location.clone(), &receiver)
|
||||
});
|
||||
|
||||
// Set assertions and dispatchables
|
||||
@@ -1127,7 +1125,7 @@ fn reserve_transfer_native_asset_from_para_to_para_through_relay() {
|
||||
// Query final balances
|
||||
let sender_assets_after = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(relay_native_asset_location, &sender)
|
||||
<ForeignAssets as Inspect<_>>::balance(relay_native_asset_location.clone(), &sender)
|
||||
});
|
||||
let receiver_assets_after = PenpalB::execute_with(|| {
|
||||
type ForeignAssets = <PenpalB as PenpalBPallet>::ForeignAssets;
|
||||
|
||||
+12
-9
@@ -17,7 +17,10 @@ use crate::imports::*;
|
||||
|
||||
#[test]
|
||||
fn swap_locally_on_chain_using_local_assets() {
|
||||
let asset_native = Box::new(asset_hub_westend_runtime::xcm_config::WestendLocationV3::get());
|
||||
let asset_native = Box::new(
|
||||
v3::Location::try_from(asset_hub_westend_runtime::xcm_config::WestendLocation::get())
|
||||
.expect("conversion works"),
|
||||
);
|
||||
let asset_one = Box::new(v3::Location {
|
||||
parents: 0,
|
||||
interior: [
|
||||
@@ -226,11 +229,9 @@ fn swap_locally_on_chain_using_foreign_assets() {
|
||||
|
||||
#[test]
|
||||
fn cannot_create_pool_from_pool_assets() {
|
||||
let asset_native = Box::new(asset_hub_westend_runtime::xcm_config::WestendLocationV3::get());
|
||||
let mut asset_one = asset_hub_westend_runtime::xcm_config::PoolAssetsPalletLocationV3::get();
|
||||
asset_one
|
||||
.append_with(v3::Junction::GeneralIndex(ASSET_ID.into()))
|
||||
.expect("pool assets");
|
||||
let asset_native = asset_hub_westend_runtime::xcm_config::WestendLocation::get();
|
||||
let mut asset_one = asset_hub_westend_runtime::xcm_config::PoolAssetsPalletLocation::get();
|
||||
asset_one.append_with(GeneralIndex(ASSET_ID.into())).expect("pool assets");
|
||||
|
||||
AssetHubWestend::execute_with(|| {
|
||||
let pool_owner_account_id = asset_hub_westend_runtime::AssetConversionOrigin::get();
|
||||
@@ -253,8 +254,8 @@ fn cannot_create_pool_from_pool_assets() {
|
||||
assert_matches::assert_matches!(
|
||||
<AssetHubWestend as AssetHubWestendPallet>::AssetConversion::create_pool(
|
||||
<AssetHubWestend as Chain>::RuntimeOrigin::signed(AssetHubWestendSender::get()),
|
||||
asset_native,
|
||||
Box::new(asset_one),
|
||||
Box::new(v3::Location::try_from(asset_native).expect("conversion works")),
|
||||
Box::new(v3::Location::try_from(asset_one).expect("conversion works")),
|
||||
),
|
||||
Err(DispatchError::Module(ModuleError{index: _, error: _, message})) => assert_eq!(message, Some("Unknown"))
|
||||
);
|
||||
@@ -263,7 +264,9 @@ fn cannot_create_pool_from_pool_assets() {
|
||||
|
||||
#[test]
|
||||
fn pay_xcm_fee_with_some_asset_swapped_for_native() {
|
||||
let asset_native = asset_hub_westend_runtime::xcm_config::WestendLocationV3::get();
|
||||
let asset_native =
|
||||
v3::Location::try_from(asset_hub_westend_runtime::xcm_config::WestendLocation::get())
|
||||
.expect("conversion works");
|
||||
let asset_one = xcm::v3::Location {
|
||||
parents: 0,
|
||||
interior: [
|
||||
|
||||
+17
-21
@@ -110,7 +110,7 @@ fn para_dest_assertions(t: RelayToSystemParaTest) {
|
||||
|
||||
fn penpal_to_ah_foreign_assets_sender_assertions(t: ParaToSystemParaTest) {
|
||||
type RuntimeEvent = <PenpalA as Chain>::RuntimeEvent;
|
||||
let system_para_native_asset_location = v3::Location::try_from(RelayLocation::get()).unwrap();
|
||||
let system_para_native_asset_location = RelayLocation::get();
|
||||
let expected_asset_id = t.args.asset_id.unwrap();
|
||||
let (_, expected_asset_amount) =
|
||||
non_fee_asset(&t.args.assets, t.args.fee_asset_item as usize).unwrap();
|
||||
@@ -203,7 +203,7 @@ fn ah_to_penpal_foreign_assets_receiver_assertions(t: SystemParaToParaTest) {
|
||||
let (_, expected_asset_amount) =
|
||||
non_fee_asset(&t.args.assets, t.args.fee_asset_item as usize).unwrap();
|
||||
let checking_account = <PenpalA as PenpalAPallet>::PolkadotXcm::check_account();
|
||||
let system_para_native_asset_location = v3::Location::try_from(RelayLocation::get()).unwrap();
|
||||
let system_para_native_asset_location = RelayLocation::get();
|
||||
|
||||
PenpalA::assert_xcmp_queue_success(None);
|
||||
|
||||
@@ -420,22 +420,20 @@ pub fn do_bidirectional_teleport_foreign_assets_between_para_and_asset_hub_using
|
||||
) {
|
||||
// Init values for Parachain
|
||||
let fee_amount_to_send: Balance = ASSET_HUB_WESTEND_ED * 100;
|
||||
let asset_location_on_penpal =
|
||||
v3::Location::try_from(PenpalLocalTeleportableToAssetHub::get()).unwrap();
|
||||
let asset_location_on_penpal = PenpalLocalTeleportableToAssetHub::get();
|
||||
let asset_id_on_penpal = match asset_location_on_penpal.last() {
|
||||
Some(v3::Junction::GeneralIndex(id)) => *id as u32,
|
||||
Some(Junction::GeneralIndex(id)) => *id as u32,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let asset_amount_to_send = ASSET_HUB_WESTEND_ED * 100;
|
||||
let asset_owner = PenpalAssetOwner::get();
|
||||
let system_para_native_asset_location = v3::Location::try_from(RelayLocation::get()).unwrap();
|
||||
let system_para_native_asset_location = RelayLocation::get();
|
||||
let sender = PenpalASender::get();
|
||||
let penpal_check_account = <PenpalA as PenpalAPallet>::PolkadotXcm::check_account();
|
||||
let ah_as_seen_by_penpal = PenpalA::sibling_location_of(AssetHubWestend::para_id());
|
||||
let asset_location_on_penpal_latest: Location = asset_location_on_penpal.try_into().unwrap();
|
||||
let penpal_assets: Assets = vec![
|
||||
(Parent, fee_amount_to_send).into(),
|
||||
(asset_location_on_penpal_latest, asset_amount_to_send).into(),
|
||||
(asset_location_on_penpal.clone(), asset_amount_to_send).into(),
|
||||
]
|
||||
.into();
|
||||
let fee_asset_index = penpal_assets
|
||||
@@ -447,7 +445,7 @@ pub fn do_bidirectional_teleport_foreign_assets_between_para_and_asset_hub_using
|
||||
// fund Parachain's sender account
|
||||
PenpalA::mint_foreign_asset(
|
||||
<PenpalA as Chain>::RuntimeOrigin::signed(asset_owner.clone()),
|
||||
system_para_native_asset_location,
|
||||
system_para_native_asset_location.clone(),
|
||||
sender.clone(),
|
||||
fee_amount_to_send * 2,
|
||||
);
|
||||
@@ -474,7 +472,7 @@ pub fn do_bidirectional_teleport_foreign_assets_between_para_and_asset_hub_using
|
||||
|
||||
// Init values for System Parachain
|
||||
let foreign_asset_at_asset_hub_westend =
|
||||
v3::Location::new(1, [v3::Junction::Parachain(PenpalA::para_id().into())])
|
||||
Location::new(1, [Junction::Parachain(PenpalA::para_id().into())])
|
||||
.appended_with(asset_location_on_penpal)
|
||||
.unwrap();
|
||||
let penpal_to_ah_beneficiary_id = AssetHubWestendReceiver::get();
|
||||
@@ -496,7 +494,7 @@ pub fn do_bidirectional_teleport_foreign_assets_between_para_and_asset_hub_using
|
||||
let penpal_sender_balance_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(
|
||||
system_para_native_asset_location,
|
||||
system_para_native_asset_location.clone(),
|
||||
&PenpalASender::get(),
|
||||
)
|
||||
});
|
||||
@@ -510,7 +508,7 @@ pub fn do_bidirectional_teleport_foreign_assets_between_para_and_asset_hub_using
|
||||
let ah_receiver_assets_before = AssetHubWestend::execute_with(|| {
|
||||
type Assets = <AssetHubWestend as AssetHubWestendPallet>::ForeignAssets;
|
||||
<Assets as Inspect<_>>::balance(
|
||||
foreign_asset_at_asset_hub_westend,
|
||||
foreign_asset_at_asset_hub_westend.clone().try_into().unwrap(),
|
||||
&AssetHubWestendReceiver::get(),
|
||||
)
|
||||
});
|
||||
@@ -523,7 +521,7 @@ pub fn do_bidirectional_teleport_foreign_assets_between_para_and_asset_hub_using
|
||||
let penpal_sender_balance_after = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(
|
||||
system_para_native_asset_location,
|
||||
system_para_native_asset_location.clone(),
|
||||
&PenpalASender::get(),
|
||||
)
|
||||
});
|
||||
@@ -537,7 +535,7 @@ pub fn do_bidirectional_teleport_foreign_assets_between_para_and_asset_hub_using
|
||||
let ah_receiver_assets_after = AssetHubWestend::execute_with(|| {
|
||||
type Assets = <AssetHubWestend as AssetHubWestendPallet>::ForeignAssets;
|
||||
<Assets as Inspect<_>>::balance(
|
||||
foreign_asset_at_asset_hub_westend,
|
||||
foreign_asset_at_asset_hub_westend.clone().try_into().unwrap(),
|
||||
&AssetHubWestendReceiver::get(),
|
||||
)
|
||||
});
|
||||
@@ -565,19 +563,17 @@ pub fn do_bidirectional_teleport_foreign_assets_between_para_and_asset_hub_using
|
||||
type ForeignAssets = <AssetHubWestend as AssetHubWestendPallet>::ForeignAssets;
|
||||
assert_ok!(ForeignAssets::transfer(
|
||||
<AssetHubWestend as Chain>::RuntimeOrigin::signed(AssetHubWestendReceiver::get()),
|
||||
foreign_asset_at_asset_hub_westend,
|
||||
foreign_asset_at_asset_hub_westend.clone().try_into().unwrap(),
|
||||
AssetHubWestendSender::get().into(),
|
||||
asset_amount_to_send,
|
||||
));
|
||||
});
|
||||
|
||||
let foreign_asset_at_asset_hub_westend_latest: Location =
|
||||
foreign_asset_at_asset_hub_westend.try_into().unwrap();
|
||||
let ah_to_penpal_beneficiary_id = PenpalAReceiver::get();
|
||||
let penpal_as_seen_by_ah = AssetHubWestend::sibling_location_of(PenpalA::para_id());
|
||||
let ah_assets: Assets = vec![
|
||||
(Parent, fee_amount_to_send).into(),
|
||||
(foreign_asset_at_asset_hub_westend_latest, asset_amount_to_send).into(),
|
||||
(foreign_asset_at_asset_hub_westend.clone(), asset_amount_to_send).into(),
|
||||
]
|
||||
.into();
|
||||
let fee_asset_index = ah_assets
|
||||
@@ -605,7 +601,7 @@ pub fn do_bidirectional_teleport_foreign_assets_between_para_and_asset_hub_using
|
||||
let penpal_receiver_balance_before = PenpalA::execute_with(|| {
|
||||
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(
|
||||
system_para_native_asset_location,
|
||||
system_para_native_asset_location.clone(),
|
||||
&PenpalAReceiver::get(),
|
||||
)
|
||||
});
|
||||
@@ -613,7 +609,7 @@ pub fn do_bidirectional_teleport_foreign_assets_between_para_and_asset_hub_using
|
||||
let ah_sender_assets_before = AssetHubWestend::execute_with(|| {
|
||||
type ForeignAssets = <AssetHubWestend as AssetHubWestendPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(
|
||||
foreign_asset_at_asset_hub_westend,
|
||||
foreign_asset_at_asset_hub_westend.clone().try_into().unwrap(),
|
||||
&AssetHubWestendSender::get(),
|
||||
)
|
||||
});
|
||||
@@ -639,7 +635,7 @@ pub fn do_bidirectional_teleport_foreign_assets_between_para_and_asset_hub_using
|
||||
let ah_sender_assets_after = AssetHubWestend::execute_with(|| {
|
||||
type ForeignAssets = <AssetHubWestend as AssetHubWestendPallet>::ForeignAssets;
|
||||
<ForeignAssets as Inspect<_>>::balance(
|
||||
foreign_asset_at_asset_hub_westend,
|
||||
foreign_asset_at_asset_hub_westend.clone().try_into().unwrap(),
|
||||
&AssetHubWestendSender::get(),
|
||||
)
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user