mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 18:21:02 +00:00
Use WeightToFee when calculating cost of each weight unit in XCM trader (#1055)
* Use WeightToFee when calculating cost of each weight unit in XCM trader * Set the OnUnbalanced type parameter for XCM Traders
This commit is contained in:
@@ -1,14 +1,15 @@
|
|||||||
use super::{
|
use super::{
|
||||||
AccountId, Balance, Balances, Call, Event, Origin, ParachainInfo, ParachainSystem, PolkadotXcm,
|
AccountId, Balances, Call, Event, Origin, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime,
|
||||||
Runtime, XcmpQueue,
|
WeightToFee, XcmpQueue,
|
||||||
};
|
};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
match_types, parameter_types,
|
match_types, parameter_types,
|
||||||
traits::{Everything, Nothing},
|
traits::{Everything, Nothing},
|
||||||
weights::{IdentityFee, Weight},
|
weights::Weight,
|
||||||
};
|
};
|
||||||
use pallet_xcm::XcmPassthrough;
|
use pallet_xcm::XcmPassthrough;
|
||||||
use polkadot_parachain::primitives::Sibling;
|
use polkadot_parachain::primitives::Sibling;
|
||||||
|
use polkadot_runtime_common::impls::ToAuthor;
|
||||||
use xcm::latest::prelude::*;
|
use xcm::latest::prelude::*;
|
||||||
use xcm_builder::{
|
use xcm_builder::{
|
||||||
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
|
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
|
||||||
@@ -105,7 +106,8 @@ impl xcm_executor::Config for XcmConfig {
|
|||||||
type LocationInverter = LocationInverter<Ancestry>;
|
type LocationInverter = LocationInverter<Ancestry>;
|
||||||
type Barrier = Barrier;
|
type Barrier = Barrier;
|
||||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||||
type Trader = UsingComponents<IdentityFee<Balance>, RelayLocation, AccountId, Balances, ()>;
|
type Trader =
|
||||||
|
UsingComponents<WeightToFee, RelayLocation, AccountId, Balances, ToAuthor<Runtime>>;
|
||||||
type ResponseHandler = PolkadotXcm;
|
type ResponseHandler = PolkadotXcm;
|
||||||
type AssetTrap = PolkadotXcm;
|
type AssetTrap = PolkadotXcm;
|
||||||
type AssetClaims = PolkadotXcm;
|
type AssetClaims = PolkadotXcm;
|
||||||
|
|||||||
@@ -14,13 +14,13 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
AccountId, Balance, Balances, Call, Event, Origin, ParachainInfo, ParachainSystem, PolkadotXcm,
|
AccountId, Balances, Call, Event, Origin, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime,
|
||||||
Runtime, XcmpQueue,
|
WeightToFee, XcmpQueue,
|
||||||
};
|
};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
match_types, parameter_types,
|
match_types, parameter_types,
|
||||||
traits::{EnsureOneOf, Everything, Nothing},
|
traits::{EnsureOneOf, Everything, Nothing},
|
||||||
weights::{IdentityFee, Weight},
|
weights::Weight,
|
||||||
};
|
};
|
||||||
use frame_system::EnsureRoot;
|
use frame_system::EnsureRoot;
|
||||||
use pallet_xcm::{EnsureXcm, IsMajorityOfBody, XcmPassthrough};
|
use pallet_xcm::{EnsureXcm, IsMajorityOfBody, XcmPassthrough};
|
||||||
@@ -139,7 +139,7 @@ impl xcm_executor::Config for XcmConfig {
|
|||||||
type LocationInverter = LocationInverter<Ancestry>;
|
type LocationInverter = LocationInverter<Ancestry>;
|
||||||
type Barrier = Barrier;
|
type Barrier = Barrier;
|
||||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||||
type Trader = UsingComponents<IdentityFee<Balance>, RelayLocation, AccountId, Balances, ()>;
|
type Trader = UsingComponents<WeightToFee, RelayLocation, AccountId, Balances, ()>;
|
||||||
type ResponseHandler = PolkadotXcm;
|
type ResponseHandler = PolkadotXcm;
|
||||||
type AssetTrap = PolkadotXcm;
|
type AssetTrap = PolkadotXcm;
|
||||||
type AssetClaims = PolkadotXcm;
|
type AssetClaims = PolkadotXcm;
|
||||||
|
|||||||
@@ -15,14 +15,15 @@
|
|||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
AccountId, AssetId, Assets, Balance, Balances, Call, Event, Origin, ParachainInfo,
|
AccountId, AssetId, Assets, Balance, Balances, Call, Event, Origin, ParachainInfo,
|
||||||
ParachainSystem, PolkadotXcm, Runtime, XcmpQueue,
|
ParachainSystem, PolkadotXcm, Runtime, WeightToFee, XcmpQueue,
|
||||||
};
|
};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
match_types, parameter_types,
|
match_types, parameter_types,
|
||||||
traits::{Everything, Nothing, PalletInfoAccess},
|
traits::{Everything, Nothing, PalletInfoAccess},
|
||||||
weights::{IdentityFee, Weight},
|
weights::Weight,
|
||||||
};
|
};
|
||||||
use pallet_xcm::XcmPassthrough;
|
use pallet_xcm::XcmPassthrough;
|
||||||
|
use parachains_common::impls::ToStakingPot;
|
||||||
use polkadot_parachain::primitives::Sibling;
|
use polkadot_parachain::primitives::Sibling;
|
||||||
use xcm::latest::prelude::*;
|
use xcm::latest::prelude::*;
|
||||||
use xcm_builder::{
|
use xcm_builder::{
|
||||||
@@ -160,7 +161,8 @@ impl xcm_executor::Config for XcmConfig {
|
|||||||
type LocationInverter = LocationInverter<Ancestry>;
|
type LocationInverter = LocationInverter<Ancestry>;
|
||||||
type Barrier = Barrier;
|
type Barrier = Barrier;
|
||||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||||
type Trader = UsingComponents<IdentityFee<Balance>, KsmLocation, AccountId, Balances, ()>;
|
type Trader =
|
||||||
|
UsingComponents<WeightToFee, KsmLocation, AccountId, Balances, ToStakingPot<Runtime>>;
|
||||||
type ResponseHandler = PolkadotXcm;
|
type ResponseHandler = PolkadotXcm;
|
||||||
type AssetTrap = PolkadotXcm;
|
type AssetTrap = PolkadotXcm;
|
||||||
type AssetClaims = PolkadotXcm;
|
type AssetClaims = PolkadotXcm;
|
||||||
|
|||||||
@@ -15,14 +15,15 @@
|
|||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
AccountId, AssetId, Assets, Balance, Balances, Call, Event, Origin, ParachainInfo,
|
AccountId, AssetId, Assets, Balance, Balances, Call, Event, Origin, ParachainInfo,
|
||||||
ParachainSystem, PolkadotXcm, Runtime, XcmpQueue,
|
ParachainSystem, PolkadotXcm, Runtime, WeightToFee, XcmpQueue,
|
||||||
};
|
};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
match_types, parameter_types,
|
match_types, parameter_types,
|
||||||
traits::{Everything, Nothing, PalletInfoAccess},
|
traits::{Everything, Nothing, PalletInfoAccess},
|
||||||
weights::{IdentityFee, Weight},
|
weights::Weight,
|
||||||
};
|
};
|
||||||
use pallet_xcm::XcmPassthrough;
|
use pallet_xcm::XcmPassthrough;
|
||||||
|
use parachains_common::impls::ToStakingPot;
|
||||||
use polkadot_parachain::primitives::Sibling;
|
use polkadot_parachain::primitives::Sibling;
|
||||||
use xcm::latest::prelude::*;
|
use xcm::latest::prelude::*;
|
||||||
use xcm_builder::{
|
use xcm_builder::{
|
||||||
@@ -160,7 +161,8 @@ impl xcm_executor::Config for XcmConfig {
|
|||||||
type LocationInverter = LocationInverter<Ancestry>;
|
type LocationInverter = LocationInverter<Ancestry>;
|
||||||
type Barrier = Barrier;
|
type Barrier = Barrier;
|
||||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||||
type Trader = UsingComponents<IdentityFee<Balance>, DotLocation, AccountId, Balances, ()>;
|
type Trader =
|
||||||
|
UsingComponents<WeightToFee, DotLocation, AccountId, Balances, ToStakingPot<Runtime>>;
|
||||||
type ResponseHandler = PolkadotXcm;
|
type ResponseHandler = PolkadotXcm;
|
||||||
type AssetTrap = PolkadotXcm;
|
type AssetTrap = PolkadotXcm;
|
||||||
type AssetClaims = PolkadotXcm;
|
type AssetClaims = PolkadotXcm;
|
||||||
|
|||||||
@@ -15,14 +15,15 @@
|
|||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
AccountId, AssetId, Assets, Balance, Balances, Call, Event, Origin, ParachainInfo,
|
AccountId, AssetId, Assets, Balance, Balances, Call, Event, Origin, ParachainInfo,
|
||||||
ParachainSystem, PolkadotXcm, Runtime, XcmpQueue,
|
ParachainSystem, PolkadotXcm, Runtime, WeightToFee, XcmpQueue,
|
||||||
};
|
};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
match_types, parameter_types,
|
match_types, parameter_types,
|
||||||
traits::{Everything, PalletInfoAccess},
|
traits::{Everything, PalletInfoAccess},
|
||||||
weights::{IdentityFee, Weight},
|
weights::Weight,
|
||||||
};
|
};
|
||||||
use pallet_xcm::XcmPassthrough;
|
use pallet_xcm::XcmPassthrough;
|
||||||
|
use parachains_common::impls::ToStakingPot;
|
||||||
use polkadot_parachain::primitives::Sibling;
|
use polkadot_parachain::primitives::Sibling;
|
||||||
use xcm::latest::prelude::*;
|
use xcm::latest::prelude::*;
|
||||||
use xcm_builder::{
|
use xcm_builder::{
|
||||||
@@ -156,7 +157,8 @@ impl xcm_executor::Config for XcmConfig {
|
|||||||
type LocationInverter = LocationInverter<Ancestry>;
|
type LocationInverter = LocationInverter<Ancestry>;
|
||||||
type Barrier = Barrier;
|
type Barrier = Barrier;
|
||||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||||
type Trader = UsingComponents<IdentityFee<Balance>, WestendLocation, AccountId, Balances, ()>;
|
type Trader =
|
||||||
|
UsingComponents<WeightToFee, WestendLocation, AccountId, Balances, ToStakingPot<Runtime>>;
|
||||||
type ResponseHandler = PolkadotXcm;
|
type ResponseHandler = PolkadotXcm;
|
||||||
type AssetTrap = PolkadotXcm;
|
type AssetTrap = PolkadotXcm;
|
||||||
type AssetClaims = PolkadotXcm;
|
type AssetClaims = PolkadotXcm;
|
||||||
|
|||||||
Reference in New Issue
Block a user