--- a/runtime/common/construct_runtime/mod.rs +++ b/runtime/common/construct_runtime/mod.rs @@ -42,7 +42,7 @@ Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 34, Sudo: pallet_sudo::{Pallet, Call, Storage, Config, Event} = 35, Vesting: orml_vesting::{Pallet, Storage, Call, Event, Config} = 37, - #[runtimes(opal)] + XTokens: orml_xtokens = 38, Tokens: orml_tokens = 39, // Vesting: pallet_vesting::{Pallet, Call, Config, Storage, Event} = 37, --- a/runtime/opal/src/xcm_config.rs +++ b/runtime/opal/src/xcm_config.rs @@ -498,7 +498,7 @@ impl orml_xtokens::Config for Runtime { type Event = Event; type Balance = Balance; - type CurrencyId = AssetIds; + type CurrencyId = CurrencyId; type CurrencyIdConvert = CurrencyIdConvert; type AccountIdToMultiLocation = AccountIdToMultiLocation; type SelfLocation = SelfLocation; --- a/runtime/quartz/src/xcm_config.rs +++ b/runtime/quartz/src/xcm_config.rs @@ -180,11 +180,10 @@ type OnKilledTokenAccount = (); } -/* impl orml_xtokens::Config for Runtime { type Event = Event; type Balance = Balance; - type CurrencyId = AssetIds; + type CurrencyId = CurrencyId; type CurrencyIdConvert = CurrencyIdConvert; type AccountIdToMultiLocation = AccountIdToMultiLocation; type SelfLocation = SelfLocation; @@ -197,8 +196,8 @@ type MultiLocationsFilter = Everything; type ReserveProvider = AbsoluteReserveProvider; } - */ + parameter_type_with_key! { pub ExistentialDeposits: |currency_id: CurrencyId| -> Balance { match currency_id { @@ -218,7 +217,7 @@ } } -/* + pub struct CurrencyIdConvert; impl Convert> for CurrencyIdConvert { fn convert(id: AssetIds) -> Option { @@ -228,12 +227,11 @@ X1(Parachain(ParachainInfo::get().into())), )), AssetIds::NativeAssetId(NativeCurrency::Parent) => Some(MultiLocation::parent()), - AssetIds::ForeignAssetId(foreign_asset_id) => { - XcmForeignAssetIdMapping::::get_multi_location(foreign_asset_id) - } + AssetIds::ForeignAssetId(_) => None, } } } +/* impl Convert> for CurrencyIdConvert { fn convert(location: MultiLocation) -> Option { if location == MultiLocation::here() --- a/runtime/unique/src/xcm_config.rs +++ b/runtime/unique/src/xcm_config.rs @@ -88,6 +88,8 @@ MultiLocation { parents: 1, interior: Here }, // Karura/Acala location MultiLocation { parents: 1, interior: X1(Parachain(2000)) }, + // Moonbeam location + MultiLocation { parents: 1, interior: X1(Parachain(2004)) }, // Self parachain address MultiLocation { parents: 1, interior: X1(Parachain(ParachainInfo::get().into())) }, ] @@ -201,10 +203,42 @@ type OnKilledTokenAccount = (); } +impl orml_xtokens::Config for Runtime { + type Event = Event; + type Balance = Balance; + type CurrencyId = CurrencyId; + type CurrencyIdConvert = CurrencyIdConvert; + type AccountIdToMultiLocation = AccountIdToMultiLocation; + type SelfLocation = SelfLocation; + type XcmExecutor = XcmExecutor>; + type Weigher = FixedWeightBounds; + type BaseXcmWeight = BaseXcmWeight; + type LocationInverter = LocationInverter; + type MaxAssetsForTransfer = MaxAssetsForTransfer; + type MinXcmFee = ParachainMinFee; + type MultiLocationsFilter = Everything; + type ReserveProvider = AbsoluteReserveProvider; +} + +pub struct CurrencyIdConvert; +impl Convert> for CurrencyIdConvert { + fn convert(id: AssetIds) -> Option { + match id { + AssetIds::NativeAssetId(NativeCurrency::Here) => Some(MultiLocation::new( + 1, + X1(Parachain(ParachainInfo::get().into())), + )), + _ => None, + } + } +} parameter_types! { pub const BaseXcmWeight: Weight = 100_000_000; // TODO: recheck this pub const MaxAssetsForTransfer: usize = 2; + + pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); + pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into()))); } parameter_type_with_key! { @@ -223,4 +257,4 @@ }) .into() } -} \ No newline at end of file +}