diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 4eea326c4..4f8f4aa68 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -99,6 +99,7 @@ pub mod parachains { } /// Creates a location for the given asset in this format: `fn _location() -> MultiLocation` + #[macro_export] macro_rules! parachain_asset_location { // Also declares a constant variable _ASSET_ID with . // This assumes that the following constant variables exist: diff --git a/runtime/foucoco/src/assets.rs b/runtime/foucoco/src/assets.rs index 1149533b6..2056da9ff 100644 --- a/runtime/foucoco/src/assets.rs +++ b/runtime/foucoco/src/assets.rs @@ -3,6 +3,7 @@ pub mod xcm_assets { use runtime_common::create_xcm_id; create_xcm_id!(RELAY, 0); + create_xcm_id!(MOONBASE_DEV, 2); } /// Locations for native currency and all natively issued tokens @@ -35,3 +36,25 @@ pub mod native_locations { } } } + +pub mod moonbase_alpha_relay { + pub mod moonbase { + use xcm::latest::{ + Junction::{PalletInstance, Parachain}, + Junctions::X2, + }; + use runtime_common::parachain_asset_location; + + pub const PARA_ID: u32 = 1000; + pub const BALANCES_PALLET_INDEX: u8 = 110; + + parachain_asset_location!( + DEV, + X2( + Parachain(PARA_ID), + PalletInstance(BALANCES_PALLET_INDEX), + ) + + ); + } +} diff --git a/runtime/foucoco/src/xcm_config.rs b/runtime/foucoco/src/xcm_config.rs index 16c540cea..886749863 100644 --- a/runtime/foucoco/src/xcm_config.rs +++ b/runtime/foucoco/src/xcm_config.rs @@ -4,7 +4,7 @@ use super::{ }; use crate::assets::{ native_locations::{native_location_external_pov, native_location_local_pov}, - xcm_assets, + xcm_assets, moonbase_alpha_relay::moonbase::DEV_location, }; use core::marker::PhantomData; use frame_support::{ @@ -63,6 +63,8 @@ impl Convert> for CurrencyIdConvert { fn convert(id: CurrencyId) -> Option { match id { CurrencyId::XCM(xcm_assets::RELAY) => Some(MultiLocation::parent()), + // Moonbase testnet native token + CurrencyId::XCM(xcm_assets::MOONBASE_DEV) => Some(DEV_location()), CurrencyId::Native => Some(native_location_external_pov()), _ => None, } @@ -78,6 +80,8 @@ impl Convert> for CurrencyIdConvert { // Our native currency location with re-anchoring // The XCM pallet will try to re-anchor the location before it reaches here loc if loc == native_location_local_pov() => Some(CurrencyId::Native), + // Moonbase testnet native token + loc if loc == DEV_location() => Some(xcm_assets::MOONBASE_DEV_id()), _ => None, } }