Skip to content

Commit

Permalink
Fix the issue of xtokens transferring local tokens using relative loc…
Browse files Browse the repository at this point in the history
…ation (#515)
  • Loading branch information
imstar15 authored Apr 9, 2024
1 parent 5ab8ba2 commit 1abdbdc
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 21 deletions.
6 changes: 3 additions & 3 deletions runtime/neumann/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ use polkadot_runtime_common::BlockHashCount;

// XCM configurations.
pub mod xcm_config;
use xcm_config::{FeePerSecondProvider, SelfLocation, ToTreasury, TokenIdConvert};
use xcm_config::{FeePerSecondProvider, SelfLocationAbsolute, ToTreasury, TokenIdConvert};

pub mod weights;

Expand Down Expand Up @@ -920,8 +920,8 @@ impl pallet_automation_time::Config for Runtime {
type EnsureProxy = AutomationEnsureProxy;
type UniversalLocation = UniversalLocation;
type TransferCallCreator = MigrationTransferCallCreator;
type ReserveProvider = AbsoluteAndRelativeReserveProvider<SelfLocation>;
type SelfLocation = SelfLocation;
type ReserveProvider = AbsoluteAndRelativeReserveProvider<SelfLocationAbsolute>;
type SelfLocation = SelfLocationAbsolute;
}

impl pallet_automation_price::Config for Runtime {
Expand Down
9 changes: 5 additions & 4 deletions runtime/neumann/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ impl cumulus_pallet_dmp_queue::Config for Runtime {
}

parameter_types! {
pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::parachain_id().into())));
pub SelfLocation: MultiLocation = Here.into_location();
pub SelfLocationAbsolute: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::parachain_id().into())));
pub const BaseXcmWeight: Weight = Weight::from_parts(100_000_000, 0);
pub const MaxAssetsForTransfer: usize = 1;
}
Expand All @@ -291,7 +292,7 @@ impl orml_xtokens::Config for Runtime {
type BaseXcmWeight = BaseXcmWeight;
type UniversalLocation = UniversalLocation;
type MaxAssetsForTransfer = MaxAssetsForTransfer;
type ReserveProvider = AbsoluteReserveProvider;
type ReserveProvider = AbsoluteAndRelativeReserveProvider<SelfLocationAbsolute>;
}

impl orml_unknown_tokens::Config for Runtime {
Expand All @@ -315,8 +316,8 @@ impl pallet_xcmp_handler::Config for Runtime {
type XcmSender = XcmRouter;
type XcmExecutor = XcmExecutor<XcmConfig>;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type ReserveProvider = AbsoluteAndRelativeReserveProvider<SelfLocation>;
type SelfLocation = SelfLocation;
type ReserveProvider = AbsoluteAndRelativeReserveProvider<SelfLocationAbsolute>;
type SelfLocation = SelfLocationAbsolute;
}

pub struct TokenIdConvert;
Expand Down
6 changes: 3 additions & 3 deletions runtime/oak/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ use polkadot_runtime_common::BlockHashCount;

// XCM configurations.
pub mod xcm_config;
use xcm_config::{FeePerSecondProvider, SelfLocation, ToTreasury, TokenIdConvert};
use xcm_config::{FeePerSecondProvider, SelfLocationAbsolute, ToTreasury, TokenIdConvert};

pub mod weights;

Expand Down Expand Up @@ -948,8 +948,8 @@ impl pallet_automation_time::Config for Runtime {
type EnsureProxy = AutomationEnsureProxy;
type UniversalLocation = UniversalLocation;
type TransferCallCreator = MigrationTransferCallCreator;
type ReserveProvider = AbsoluteAndRelativeReserveProvider<SelfLocation>;
type SelfLocation = SelfLocation;
type ReserveProvider = AbsoluteAndRelativeReserveProvider<SelfLocationAbsolute>;
type SelfLocation = SelfLocationAbsolute;
}

impl pallet_automation_price::Config for Runtime {
Expand Down
9 changes: 5 additions & 4 deletions runtime/oak/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ impl cumulus_pallet_dmp_queue::Config for Runtime {
}

parameter_types! {
pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::parachain_id().into())));
pub SelfLocation: MultiLocation = Here.into_location();
pub SelfLocationAbsolute: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::parachain_id().into())));
pub const BaseXcmWeight: Weight = Weight::from_parts(100_000_000, 0);
pub const MaxAssetsForTransfer: usize = 1;
}
Expand All @@ -295,7 +296,7 @@ impl orml_xtokens::Config for Runtime {
type BaseXcmWeight = BaseXcmWeight;
type UniversalLocation = UniversalLocation;
type MaxAssetsForTransfer = MaxAssetsForTransfer;
type ReserveProvider = AbsoluteReserveProvider;
type ReserveProvider = AbsoluteAndRelativeReserveProvider<SelfLocationAbsolute>;
}

