diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 5ab947c1c2..34a30a89be 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -75,6 +75,24 @@ pub mod parachains { pub const USDC_ASSET_ID: u128 = 1337; pub const USDT_ASSET_ID: u128 = 1984; } + + pub mod equilibrium { + pub const PARA_ID: u32 = 2011; + pub const ASSET_PALLET_ID: u8 = 11; + + pub const EQ_ASSET_ID: u128 = 25_969; + pub const EQD_ASSET_ID: u128 = 6_648_164; + } + + pub mod moonbeam { + pub const PARA_ID: u32 = 2004; + pub const ASSET_PALLET_ID: u8 = 104; + } + + pub mod polkadex { + pub const PARA_ID: u32 = 2040; + pub const ASSET_PALLET_ID: u8 = 25; + } } pub mod kusama { diff --git a/runtime/pendulum/src/xcm_config.rs b/runtime/pendulum/src/xcm_config.rs index dd16d4f26e..2545afe3ab 100644 --- a/runtime/pendulum/src/xcm_config.rs +++ b/runtime/pendulum/src/xcm_config.rs @@ -15,7 +15,7 @@ use orml_traits::{ use pallet_xcm::XcmPassthrough; use polkadot_parachain::primitives::Sibling; use polkadot_runtime_common::impls::ToAuthor; -use runtime_common::parachains::polkadot::asset_hub; +use runtime_common::parachains::polkadot::{asset_hub, equilibrium}; use sp_runtime::traits::Convert; use xcm::latest::{prelude::*, Weight as XCMWeight}; use xcm_builder::{ @@ -31,6 +31,9 @@ use xcm_executor::{ const XCM_ASSET_RELAY_DOT: u8 = 0; const XCM_ASSET_ASSETHUB_USDT: u8 = 1; +const XCM_ASSET_ASSETHUB_USDC: u8 = 2; +const XCM_ASSET_EQUILIBRIUM_EQD: u8 = 3; +const XCM_ASSET_EQUILIBRIUM_EQ: u8 = 4; parameter_types! { pub const RelayLocation: MultiLocation = MultiLocation::parent(); @@ -42,6 +45,19 @@ parameter_types! { } +macro_rules! parachain_asset_loc { + ($module:ident, $asset_id:path) => { + MultiLocation { + parents: 1, + interior: X3( + Parachain($module::PARA_ID), + PalletInstance($module::ASSET_PALLET_ID), + GeneralIndex($asset_id), + ), + } + }; +} + /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used /// when determining ownership of accounts for asset transacting and when attempting to use XCM /// `Transact` in order to determine the dispatch Origin. @@ -66,14 +82,14 @@ impl Convert> for CurrencyIdConvert { // CurrencyId::KSM => Some(MultiLocation::parent()), CurrencyId::XCM(f) => match f { XCM_ASSET_RELAY_DOT => Some(MultiLocation::parent()), - XCM_ASSET_ASSETHUB_USDT => Some(MultiLocation::new( - 1, - X3( - Parachain(asset_hub::PARA_ID), - PalletInstance(asset_hub::ASSET_PALLET_ID), - GeneralIndex(asset_hub::USDT_ASSET_ID), - ), - )), + XCM_ASSET_ASSETHUB_USDT => + Some(parachain_asset_loc!(asset_hub, asset_hub::USDT_ASSET_ID)), + XCM_ASSET_ASSETHUB_USDC => + Some(parachain_asset_loc!(asset_hub, asset_hub::USDC_ASSET_ID)), + XCM_ASSET_EQUILIBRIUM_EQD => + Some(parachain_asset_loc!(equilibrium, equilibrium::EQD_ASSET_ID)), + XCM_ASSET_EQUILIBRIUM_EQ => + Some(parachain_asset_loc!(equilibrium, equilibrium::EQ_ASSET_ID)), _ => None, }, CurrencyId::Native => Some(MultiLocation::new( @@ -90,15 +106,14 @@ impl Convert> for CurrencyIdConvert { match location { MultiLocation { parents: 1, interior: Here } => Some(CurrencyId::XCM(XCM_ASSET_RELAY_DOT)), - MultiLocation { - parents: 1, - interior: - X3( - Parachain(asset_hub::PARA_ID), - PalletInstance(asset_hub::ASSET_PALLET_ID), - GeneralIndex(asset_hub::USDT_ASSET_ID), - ), - } => Some(CurrencyId::XCM(XCM_ASSET_ASSETHUB_USDT)), + parachain_asset_loc!(asset_hub, asset_hub::USDT_ASSET_ID) => + Some(CurrencyId::XCM(XCM_ASSET_ASSETHUB_USDT)), + parachain_asset_loc!(asset_hub, asset_hub::USDC_ASSET_ID) => + Some(CurrencyId::XCM(XCM_ASSET_ASSETHUB_USDC)), + parachain_asset_loc!(equilibrium, equilibrium::EQD_ASSET_ID) => + Some(CurrencyId::XCM(XCM_ASSET_EQUILIBRIUM_EQD)), + parachain_asset_loc!(equilibrium, equilibrium::EQ_ASSET_ID) => + Some(CurrencyId::XCM(XCM_ASSET_EQUILIBRIUM_EQ)), // Our native currency location without re-anchoring MultiLocation { parents: 1, interior: X2(Parachain(id), PalletInstance(10)) } if id == u32::from(ParachainInfo::parachain_id()) =>