Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
8971603
[penpal] remove local Assets instance, and introduce asset_conversion…
clangenb Jan 5, 2026
b0c0156
[penpal] remove unused ForeignAssetFeeAsExistentialDepositMultiplierF…
clangenb Jan 5, 2026
5e4c4d6
[penpal] add more tokens to genesis config
clangenb Jan 5, 2026
075af24
fmt
clangenb Jan 5, 2026
1438b3b
improve `MaybeResolveAssetTo` implementation
clangenb Jan 5, 2026
53fd49a
[penpal] don't redundantly define relaychain location
clangenb Jan 5, 2026
0609bbe
deprecate AssetsToBlockAuthor and move BlockAuthor to parachains-common
clangenb Jan 6, 2026
9aba028
Make penpal-emulated-chain compile
clangenb Jan 6, 2026
65b8db9
move Pen2 to Xcm config and fmt presets
clangenb Jan 6, 2026
f67ce57
add comment
clangenb Jan 6, 2026
529ceb9
[penpal] correctly use Location::here for native currency instead of …
clangenb Jan 6, 2026
67cdc5a
[penpal] disallow plain payment in relay tokens
clangenb Jan 6, 2026
417ac93
[penpal] remove unused imports
clangenb Jan 6, 2026
63f6ae7
[integration-tests] split of `create_foreign_pool_with_wnd_on` from `…
clangenb Jan 6, 2026
ac941e9
[penpal-runtime] disambiguate pallet assets it
clangenb Jan 6, 2026
758df2e
Replace local teleportable with Penpal Native currency
clangenb Jan 6, 2026
abefde1
fix pool creation
clangenb Jan 6, 2026
7e6c5bb
[penpal] fix SwapFirstAssetTrader: trade into Native instead of Relay…
clangenb Jan 6, 2026
272763a
[integration-tests] fix hybrid_transfer_test
clangenb Jan 6, 2026
260bb78
[penpal] fix sending xcm paying fees in foreign assets
clangenb Jan 6, 2026
d7046b1
[penpal] fix transact_from_para_to_para_through_asset_hub test
clangenb Jan 6, 2026
3945041
[integration-tests] fix exchange asset integration test
clangenb Jan 6, 2026
c1666c6
[integration-tests] fmt
clangenb Jan 6, 2026
c5e3e1a
[integration-tests] fix account_on_sibling_syschain_aliases_into_same…
clangenb Jan 6, 2026
f9f91e5
[integration-tests] fix account_on_sibling_syschain_cannot_alias_into…
clangenb Jan 6, 2026
51af1f0
[integration-tests] fix authorized_cross_chain_aliases
clangenb Jan 6, 2026
c1c50f6
[integration-tests] fix local asset swap test
clangenb Jan 6, 2026
d44d061
[integration-tests] fix transact_using_sov_account_from_para_to_asset…
clangenb Jan 6, 2026
400f06e
[integration-tests] fix transact_using_authorized_alias_from_para_to_…
clangenb Jan 6, 2026
488a0b1
[integration-tests] wip fixing test_parachain_is_trusted_teleporter, …
clangenb Jan 7, 2026
b241753
[integration-tests] Make xcm fee multihop tests work with a hack for now
clangenb Jan 7, 2026
026833b
[integration-tests] Make xcm partly fix xcm dryrun
clangenb Jan 7, 2026
dba0418
[integration-tests] fix bidirectional_teleport_foreign_asset_between_…
clangenb Jan 7, 2026
1acf8d1
[integration-tests] bidirectional_transfer_multiple_assets_between_pe…
clangenb Jan 7, 2026
51a77d9
[integration-tests] handle both cases
clangenb Jan 7, 2026
d32c75b
[integration-tests] fix reserve_transfer_usdt_from_para_to_para_throu…
clangenb Jan 7, 2026
7d566c9
[integration-tests] fix transfer_foreign_assets_from_asset_hub_to_para
clangenb Jan 7, 2026
51c3fbf
[integration-tests] fix transfer_foreign_assets_from_para_to_asset_hub
clangenb Jan 7, 2026
f5361f6
[integration-tests] fix transfer_foreign_assets_from_para_to_para_thr…
clangenb Jan 7, 2026
39c1290
[integration-tests] fix transfer_native_asset_from_penpal_to_relay_th…
clangenb Jan 7, 2026
b25fbed
[integration-tests] fix reserve_transfer_multiple_assets_from_asset_h…
clangenb Jan 7, 2026
a80c01e
[integration-tests] reserve_transfer_native_asset_from_asset_hub_to_para
clangenb Jan 7, 2026
bcded46
[integration-tests] fix reserve_transfer_native_asset_from_para_to_as…
clangenb Jan 7, 2026
05dcf6f
[integration-tests] fix reserve_transfer_native_asset_from_para_to_pa…
clangenb Jan 7, 2026
b4b0fab
[integration-tests] fix reserve_transfer_native_asset_from_para_to_relay
clangenb Jan 7, 2026
54bc8e1
[integration-tests] fix reserve_transfer_native_asset_from_relay_to_para
clangenb Jan 7, 2026
48bd4fb
[integration-tests] fix reserve_transfer_usdt_from_asset_hub_to_para
clangenb Jan 7, 2026
2415c16
[integration-tests] reintroduce event assertions
clangenb Jan 7, 2026
5cf7de4
[integration-tests] fmt
clangenb Jan 7, 2026
88228c9
[integration-tests] fmt
clangenb Jan 7, 2026
7a64ca1
[ahw] add PenpalB to genesis setup
clangenb Jan 7, 2026
932d2ae
[integration-tests] unify pool creation macros
clangenb Jan 7, 2026
d9b8bf2
[emulated-ah-rococo] add penpal native
clangenb Jan 7, 2026
aa4fbe3
minor fix
clangenb Jan 7, 2026
2c3b45a
[ahw-emulated] do not initialize PenB at genesis
clangenb Jan 7, 2026
6836ecd
[integration-tests] fix bridgehub-builds and fix send_pens_and_wnds_f…
clangenb Jan 7, 2026
1e32312
[integration-tests] fix account_on_sibling_syschain_aliases_into_same…
clangenb Jan 7, 2026
0005e19
[integration-tests] fix account_on_sibling_syschain_cannot_alias_into…
clangenb Jan 7, 2026
6bb9609
[integration-tests] fix authorized_cross_chain_aliases
clangenb Jan 7, 2026
abfd0f0
[integration-tests] fix send_back_rocs_from_penpal_westend_through_as…
clangenb Jan 7, 2026
87c1fac
[integration-tests] fix transact_from_ethereum_to_penpalb_through_ass…
clangenb Jan 7, 2026
2a8b2b6
[integration-tests] fix send_wnds_from_penpal_westend_through_asset_h…
clangenb Jan 7, 2026
77245cd
[integration-tests] fix send_wnds_from_westend_relay_through_asset_hu…
clangenb Jan 7, 2026
171ab0b
[integration-tests] fix send_token_from_ethereum_to_penpal
clangenb Jan 7, 2026
5b4e99f
[integration-tests] fix send_weth_from_ethereum_to_penpal
clangenb Jan 7, 2026
718d9ed
[integration-tests] make penpals a sufficient
clangenb Jan 8, 2026
c929482
[bridge-hub-integration-tests] fix transfer_penpal_native_asset: incr…
clangenb Jan 8, 2026
e32760c
[integration-tests] add Pen2 assets to asethub/bridgehub integration …
clangenb Jan 8, 2026
c32a444
[integration-tests] add LocalAssetsTransactor and fix: transfer_penpa…
clangenb Jan 8, 2026
ef4be64
Rename ForeignAssets pallet in penpal to Assets as it handles local a…
clangenb Jan 8, 2026
7e713b7
[integration-tests] make westend compile after renaming of assets pallet
clangenb Jan 9, 2026
c3a6804
[bridge-hub-westend-tests] fix send_token_to_penpal_v2
clangenb Jan 9, 2026
68acea6
[bridge-hub-westend-tests] fix register_token_from_penpal
clangenb Jan 9, 2026
d6fd601
[bridge-hub-westend-tests] fix send_message_from_penpal_to_ethereum_w…
clangenb Jan 9, 2026
ef8e2e4
[bridge-hub-westend-tests] fix default to paying local fees with Penp…
clangenb Jan 9, 2026
c749e1a
[bridge-hub-westend-tests] fund pen2 in common
clangenb Jan 9, 2026
e9d5684
[bridge-hub-westend-tests] fmt
clangenb Jan 9, 2026
76fe80d
[bridge-hub-westend-tests] better align test with previous state
clangenb Jan 9, 2026
dcd205e
[bridge-hub-westend-tests] fix transact_from_ethereum_to_penpalb_thro…
clangenb Jan 9, 2026
2aab5d9
[asset-hub-westend-tests] fix test_exchange_asset
clangenb Jan 9, 2026
3d21ba3
Merge remote-tracking branch 'upstream/master' into cl/penpal-xcm-config
clangenb Jan 9, 2026
eb82b1f
[asset-hub-westend-tests] fix test_exchange_asset after upstream merge
clangenb Jan 9, 2026
1a673bb
fmt
clangenb Jan 9, 2026
d10ae34
minor cosmetics
clangenb Jan 9, 2026
571b3ae
[integration-tests] revert asset-hub teleport tests to original behav…
clangenb Jan 9, 2026
65651f3
[integration-tests] more uniform imports
clangenb Jan 9, 2026
9b5ebcf
[integration-tests] further import improvements and and foreign_asset…
clangenb Jan 9, 2026
fb67ded
[integration-tests] fix: bidirectional_reserve_transfer_foreign_asset…
clangenb Jan 9, 2026
98fd440
[integration-tests] fix: add some documentation
clangenb Jan 9, 2026
17b411e
[integration-tests] better doc
clangenb Jan 9, 2026
b00a32e
[integration-tests] update xcm dry run tests
clangenb Jan 9, 2026
697c803
minor cleanup
clangenb Jan 9, 2026
cb73bd7
minor cleanup 2
clangenb Jan 9, 2026
18b12bb
fix naming
clangenb Jan 9, 2026
4dcd0b5
minor fix
clangenb Jan 9, 2026
9892851
better name
clangenb Jan 9, 2026
17e56e5
[integration-tests] macros: compute local fees purely in native
clangenb Jan 9, 2026
564844b
[integration-tests] import cleanup
clangenb Jan 9, 2026
4c36b0b
Merge branch 'master' into cl/penpal-xcm-config
clangenb Jan 9, 2026
f3d88cc
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] Jan 9, 2026
0522a62
[integration-tests] fix bridge-hub-rococo-tests
clangenb Jan 9, 2026
5b23a25
taplo fmt
clangenb Jan 9, 2026
c4e2d89
taplo fmt
clangenb Jan 9, 2026
5a052eb
Merge branch 'master' into cl/penpal-xcm-config
clangenb Jan 9, 2026
09e98df
prdoc; make penpal runtime version bump major
clangenb Jan 9, 2026
702645f
[penpal-runtime] fix benchmarks build
clangenb Jan 10, 2026
465b984
make emulated-integration-tests-common a major bump
clangenb Jan 10, 2026
0aa9ea5
improve macro hygiene for pool macros
clangenb Jan 10, 2026
dc1155f
fix coretime westend tests
clangenb Jan 10, 2026
bc25be2
fix collectives tests
clangenb Jan 10, 2026
ba832f6
fix people-westend tests
clangenb Jan 10, 2026
beb0090
fmt
clangenb Jan 10, 2026
7e7dfe6
Merge branch 'master' into cl/penpal-xcm-config
clangenb Jan 10, 2026
f00d436
fix pool macro imports
clangenb Jan 10, 2026
98de51b
fix pool macro imports again
clangenb Jan 10, 2026
3f1c201
[asset-hub-westend] xcm_fee_multihop: ensure that receiver native bal…
clangenb Jan 11, 2026
b3b1fb0
[penpal] align naming better with conventions
clangenb Jan 11, 2026
cb9e5e0
[asset-hub-westend-integration-tests] multi_hop_xcm: fix typo (does n…
clangenb Jan 11, 2026
3927c73
[asset-hub-westend-integration-tests] multi_hop_xcm: add debug logs
clangenb Jan 11, 2026
d634e45
[asset-hub-westend-integration-tests] multi_hop_xcm: fix test
clangenb Jan 11, 2026
4ca7dd6
fmt
clangenb Jan 11, 2026
b076972
better doc
clangenb Jan 11, 2026
c782ce9
try fix other xcm test
clangenb Jan 11, 2026
2f5938c
fmt
clangenb Jan 11, 2026
f06167e
make Penpal Assets be on index 50
clangenb Jan 12, 2026
a2740c6
[xcm_fee_tests] fix `Asset::fun(0)` decoding error
clangenb Jan 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 22 additions & 1 deletion cumulus/parachains/common/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use alloc::boxed::Box;
use core::marker::PhantomData;
use frame_support::traits::{
fungible, fungibles, tokens::imbalance::ResolveTo, Contains, ContainsPair, Currency, Defensive,
Get, Imbalance, OnUnbalanced, OriginTrait,
Get, Imbalance, OnUnbalanced, OriginTrait, TypedGet,
};
use pallet_asset_tx_payment::HandleCredit;
use pallet_collator_selection::StakingPotAccountId;
Expand Down Expand Up @@ -83,7 +83,12 @@ where

/// A `HandleCredit` implementation that naively transfers the fees to the block author.
/// Will drop and burn the assets in case the transfer fails.
#[deprecated(
note = "AssetsToBlockAuthor is deprecated and will be removed after June 2026. Please use frame_support::traits::tokens::imbalance::MaybeResolveTo<BlockAuthor, ...> instead."
)]
pub struct AssetsToBlockAuthor<R, I>(PhantomData<(R, I)>);

#[allow(deprecated)]
impl<R, I> HandleCredit<AccountIdOf<R>, pallet_assets::Pallet<R, I>> for AssetsToBlockAuthor<R, I>
where
I: 'static,
Expand All @@ -99,6 +104,22 @@ where
}
}

/// Implements `TypedGet` with an option return value to pass into
/// frame_support::traits::tokens::imbalance::MaybeResolveTo<BlockAuthor, ...>.
pub struct BlockAuthor<Runtime>(PhantomData<Runtime>);

impl<R> TypedGet for BlockAuthor<R>
where
R: pallet_authorship::Config,
AccountIdOf<R>: From<polkadot_primitives::AccountId> + Into<polkadot_primitives::AccountId>,
{
type Type = Option<AccountIdOf<R>>;

fn get() -> Self::Type {
pallet_authorship::Pallet::<R>::author()
}
}

/// Allow checking in assets that have issuance > 0.
pub struct NonZeroIssuance<AccountId, Assets>(PhantomData<(AccountId, Assets)>);
impl<AccountId, Assets> Contains<<Assets as fungibles::Inspect<AccountId>>::AssetId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators,
snowbridge::{ETHER_MIN_BALANCE, WETH},
xcm_emulator::ConvertLocation,
PenpalALocation, PenpalASiblingSovereignAccount, PenpalATeleportableAssetLocation,
PenpalBLocation, PenpalBSiblingSovereignAccount, PenpalBTeleportableAssetLocation,
PenpalALocation, PenpalAPen2TeleportableAssetLocation, PenpalASiblingSovereignAccount,
PenpalBLocation, PenpalBPen2TeleportableAssetLocation, PenpalBSiblingSovereignAccount,
RESERVABLE_ASSET_ID, SAFE_XCM_VERSION, USDT_ID,
};
use parachains_common::{AccountId, Balance};
Expand Down Expand Up @@ -99,26 +99,28 @@ pub fn genesis() -> Storage {
},
foreign_assets: asset_hub_rococo_runtime::ForeignAssetsConfig {
assets: vec![
// PenpalA's teleportable asset representation
// // PenpalA's native asset representation
(PenpalALocation::get(), PenpalASiblingSovereignAccount::get(), true, ED),
// // PenpalB's native asset representation
(PenpalBLocation::get(), PenpalBSiblingSovereignAccount::get(), true, ED),
(
PenpalATeleportableAssetLocation::get(),
PenpalAPen2TeleportableAssetLocation::get(),
PenpalASiblingSovereignAccount::get(),
false,
ED,
),
// PenpalB's teleportable asset representation
(
PenpalBTeleportableAssetLocation::get(),
PenpalBPen2TeleportableAssetLocation::get(),
PenpalBSiblingSovereignAccount::get(),
false,
ED,
),
// Ether
(
EthereumLocation::get(),
AssetHubWestendSovereignAccount::get(), /* To emulate double bridging, where
* WAH is the owner of assets from
* Ethereum on RAH */
// Emulate double bridging; WAH is the owner of assets from Ethereum on RAH.
AssetHubWestendSovereignAccount::get(),
true,
ETHER_MIN_BALANCE,
),
Expand All @@ -137,12 +139,14 @@ pub fn genesis() -> Storage {
),
],
reserves: vec![
(PenpalALocation::get(), vec![(PenpalALocation::get(), true).into()]),
(PenpalBLocation::get(), vec![(PenpalBLocation::get(), true).into()]),
(
PenpalATeleportableAssetLocation::get(),
PenpalAPen2TeleportableAssetLocation::get(),
vec![(PenpalALocation::get(), true).into()],
),
(
PenpalBTeleportableAssetLocation::get(),
PenpalBPen2TeleportableAssetLocation::get(),
vec![(PenpalBLocation::get(), true).into()],
),
(EthereumLocation::get(), vec![(AssetHubWestendLocation::get(), false).into()]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators,
snowbridge::{ETHER_MIN_BALANCE, WETH},
xcm_emulator::ConvertLocation,
PenpalALocation, PenpalASiblingSovereignAccount, PenpalATeleportableAssetLocation,
PenpalBLocation, PenpalBSiblingSovereignAccount, PenpalBTeleportableAssetLocation,
PenpalALocation, PenpalAPen2TeleportableAssetLocation, PenpalASiblingSovereignAccount,
PenpalBLocation, PenpalBPen2TeleportableAssetLocation, PenpalBSiblingSovereignAccount,
RESERVABLE_ASSET_ID, SAFE_XCM_VERSION, USDT_ID,
};
use parachains_common::{AccountId, Balance};
Expand Down Expand Up @@ -99,16 +99,19 @@ pub fn genesis() -> Storage {
},
foreign_assets: asset_hub_westend_runtime::ForeignAssetsConfig {
assets: vec![
// // Penpals' native asset representation
(PenpalALocation::get(), PenpalASiblingSovereignAccount::get(), true, ED),
(PenpalBLocation::get(), PenpalBSiblingSovereignAccount::get(), true, ED),
// PenpalA's teleportable asset representation
(
PenpalATeleportableAssetLocation::get(),
PenpalAPen2TeleportableAssetLocation::get(),
PenpalASiblingSovereignAccount::get(),
false,
ED,
),
// PenpalB's teleportable asset representation
(
PenpalBTeleportableAssetLocation::get(),
PenpalBPen2TeleportableAssetLocation::get(),
PenpalBSiblingSovereignAccount::get(),
false,
ED,
Expand All @@ -135,12 +138,14 @@ pub fn genesis() -> Storage {
),
],
reserves: vec![
(PenpalALocation::get(), vec![(PenpalALocation::get(), true).into()]),
(PenpalBLocation::get(), vec![(PenpalBLocation::get(), true).into()]),
(
PenpalATeleportableAssetLocation::get(),
PenpalAPen2TeleportableAssetLocation::get(),
vec![(PenpalALocation::get(), true).into()],
),
(
PenpalBTeleportableAssetLocation::get(),
PenpalBPen2TeleportableAssetLocation::get(),
vec![(PenpalBLocation::get(), true).into()],
),
(EthereumLocation::get(), vec![(EthereumLocation::get(), false).into()]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators, SAFE_XCM_VERSION,
};
use parachains_common::{AccountId, Balance};
use penpal_runtime::xcm_config::{LocalReservableFromAssetHub, RelayLocation, UsdtFromAssetHub};
use penpal_runtime::xcm_config::{
LocalPen2Asset, LocalReservableFromAssetHub, RelayLocation, UsdtFromAssetHub,
};
// Penpal
pub const PARA_ID_A: u32 = 2000;
pub const PARA_ID_B: u32 = 2001;
Expand Down Expand Up @@ -70,18 +72,11 @@ pub fn genesis(para_id: u32) -> Storage {
},
sudo: penpal_runtime::SudoConfig { key: Some(PenpalSudoAccount::get()) },
assets: penpal_runtime::AssetsConfig {
assets: vec![(
penpal_runtime::xcm_config::TELEPORTABLE_ASSET_ID,
PenpalAssetOwner::get(),
false,
ED,
)],
..Default::default()
},
foreign_assets: penpal_runtime::ForeignAssetsConfig {
assets: vec![
// Relay Native asset representation
(RelayLocation::get(), PenpalAssetOwner::get(), true, ED),
// Local Pen2 representation
(LocalPen2Asset::get(), PenpalAssetOwner::get(), false, ED),
// Sufficient AssetHub asset representation
(LocalReservableFromAssetHub::get(), PenpalAssetOwner::get(), true, ED),
// USDT from AssetHub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ use sp_core::Encode;
// Cumulus
use emulated_integration_tests_common::{
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain,
impl_assets_helpers_for_parachain, impl_foreign_assets_helpers_for_parachain,
impl_xcm_helpers_for_parachain,
impl_foreign_assets_helpers_for_parachain, impl_xcm_helpers_for_parachain,
impls::{NetworkId, Parachain},
xcm_emulator::decl_test_parachains,
AuraDigestProvider,
Expand Down Expand Up @@ -59,7 +58,6 @@ decl_test_parachains! {
pallets = {
PolkadotXcm: penpal_runtime::PolkadotXcm,
Assets: penpal_runtime::Assets,
ForeignAssets: penpal_runtime::ForeignAssets,
AssetConversion: penpal_runtime::AssetConversion,
Balances: penpal_runtime::Balances,
}
Expand All @@ -84,7 +82,6 @@ decl_test_parachains! {
pallets = {
PolkadotXcm: penpal_runtime::PolkadotXcm,
Assets: penpal_runtime::Assets,
ForeignAssets: penpal_runtime::ForeignAssets,
AssetConversion: penpal_runtime::AssetConversion,
Balances: penpal_runtime::Balances,
}
Expand All @@ -96,9 +93,17 @@ impl_accounts_helpers_for_parachain!(PenpalA);
impl_accounts_helpers_for_parachain!(PenpalB);
impl_assert_events_helpers_for_parachain!(PenpalA);
impl_assert_events_helpers_for_parachain!(PenpalB);
impl_assets_helpers_for_parachain!(PenpalA);
impl_foreign_assets_helpers_for_parachain!(PenpalA, xcm::latest::Location, ForeignAssetReserveData);
impl_assets_helpers_for_parachain!(PenpalB);
impl_foreign_assets_helpers_for_parachain!(PenpalB, xcm::latest::Location, ForeignAssetReserveData);
impl_foreign_assets_helpers_for_parachain!(
PenpalA,
xcm::latest::Location,
ForeignAssetReserveData,
Assets
);
impl_foreign_assets_helpers_for_parachain!(
PenpalB,
xcm::latest::Location,
ForeignAssetReserveData,
Assets
);
Comment on lines +96 to +107
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The macro has now an additional parameter to designate the name of the pallet that is handling the foreign assets. I believe that essentially we can do some cleanups in the macro here, but I did not want to make this PR even bigger.

impl_xcm_helpers_for_parachain!(PenpalA);
impl_xcm_helpers_for_parachain!(PenpalB);
25 changes: 18 additions & 7 deletions cumulus/parachains/integration-tests/emulated/common/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,18 @@ macro_rules! impl_assets_helpers_for_parachain {

#[macro_export]
macro_rules! impl_foreign_assets_helpers_for_parachain {
// By default, we assume that the pallet_assets instance handling foreign assets is called
// `ForeignAssets`. There are exceptions like `Penpal`, where it is simply called `Assets`.
($chain:ident, $asset_id_type:ty, $reserve_data_type:ty) => {
$crate::impl_foreign_assets_helpers_for_parachain!(
$chain,
$asset_id_type,
$reserve_data_type,
ForeignAssets
);
};

($chain:ident, $asset_id_type:ty, $reserve_data_type:ty, $pallet_asset_name:ident) => {
$crate::impls::paste::paste! {
impl<N: $crate::impls::Network> $chain<N> {
/// Create foreign assets using sudo `ForeignAssets::force_create()`
Expand All @@ -817,20 +828,20 @@ macro_rules! impl_foreign_assets_helpers_for_parachain {
let sudo_origin = <$chain<N> as $crate::impls::Chain>::RuntimeOrigin::root();
<Self as $crate::impls::TestExt>::execute_with(|| {
$crate::impls::assert_ok!(
<Self as [<$chain ParaPallet>]>::ForeignAssets::force_create(
<Self as [<$chain ParaPallet>]>::$pallet_asset_name::force_create(
sudo_origin,
id.clone(),
owner.clone().into(),
is_sufficient,
min_balance,
)
);
assert!(<Self as [<$chain ParaPallet>]>::ForeignAssets::asset_exists(id.clone()));
assert!(<Self as [<$chain ParaPallet>]>::$pallet_asset_name::asset_exists(id.clone()));
type RuntimeEvent<N> = <$chain<N> as $crate::impls::Chain>::RuntimeEvent;
$crate::impls::assert_expected_events!(
Self,
vec![
RuntimeEvent::<N>::ForeignAssets(
RuntimeEvent::<N>::$pallet_asset_name(
$crate::impls::pallet_assets::Event::ForceCreated {
asset_id,
..
Expand All @@ -857,7 +868,7 @@ macro_rules! impl_foreign_assets_helpers_for_parachain {
<$chain<N> as $crate::impls::Chain>::RuntimeOrigin::signed(owner.clone());
<Self as $crate::impls::TestExt>::execute_with(|| {
$crate::impls::assert_ok!(
<Self as [<$chain ParaPallet>]>::ForeignAssets::set_reserves(
<Self as [<$chain ParaPallet>]>::$pallet_asset_name::set_reserves(
owner_origin,
id.clone(),
reserves.try_into().unwrap(),
Expand All @@ -874,7 +885,7 @@ macro_rules! impl_foreign_assets_helpers_for_parachain {
amount_to_mint: u128,
) {
<Self as $crate::impls::TestExt>::execute_with(|| {
$crate::impls::assert_ok!(<Self as [<$chain ParaPallet>]>::ForeignAssets::mint(
$crate::impls::assert_ok!(<Self as [<$chain ParaPallet>]>::$pallet_asset_name::mint(
signed_origin,
id.clone().into(),
beneficiary.clone().into(),
Expand All @@ -886,7 +897,7 @@ macro_rules! impl_foreign_assets_helpers_for_parachain {
$crate::impls::assert_expected_events!(
Self,
vec![
RuntimeEvent::<N>::ForeignAssets(
RuntimeEvent::<N>::$pallet_asset_name(
$crate::impls::pallet_assets::Event::Issued { asset_id, owner, amount }
) => {
asset_id: *asset_id == id,
Expand All @@ -906,7 +917,7 @@ macro_rules! impl_foreign_assets_helpers_for_parachain {
) -> $crate::impls::DoubleEncoded<()> {
use $crate::impls::{Chain, Encode};

<Self as Chain>::RuntimeCall::ForeignAssets($crate::impls::pallet_assets::Call::<
<Self as Chain>::RuntimeCall::$pallet_asset_name($crate::impls::pallet_assets::Call::<
<Self as Chain>::Runtime,
$crate::impls::pallet_assets::Instance2,
>::create {
Expand Down
Loading
Loading