difftreelog
feat(xcm) reenable xtokens on qtz/unq, allow moonbeam on unq
in: master
4 files changed
runtime/common/construct_runtime/mod.rsdiffbeforeafterboth42 Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,42 Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,43 Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,43 Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,44 Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,44 Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,45 #[runtimes(opal)]4546 XTokens: orml_xtokens = 38,46 XTokens: orml_xtokens = 38,47 Tokens: orml_tokens = 39,47 Tokens: orml_tokens = 39,48 // Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,48 // Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,runtime/opal/src/xcm_config.rsdiffbeforeafterboth498impl 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;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.rsdiffbeforeafterboth88 MultiLocation { parents: 1, interior: Here },88 MultiLocation { parents: 1, interior: Here },89 // Karura/Acala location89 // Karura/Acala location90 MultiLocation { parents: 1, interior: X1(Parachain(2000)) },90 MultiLocation { parents: 1, interior: X1(Parachain(2000)) },91 // Moonbeam location92 MultiLocation { parents: 1, interior: X1(Parachain(2004)) },91 // Self parachain address93 // Self parachain address92 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}203205206impl 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}222223pub 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}204235205parameter_types! {236parameter_types! {206 pub const BaseXcmWeight: Weight = 100_000_000; // TODO: recheck this237 pub const BaseXcmWeight: Weight = 100_000_000; // TODO: recheck this207 pub const MaxAssetsForTransfer: usize = 2;238 pub const MaxAssetsForTransfer: usize = 2;239240 pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();241 pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into())));208}242}209243210parameter_type_with_key! {244parameter_type_with_key! {