impl orml_unknown_tokens::Config for Runtime {
Expand All @@ -319,8 +320,8 @@ impl pallet_xcmp_handler::Config for Runtime {
type XcmSender = XcmRouter;
type XcmExecutor = XcmExecutor<XcmConfig>;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type ReserveProvider = AbsoluteAndRelativeReserveProvider<SelfLocation>;
type SelfLocation = SelfLocation;
type ReserveProvider = AbsoluteAndRelativeReserveProvider<SelfLocationAbsolute>;
type SelfLocation = SelfLocationAbsolute;
}

pub struct TokenIdConvert;
Expand Down
6 changes: 3 additions & 3 deletions runtime/turing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ use polkadot_runtime_common::BlockHashCount;

// XCM configurations.
pub mod xcm_config;
use xcm_config::{FeePerSecondProvider, SelfLocation, ToTreasury, TokenIdConvert};
use xcm_config::{FeePerSecondProvider, SelfLocationAbsolute, ToTreasury, TokenIdConvert};

pub mod weights;

Expand Down Expand Up @@ -943,8 +943,8 @@ impl pallet_automation_time::Config for Runtime {
type EnsureProxy = AutomationEnsureProxy;
type UniversalLocation = UniversalLocation;
type TransferCallCreator = MigrationTransferCallCreator;
type ReserveProvider = AbsoluteAndRelativeReserveProvider<SelfLocation>;
type SelfLocation = SelfLocation;
type ReserveProvider = AbsoluteAndRelativeReserveProvider<SelfLocationAbsolute>;
type SelfLocation = SelfLocationAbsolute;
}

impl pallet_automation_price::Config for Runtime {
Expand Down
9 changes: 5 additions & 4 deletions runtime/turing/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ impl cumulus_pallet_dmp_queue::Config for Runtime {
}

parameter_types! {
pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::parachain_id().into())));
pub SelfLocation: MultiLocation = Here.into_location();
pub SelfLocationAbsolute: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::parachain_id().into())));
pub const BaseXcmWeight: Weight = Weight::from_parts(100_000_000, 0);
pub const MaxAssetsForTransfer: usize = 1;
}
Expand All @@ -295,7 +296,7 @@ impl orml_xtokens::Config for Runtime {
type BaseXcmWeight = BaseXcmWeight;
type UniversalLocation = UniversalLocation;
type MaxAssetsForTransfer = MaxAssetsForTransfer;
type ReserveProvider = AbsoluteReserveProvider;
type ReserveProvider = AbsoluteAndRelativeReserveProvider<SelfLocationAbsolute>;
}

impl orml_unknown_tokens::Config for Runtime {
Expand All @@ -319,8 +320,8 @@ impl pallet_xcmp_handler::Config for Runtime {
type XcmSender = XcmRouter;
type XcmExecutor = XcmExecutor<XcmConfig>;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type ReserveProvider = AbsoluteAndRelativeReserveProvider<SelfLocation>;
type SelfLocation = SelfLocation;
type ReserveProvider = AbsoluteAndRelativeReserveProvider<SelfLocationAbsolute>;
type SelfLocation = SelfLocationAbsolute;
}

pub struct TokenIdConvert;
Expand Down

0 comments on commit 1abdbdc

Please sign in to comment.