difftreelog
feat(xcm) reenable xtokens on qtz/unq, allow moonbeam on unq
in: master
4 files changed
runtime/common/construct_runtime/mod.rsdiffbeforeafterboth--- 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<T>} = 34,
Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,
Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,
- #[runtimes(opal)]
+
XTokens: orml_xtokens = 38,
Tokens: orml_tokens = 39,
// Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,
runtime/opal/src/xcm_config.rsdiffbeforeafterboth--- 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;
runtime/quartz/src/xcm_config.rsdiffbeforeafterboth180 type OnKilledTokenAccount = ();180 type OnKilledTokenAccount = ();181}181}182182183/*183impl orml_xtokens::Config for Runtime {184impl orml_xtokens::Config for Runtime {184 type Event = Event;185 type Event = Event;185 type Balance = Balance;186 type Balance = Balance;186 type CurrencyId = CurrencyId;187 type CurrencyId = AssetIds;187 type CurrencyIdConvert = CurrencyIdConvert;188 type CurrencyIdConvert = CurrencyIdConvert;188 type AccountIdToMultiLocation = AccountIdToMultiLocation;189 type AccountIdToMultiLocation = AccountIdToMultiLocation;189 type SelfLocation = SelfLocation;190 type SelfLocation = SelfLocation;190 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;191 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;191 type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;192 type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;192 type BaseXcmWeight = BaseXcmWeight;193 type BaseXcmWeight = BaseXcmWeight;193 type LocationInverter = LocationInverter<Ancestry>;194 type LocationInverter = LocationInverter<Ancestry>;194 type MaxAssetsForTransfer = MaxAssetsForTransfer;195 type MaxAssetsForTransfer = MaxAssetsForTransfer;195 type MinXcmFee = ParachainMinFee;196 type MinXcmFee = ParachainMinFee;196 type MultiLocationsFilter = Everything;197 type MultiLocationsFilter = Everything;197 type ReserveProvider = AbsoluteReserveProvider;198 type ReserveProvider = AbsoluteReserveProvider;198}199}199200 */201200202parameter_type_with_key! {201parameter_type_with_key! {203 pub ExistentialDeposits: |currency_id: CurrencyId| -> Balance {202 pub ExistentialDeposits: |currency_id: CurrencyId| -> Balance {219}218}220219220221pub struct CurrencyIdConvert;222impl Convert<AssetIds, Option<MultiLocation>> for CurrencyIdConvert {223 fn convert(id: AssetIds) -> Option<MultiLocation> {224 match id {225 AssetIds::NativeAssetId(NativeCurrency::Here) => Some(MultiLocation::new(226 1,227 X1(Parachain(ParachainInfo::get().into())),228 )),229 AssetIds::NativeAssetId(NativeCurrency::Parent) => Some(MultiLocation::parent()),230 AssetIds::ForeignAssetId(_) => None,231 }232 }233}221/*234/*222pub struct CurrencyIdConvert;223impl Convert<AssetIds, Option<MultiLocation>> for CurrencyIdConvert {224 fn convert(id: AssetIds) -> Option<MultiLocation> {225 match id {226 AssetIds::NativeAssetId(NativeCurrency::Here) => Some(MultiLocation::new(227 1,228 X1(Parachain(ParachainInfo::get().into())),229 )),230 AssetIds::NativeAssetId(NativeCurrency::Parent) => Some(MultiLocation::parent()),231 AssetIds::ForeignAssetId(foreign_asset_id) => {232 XcmForeignAssetIdMapping::<Runtime>::get_multi_location(foreign_asset_id)233 }234 }235 }236}237impl Convert<MultiLocation, Option<CurrencyId>> for CurrencyIdConvert {235impl Convert<MultiLocation, Option<CurrencyId>> for CurrencyIdConvert {238 fn convert(location: MultiLocation) -> Option<CurrencyId> {236 fn convert(location: MultiLocation) -> Option<CurrencyId> {239 if location == MultiLocation::here()237 if location == MultiLocation::here()240 || location == MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into())))238 || location == MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into())))241 {239 {242 return Some(AssetIds::NativeAssetId(NativeCurrency::Here));240 return Some(AssetIds::NativeAssetId(NativeCurrency::Here));243 }241 }244242245 if location == MultiLocation::parent() {243 if location == MultiLocation::parent() {246 return Some(AssetIds::NativeAssetId(NativeCurrency::Parent));244 return Some(AssetIds::NativeAssetId(NativeCurrency::Parent));247 }245 }248246249 if let Some(currency_id) =247 if let Some(currency_id) =250 XcmForeignAssetIdMapping::<Runtime>::get_currency_id(location.clone())248 XcmForeignAssetIdMapping::<Runtime>::get_currency_id(location.clone())251 {249 {252 return Some(currency_id);250 return Some(currency_id);253 }251 }254252255 None253 None256 }254 }257}255}258256259 */257 */260258261259262parameter_types! {260parameter_types! {runtime/unique/src/xcm_config.rsdiffbeforeafterboth--- 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<XcmConfig<Self>>;
+ type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
+ type BaseXcmWeight = BaseXcmWeight;
+ type LocationInverter = LocationInverter<Ancestry>;
+ type MaxAssetsForTransfer = MaxAssetsForTransfer;
+ type MinXcmFee = ParachainMinFee;
+ type MultiLocationsFilter = Everything;
+ type ReserveProvider = AbsoluteReserveProvider;
+}
+
+pub struct CurrencyIdConvert;
+impl Convert<AssetIds, Option<MultiLocation>> for CurrencyIdConvert {
+ fn convert(id: AssetIds) -> Option<MultiLocation> {
+ 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
+}