Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
39 changes: 38 additions & 1 deletion integration-tests/src/asset_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use frame_support::assert_ok;
use frame_system::RawOrigin;
use hydradx_runtime::AssetRegistry as Registry;
use polkadot_xcm::v5::{
Junction::{GeneralIndex, Parachain},
Junction::{GeneralIndex, PalletInstance, Parachain},
Location,
};
use pretty_assertions::{assert_eq, assert_ne};
Expand Down Expand Up @@ -87,3 +87,40 @@ fn root_should_update_location_when_asset_exists() {
assert!(Registry::location_assets(loc_1).is_none());
});
}

// Registering a Taifoon-native asset (xcFOON) on Hydration.
//
// Taifoon is a Moonbeam fork, so its native currency uses the Moonbeam-family multilocation shape:
// `{ parents: 1, interior: X2(Parachain(TAIFOON_PARA_ID), PalletInstance(10)) }` — PalletInstance 10
// is the Balances pallet on Moonbeam-family runtimes, i.e. the native token (18 decimals). This is
// the on-chain `assetRegistry.register` a GeneralAdmin referendum would submit to accept xcFOON.
#[test]
fn root_should_register_xcfoon_from_taifoon() {
TestNet::reset();
Hydra::execute_with(|| {
let foon_location = hydradx_runtime::AssetLocation(Location {
parents: 1,
interior: [Parachain(TAIFOON_PARA_ID), PalletInstance(10)].into(),
});

// The location must not resolve before registration.
assert!(Registry::location_assets(foon_location.clone()).is_none());

assert_ok!(Registry::register(
RawOrigin::Root.into(),
None, // asset_id: auto
Some(b"Taifoon FOON".to_vec().try_into().unwrap()),
pallet_asset_registry::AssetType::Token, // asset_type
None, // existential_deposit: default
Some(b"xcFOON".to_vec().try_into().unwrap()),
Some(18), // decimals (FOON = 18)
Some(foon_location.clone()), // location
None, // xcm_rate_limit
false, // is_sufficient
));

// The location now resolves to a local asset id, and back.
let foon_id = Registry::location_assets(foon_location.clone()).expect("xcFOON registered");
assert_eq!(Registry::locations(foon_id).unwrap(), foon_location);
});
}
1 change: 1 addition & 0 deletions integration-tests/src/polkadot_test_net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ pub const ASSET_HUB_PARA_ID: u32 = 1_000;
pub const ACALA_PARA_ID: u32 = 2_000;
pub const HYDRA_PARA_ID: u32 = 2_034;
pub const MOONBEAM_PARA_ID: u32 = 2_004;
pub const TAIFOON_PARA_ID: u32 = 3_369; // TODO: replace with Taifoon's reserved Polkadot para id once registered
pub const INTERLAY_PARA_ID: u32 = 2_032;
pub const ZEITGEIST_PARA_ID: u32 = 2_092;

Expand Down
Loading