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
--- 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;
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
88 MultiLocation { parents: 1, interior: Here },88 MultiLocation { parents: 1, interior: Here },
89 // Karura/Acala location89 // Karura/Acala location
90 MultiLocation { parents: 1, interior: X1(Parachain(2000)) },90 MultiLocation { parents: 1, interior: X1(Parachain(2000)) },
91 // Moonbeam location
92 MultiLocation { parents: 1, interior: X1(Parachain(2004)) },
91 // Self parachain address93 // Self parachain address
92 MultiLocation { parents: 1, interior: X1(Parachain(ParachainInfo::get().into())) },94 MultiLocation { parents: 1, interior: X1(Parachain(ParachainInfo::get().into())) },
93 ]95 ]
201 type OnKilledTokenAccount = ();203 type OnKilledTokenAccount = ();
202}204}
203205
206impl orml_xtokens::Config for Runtime {
207 type Event = Event;
208 type Balance = Balance;
209 type CurrencyId = CurrencyId;
210 type CurrencyIdConvert = CurrencyIdConvert;
211 type AccountIdToMultiLocation = AccountIdToMultiLocation;
212 type SelfLocation = SelfLocation;
213 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;
214 type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
215 type BaseXcmWeight = BaseXcmWeight;
216 type LocationInverter = LocationInverter<Ancestry>;
217 type MaxAssetsForTransfer = MaxAssetsForTransfer;
218 type MinXcmFee = ParachainMinFee;
219 type MultiLocationsFilter = Everything;
220 type ReserveProvider = AbsoluteReserveProvider;
221}
222
223pub struct CurrencyIdConvert;
224impl Convert<AssetIds, Option<MultiLocation>> for CurrencyIdConvert {
225 fn convert(id: AssetIds) -> Option<MultiLocation> {
226 match id {
227 AssetIds::NativeAssetId(NativeCurrency::Here) => Some(MultiLocation::new(
228 1,
229 X1(Parachain(ParachainInfo::get().into())),
230 )),
231 _ => None,
232 }
233 }
234}
204235
205parameter_types! {236parameter_types! {
206 pub const BaseXcmWeight: Weight = 100_000_000; // TODO: recheck this237 pub const BaseXcmWeight: Weight = 100_000_000; // TODO: recheck this
207 pub const MaxAssetsForTransfer: usize = 2;238 pub const MaxAssetsForTransfer: usize = 2;
239
240 pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
241 pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into())));
208}242}
209243
210parameter_type_with_key! {244parameter_type_with_key! {