From 4741f7f3a672fb7ffd3eb265587f8b08cff7e09f Mon Sep 17 00:00:00 2001 From: bogdanS98 Date: Tue, 5 Dec 2023 19:11:02 +0200 Subject: [PATCH] Address change request --- runtime/common/src/lib.rs | 18 +++++++++++++++++- runtime/foucoco/src/assets.rs | 18 ------------------ runtime/foucoco/src/xcm_config.rs | 6 +++--- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 4f8f4aa68..1d3706c07 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -99,7 +99,6 @@ 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: @@ -194,6 +193,23 @@ pub mod parachains { pub use super::super::polkadot::asset_hub::*; } } + + pub mod moonbase_alpha_relay { + pub mod moonbase_alpha { + use xcm::latest::{ + Junction::{PalletInstance, Parachain}, + Junctions::X2, + }; + + pub const PARA_ID: u32 = 1000; + pub const BALANCES_PALLET_INDEX: u8 = 3; + + parachain_asset_location!( + DEV, + X2(Parachain(PARA_ID), PalletInstance(BALANCES_PALLET_INDEX),) + ); + } + } } #[cfg(test)] diff --git a/runtime/foucoco/src/assets.rs b/runtime/foucoco/src/assets.rs index d7dfa2750..366390b51 100644 --- a/runtime/foucoco/src/assets.rs +++ b/runtime/foucoco/src/assets.rs @@ -36,21 +36,3 @@ pub mod native_locations { } } } - -pub mod moonbase_alpha_relay { - pub mod moonbase { - use runtime_common::parachain_asset_location; - use xcm::latest::{ - Junction::{PalletInstance, Parachain}, - Junctions::X2, - }; - - 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 b48d5e5d8..f2303217a 100644 --- a/runtime/foucoco/src/xcm_config.rs +++ b/runtime/foucoco/src/xcm_config.rs @@ -3,7 +3,6 @@ use super::{ RuntimeCall, RuntimeEvent, RuntimeOrigin, Tokens, WeightToFee, XcmpQueue, }; use crate::assets::{ - moonbase_alpha_relay::moonbase::DEV_location, native_locations::{native_location_external_pov, native_location_local_pov}, xcm_assets, }; @@ -19,6 +18,7 @@ use orml_traits::{ use pallet_xcm::XcmPassthrough; use polkadot_parachain::primitives::Sibling; use polkadot_runtime_common::impls::ToAuthor; +use runtime_common::parachains::moonbase_alpha_relay::moonbase_alpha; use sp_runtime::traits::Convert; use xcm::latest::{prelude::*, Weight as XCMWeight}; use xcm_builder::{ @@ -65,7 +65,7 @@ impl Convert> for CurrencyIdConvert { match id { CurrencyId::XCM(xcm_assets::RELAY) => Some(MultiLocation::parent()), // Moonbase testnet native token - CurrencyId::XCM(xcm_assets::MOONBASE_DEV) => Some(DEV_location()), + CurrencyId::XCM(xcm_assets::MOONBASE_DEV) => Some(moonbase_alpha::DEV_location()), CurrencyId::Native => Some(native_location_external_pov()), _ => None, } @@ -82,7 +82,7 @@ impl Convert> for CurrencyIdConvert { // 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()), + loc if loc == moonbase_alpha::DEV_location() => Some(xcm_assets::MOONBASE_DEV_id()), _ => None, } }