git.delta.rocks / unique-network / refs/commits / c9cd7476b100

difftreelog

feat(xcm) reenable xtokens on qtz/unq, allow moonbeam on unq

Daniel Shiposha2022-09-02parent: #7b07931.patch.diff
in: master

4 files changed

modifiedruntime/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,
modifiedruntime/opal/src/xcm_config.rsdiffbeforeafterboth
498impl orml_xtokens::Config for Runtime {498impl orml_xtokens::Config for Runtime {
499 type Event = Event;499 type Event = Event;
500 type Balance = Balance;500 type Balance = Balance;
501 type CurrencyId = AssetIds;501 type CurrencyId = CurrencyId;
502 type CurrencyIdConvert = CurrencyIdConvert;502 type CurrencyIdConvert = CurrencyIdConvert;
503 type AccountIdToMultiLocation = AccountIdToMultiLocation;503 type AccountIdToMultiLocation = AccountIdToMultiLocation;
504 type SelfLocation = SelfLocation;504 type SelfLocation = SelfLocation;
modifiedruntime/quartz/src/xcm_config.rsdiffbeforeafterboth
--- 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<AssetIds, Option<MultiLocation>> for CurrencyIdConvert {
     fn convert(id: AssetIds) -> Option<MultiLocation> {
@@ -228,12 +227,11 @@
                 X1(Parachain(ParachainInfo::get().into())),
             )),
             AssetIds::NativeAssetId(NativeCurrency::Parent) => Some(MultiLocation::parent()),
-            AssetIds::ForeignAssetId(foreign_asset_id) => {
-                XcmForeignAssetIdMapping::<Runtime>::get_multi_location(foreign_asset_id)
-            }
+            AssetIds::ForeignAssetId(_) => None,
         }
     }
 }
+/*
 impl Convert<MultiLocation, Option<CurrencyId>> for CurrencyIdConvert {
     fn convert(location: MultiLocation) -> Option<CurrencyId> {
         if location == MultiLocation::here()
modifiedruntime/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
+}