Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce XcmFeesToAccount fee manager #1234

Merged
merged 153 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
b862137
Introduce XcmFeesToAccount fee manager
KiChjang Apr 4, 2023
b1ca17e
Put system parachain IDs into consts
KiChjang Apr 4, 2023
fa6e6e2
Fixes
KiChjang Apr 4, 2023
48d3a18
Remove XcmFeesToAccount config for Westend
KiChjang Apr 4, 2023
cdc288a
Include Encointer as a system parachain
KiChjang Apr 4, 2023
dc48ba3
Emit warning when deposit_asset fails
KiChjang Apr 5, 2023
1299ad9
Add comment on what happens when deposit_asset errors
KiChjang Apr 5, 2023
8d7a422
Fixes
KiChjang Apr 5, 2023
6f1eaac
Move SystemParachains to constants
KiChjang Apr 6, 2023
24c560e
Fixes
KiChjang Apr 6, 2023
72b8af5
cargo fmt
KiChjang Apr 7, 2023
655b864
Added BridgeHubs constants (#7053)
bkontur Apr 12, 2023
a89c6c2
Add SystemParachain type to Westmint
KiChjang Apr 13, 2023
9512b45
Waive fee handling during benchmarking
KiChjang Apr 28, 2023
e06740f
Fixes
KiChjang Apr 28, 2023
13226de
Fixes
KiChjang Apr 28, 2023
2fee6e5
Rename to ASSET_HUB_ID
KiChjang Jun 22, 2023
758b977
Rename all asset parachains to AssetHub
KiChjang Jun 22, 2023
3a9bcb8
Fixes
KiChjang Aug 28, 2023
298ab71
Send xcm fees to local treaury
gilescope Apr 5, 2023
13f9577
should not include self
gilescope Apr 5, 2023
898645c
Add collectives and contracts.
gilescope Apr 5, 2023
53dfe45
Less error-prone specifying of system parachains
gilescope Apr 7, 2023
58ce029
Typo fix
KiChjang Aug 29, 2023
8853c4a
Fixes
KiChjang Aug 29, 2023
bb36077
Test for `pallet_xcm::reserve_transfer_assets` with paid XcmRouter
bkontur Aug 7, 2023
0681ffd
Fix another assert
bkontur Aug 7, 2023
58fa19f
Potential fix?
bkontur Aug 7, 2023
e07bc53
Even easier
bkontur Aug 7, 2023
d57a819
Potential fix for `fn respond(`
bkontur Aug 7, 2023
3027720
`set_router_fee_for_destination` inside `new_test_ext`
bkontur Aug 7, 2023
7179f08
Added TestPaidForPara3000SendXcm to test
bkontur Aug 8, 2023
9c26367
TODO: remove dependency of `is_waived` on `runtime-benchmarks`
bkontur Aug 8, 2023
510ebc7
Fixed benchmarks to be `FeeManager/XcmFeesToAccount` aware
bkontur Aug 9, 2023
3d372ba
Extract logic to common place to be reused by different runtimes (rel…
bkontur Aug 13, 2023
db595f9
Fix rococo xcm benchmarks
bkontur Aug 14, 2023
2f64173
".git/.scripts/commands/fmt/fmt.sh"
Aug 16, 2023
caa703c
Nits
bkontur Aug 16, 2023
2f0161e
Update polkadot/xcm/xcm-builder/tests/scenarios.rs
KiChjang Aug 29, 2023
b3a62f7
Merge branch 'master' into kckyeung/xcm-fees-manager
KiChjang Aug 29, 2023
84cf8ce
Fixes
KiChjang Aug 29, 2023
78357aa
Improve docs
KiChjang Aug 29, 2023
a9a3f7e
Doc link
KiChjang Aug 29, 2023
a343a07
cargo fmt
KiChjang Aug 29, 2023
680b321
Implement FeeTracker on the XCMP queue pallet
KiChjang Aug 30, 2023
abf8764
Merge remote-tracking branch 'origin/master' into kckyeung/xcm-fees-m…
KiChjang Sep 9, 2023
4a9a309
Fixes
KiChjang Sep 9, 2023
42c80f1
Formatting
KiChjang Sep 9, 2023
760fb9b
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 13, 2023
8ceea34
Add default DeliveryHelper for system parachains
franciscoaguirre Sep 13, 2023
d0df126
Typo
KiChjang Sep 14, 2023
ca69936
Create DeliveryHelper for reserve chains
KiChjang Sep 14, 2023
6469962
Fixes
KiChjang Sep 14, 2023
d29d3a1
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 15, 2023
4f98070
Fix teleports_for_foreign_assets_works test
franciscoaguirre Sep 15, 2023
af68790
Fix teleports_for_native_asset_works
franciscoaguirre Sep 15, 2023
0ccb348
Fix some clippy issues
franciscoaguirre Sep 15, 2023
2748e68
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 15, 2023
8a81521
Fix faulty import
franciscoaguirre Sep 15, 2023
0fd77b7
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 16, 2023
cd4d023
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 18, 2023
678effb
Fix topic issue in tests
franciscoaguirre Sep 18, 2023
36b5833
Fix topic issue in another test
franciscoaguirre Sep 18, 2023
1d439b9
Stop asserting the expected message
franciscoaguirre Sep 18, 2023
6c0e859
Remove unnecessary mut
franciscoaguirre Sep 18, 2023
51a35fb
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 18, 2023
1a20dbb
".git/.scripts/commands/fmt/fmt.sh"
Sep 18, 2023
56383d7
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 25, 2023
ed5fd90
Fix asset-hub-kusama-integration-tests tests
franciscoaguirre Sep 26, 2023
1cfec49
Fix asset-hub-westend-integration-tests tests
franciscoaguirre Sep 26, 2023
59eb4fb
Fix asset-hub-polkadot-integration-tests tests
franciscoaguirre Sep 26, 2023
1e37646
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 26, 2023
b1b7ce8
Refactor xcm helper to a common crate
franciscoaguirre Sep 26, 2023
a71219a
Fix feature propagation
franciscoaguirre Sep 26, 2023
c4fe1ac
".git/.scripts/commands/fmt/fmt.sh"
Sep 26, 2023
f94fc1d
Fix feature propagation for std
franciscoaguirre Sep 26, 2023
b555e59
Fixes
franciscoaguirre Sep 26, 2023
79d8020
Format features
franciscoaguirre Sep 26, 2023
64afc86
".git/.scripts/commands/fmt/fmt.sh"
Sep 26, 2023
797ef39
Fix tests with runtime-benchmarks
franciscoaguirre Sep 26, 2023
7e85258
Fix pallet-xcm tests
franciscoaguirre Sep 26, 2023
6e089e3
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 27, 2023
792f197
Fix polkadot-collectives and bridge-hub-rococo tests
franciscoaguirre Sep 27, 2023
73f2731
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 27, 2023
0c5980f
Fix license issue
franciscoaguirre Sep 27, 2023
72718fd
Remove dbg
franciscoaguirre Sep 27, 2023
3af7624
Change xcm delivery fee helpers to work with UMP
franciscoaguirre Sep 27, 2023
33746fc
Remove remnant from UMP branch
franciscoaguirre Sep 27, 2023
231f548
Remove remnant from UMP branch
franciscoaguirre Sep 27, 2023
36fd612
Fix collectives tests
franciscoaguirre Sep 27, 2023
8d525f7
Wrong constants module being imported
franciscoaguirre Sep 27, 2023
fb4ff56
Add SetFeesMode to expected message in PayOverXcm tests
franciscoaguirre Sep 27, 2023
65c0fc6
Fix ambiguous trait calls
franciscoaguirre Sep 27, 2023
268fa71
Updated lock
franciscoaguirre Sep 27, 2023
ce3d091
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 27, 2023
eecbb12
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 27, 2023
fce81f1
".git/.scripts/commands/fmt/fmt.sh"
Sep 27, 2023
37cd57a
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 27, 2023
fc97690
Remove conflict
franciscoaguirre Sep 27, 2023
a28be66
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 27, 2023
fe48b31
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 28, 2023
4141b93
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 29, 2023
598516e
Add missing import
franciscoaguirre Sep 29, 2023
b9697b6
Remove polkadot and kusama constants
franciscoaguirre Sep 29, 2023
a38ee4c
Remove hardcoded constant
franciscoaguirre Sep 29, 2023
cd11b32
Fix CI
franciscoaguirre Sep 29, 2023
4f5759a
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Sep 29, 2023
df2ff2d
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 2, 2023
29f8003
Address feedback
franciscoaguirre Oct 2, 2023
ec36b49
".git/.scripts/commands/fmt/fmt.sh"
Oct 2, 2023
7329a72
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 3, 2023
6355068
Default FeeManager shouldn't waive fees
franciscoaguirre Oct 4, 2023
9fd00c2
Remove changes to polkadot and kusama system parachains
franciscoaguirre Oct 4, 2023
e30bae6
Update lockfile
franciscoaguirre Oct 4, 2023
d95d13c
Fix emulated tests
franciscoaguirre Oct 5, 2023
842c78b
Tackle no delivery fees scenario in runtime tests
franciscoaguirre Oct 6, 2023
e7e5729
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 9, 2023
1fd76fa
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 10, 2023
53efd8f
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 11, 2023
b062437
Format features
franciscoaguirre Oct 11, 2023
c1c4805
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 11, 2023
b79b016
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 11, 2023
18bcdec
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 12, 2023
73ad0fc
Add UMP pricing (#1556)
franciscoaguirre Oct 12, 2023
9a8e138
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 12, 2023
c7043b8
Merge branch 'master' into kckyeung/xcm-fees-manager
kianenigma Oct 13, 2023
3bd7e28
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 13, 2023
9f0843c
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 17, 2023
97aab4d
Add tests for XCMP and UMP delivery fees
franciscoaguirre Oct 17, 2023
7f4d6d9
Remove an expect
franciscoaguirre Oct 17, 2023
1e187c5
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 17, 2023
5b427bb
Add missing import
franciscoaguirre Oct 17, 2023
fad641e
Remove unused import
franciscoaguirre Oct 17, 2023
6a93770
Move warn to trace
franciscoaguirre Oct 17, 2023
45b9245
".git/.scripts/commands/fmt/fmt.sh"
Oct 17, 2023
5737b62
Add prdoc
franciscoaguirre Oct 17, 2023
96fd58e
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 18, 2023
9c1fced
Fix function call outside of externalities
franciscoaguirre Oct 18, 2023
4e075cf
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 18, 2023
ff3cf19
Fix rococo bridge hub test
franciscoaguirre Oct 18, 2023
dde8475
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 18, 2023
794a52d
Remove 'Here' from waived locations
franciscoaguirre Oct 18, 2023
237d25d
Fix test
franciscoaguirre Oct 18, 2023
4686838
Add XcmFeesToAccount to westend runtime
franciscoaguirre Oct 18, 2023
6a75e67
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 18, 2023
bf9e431
".git/.scripts/commands/fmt/fmt.sh"
Oct 18, 2023
74bb3e0
Add delivery fees to asset hub rococo tests
franciscoaguirre Oct 18, 2023
997a426
".git/.scripts/commands/fmt/fmt.sh"
Oct 18, 2023
4df9871
Merge branch 'master' into kckyeung/xcm-fees-manager
franciscoaguirre Oct 18, 2023
ffcd09f
Fix rococo benchmarks
franciscoaguirre Oct 18, 2023
b24cc02
Fix asset hub rococo bridge test for now
franciscoaguirre Oct 18, 2023
a4e332f
Use derive impl for balances in mock
franciscoaguirre Oct 18, 2023
f3a5ce6
".git/.scripts/commands/fmt/fmt.sh"
Oct 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cumulus/parachains/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ xcm-executor = { path = "../../../polkadot/xcm/xcm-executor", default-features =
pallet-collator-selection = { path = "../../pallets/collator-selection", default-features = false }
cumulus-primitives-core = { path = "../../primitives/core", default-features = false }
cumulus-primitives-utility = { path = "../../primitives/utility", default-features = false }
parachain-info = { path = "../pallets/parachain-info", default-features = false }

[dev-dependencies]
pallet-authorship = { path = "../../../substrate/frame/authorship", default-features = false}
Expand Down
8 changes: 7 additions & 1 deletion cumulus/parachains/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ mod types {
/// Common constants of parachains.
mod constants {
use super::types::BlockNumber;
use frame_support::weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight};
use frame_support::{
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
PalletId,
};
use sp_runtime::Perbill;
/// This determines the average expected block time that we are targeting. Blocks will be
/// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by
Expand Down Expand Up @@ -96,6 +99,9 @@ mod constants {
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
polkadot_primitives::MAX_POV_SIZE as u64,
);

/// Treasury pallet id of the local chain, used to convert into AccountId
pub const TREASURY_PALLET_ID: PalletId = PalletId(*b"py/trsry");
}

/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
Expand Down
24 changes: 22 additions & 2 deletions cumulus/parachains/common/src/xcm_config.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use crate::impls::AccountIdOf;
use core::marker::PhantomData;
use frame_support::{
traits::{fungibles::Inspect, tokens::ConversionToAssetBalance, ContainsPair},
traits::{fungibles::Inspect, tokens::ConversionToAssetBalance, Contains, ContainsPair},
weights::Weight,
};
use log;
use sp_runtime::traits::Get;
use xcm::latest::prelude::*;

Expand Down Expand Up @@ -63,3 +62,24 @@ impl<Location: Get<MultiLocation>> ContainsPair<MultiAsset, MultiLocation>
matches!(asset.id, Concrete(ref id) if id == origin && origin == &Location::get())
}
}

pub struct RelayOrOtherSystemParachains<
SystemParachainMatcher: Contains<MultiLocation>,
Runtime: parachain_info::Config,
> {
_runtime: PhantomData<(SystemParachainMatcher, Runtime)>,
}
impl<SystemParachainMatcher: Contains<MultiLocation>, Runtime: parachain_info::Config>
Contains<MultiLocation> for RelayOrOtherSystemParachains<SystemParachainMatcher, Runtime>
{
fn contains(l: &MultiLocation) -> bool {
let self_para_id: u32 = parachain_info::Pallet::<Runtime>::get().into();
if let MultiLocation { parents: 0, interior: X1(Parachain(para_id)) } = l {
if *para_id == self_para_id {
return false
}
}
matches!(l, MultiLocation { parents: 1, interior: Here }) ||
SystemParachainMatcher::contains(l)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ use frame_support::{
traits::{ConstU32, Contains, Everything, Nothing, PalletInfoAccess},
};
use frame_system::EnsureRoot;
use kusama_parachain::primitives::Sibling;
use kusama_runtime_constants::system_parachain::SystemParachains;
use pallet_xcm::XcmPassthrough;
use parachains_common::{impls::ToStakingPot, xcm_config::AssetFeeAsExistentialDepositMultiplier};
use polkadot_parachain::primitives::Sibling;
use sp_runtime::traits::ConvertInto;
use parachains_common::{
impls::ToStakingPot,
xcm_config::{AssetFeeAsExistentialDepositMultiplier, RelayOrOtherSystemParachains},
TREASURY_PALLET_ID,
};
use sp_runtime::traits::{AccountIdConversion, ConvertInto};
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
Expand All @@ -43,7 +48,7 @@ use xcm_builder::{
NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, XcmFeesToAccount,
};
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};

Expand All @@ -66,6 +71,7 @@ parameter_types! {
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
pub const GovernanceLocation: MultiLocation = MultiLocation::parent();
pub const FellowshipLocation: MultiLocation = MultiLocation::parent();
pub TreasuryAccount: Option<AccountId> = Some(TREASURY_PALLET_ID.into_account_truncating());
}

/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
Expand Down Expand Up @@ -516,7 +522,12 @@ impl xcm_executor::Config for XcmConfig {
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type AssetLocker = ();
type AssetExchanger = ();
type FeeManager = ();
type FeeManager = XcmFeesToAccount<
Self,
RelayOtherOrSystemParachains<SystemParachains, Runtime>,
AccountId,
TreasuryAccount,
>;
type MessageExporter = ();
type UniversalAliases = Nothing;
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ use frame_support::{
};
use frame_system::EnsureRoot;
use pallet_xcm::XcmPassthrough;
use parachains_common::{impls::ToStakingPot, xcm_config::AssetFeeAsExistentialDepositMultiplier};
use parachains_common::{
impls::ToStakingPot,
xcm_config::{AssetFeeAsExistentialDepositMultiplier, RelayOrOtherSystemParachains},
TREASURY_PALLET_ID,
};
use polkadot_parachain::primitives::Sibling;
use sp_runtime::traits::ConvertInto;
use polkadot_runtime_constants::system_parachain::SystemParachains;
use sp_runtime::traits::{AccountIdConversion, ConvertInto};
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
Expand All @@ -39,7 +44,7 @@ use xcm_builder::{
NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, XcmFeesToAccount,
};
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};

Expand All @@ -55,6 +60,7 @@ parameter_types! {
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
pub FellowshipLocation: MultiLocation = MultiLocation::new(1, Parachain(1001));
pub const GovernanceLocation: MultiLocation = MultiLocation::parent();
pub TreasuryAccount: Option<AccountId> = Some(TREASURY_PALLET_ID.into_account_truncating());
}

/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
Expand Down Expand Up @@ -436,7 +442,12 @@ impl xcm_executor::Config for XcmConfig {
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type AssetLocker = ();
type AssetExchanger = ();
type FeeManager = ();
type FeeManager = XcmFeesToAccount<
Self,
RelayOrOtherSystemParachains<SystemParachains, Runtime>,
AccountId,
TreasuryAccount,
>;
type MessageExporter = ();
type UniversalAliases = Nothing;
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ use frame_support::{
};
use frame_system::EnsureRoot;
use pallet_xcm::XcmPassthrough;
use parachains_common::{impls::ToStakingPot, xcm_config::AssetFeeAsExistentialDepositMultiplier};
use parachains_common::{
impls::ToStakingPot,
xcm_config::{AssetFeeAsExistentialDepositMultiplier, RelayOrOtherSystemParachains},
TREASURY_PALLET_ID,
};
use polkadot_parachain::primitives::Sibling;
use sp_runtime::traits::ConvertInto;
use sp_runtime::traits::{AccountIdConversion, ConvertInto};
use westend_runtime_constants::system_parachain::SystemParachains;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
Expand All @@ -42,7 +47,7 @@ use xcm_builder::{
LocalMint, NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, XcmFeesToAccount,
};
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};

Expand All @@ -63,6 +68,7 @@ parameter_types! {
pub PoolAssetsPalletLocation: MultiLocation =
PalletInstance(<PoolAssets as PalletInfoAccess>::index() as u8).into();
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
pub TreasuryAccount: Option<AccountId> = Some(TREASURY_PALLET_ID.into_account_truncating());
}

/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
Expand Down Expand Up @@ -519,7 +525,12 @@ impl xcm_executor::Config for XcmConfig {
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type AssetLocker = ();
type AssetExchanger = ();
type FeeManager = ();
type FeeManager = XcmFeesToAccount<
Self,
RelayOrOtherSystemParachains<SystemParachains, Runtime>,
AccountId,
TreasuryAccount,
>;
type MessageExporter = ();
type UniversalAliases = Nothing;
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ use frame_support::{
traits::{ConstU32, Contains, Everything, Nothing},
};
use frame_system::EnsureRoot;
use kusama_runtime_constants::system_parachain::SystemParachains;
use pallet_xcm::XcmPassthrough;
use parachains_common::{impls::ToStakingPot, xcm_config::ConcreteNativeAssetFrom};
use parachains_common::{
impls::ToStakingPot,
xcm_config::{ConcreteNativeAssetFrom, RelayOrOtherSystemParachains},
TREASURY_PALLET_ID,
};
use polkadot_parachain::primitives::Sibling;
use sp_runtime::traits::AccountIdConversion;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
Expand All @@ -34,6 +40,7 @@ use xcm_builder::{
ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
XcmFeesToAccount,
};
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};

Expand All @@ -47,6 +54,7 @@ parameter_types! {
pub const MaxAssetsIntoHolding: u32 = 64;
pub const GovernanceLocation: MultiLocation = MultiLocation::parent();
pub const FellowshipLocation: MultiLocation = MultiLocation::parent();
pub TreasuryAccount: Option<AccountId> = Some(TREASURY_PALLET_ID.into_account_truncating());
}

/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
Expand Down Expand Up @@ -205,7 +213,12 @@ impl xcm_executor::Config for XcmConfig {
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type AssetLocker = ();
type AssetExchanger = ();
type FeeManager = ();
type FeeManager = XcmFeesToAccount<
Self,
RelayOrOtherSystemParachains<SystemParachains, Runtime>,
AccountId,
TreasuryAccount,
>;
type MessageExporter = ();
type UniversalAliases = Nothing;
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ use frame_support::{
};
use frame_system::EnsureRoot;
use pallet_xcm::XcmPassthrough;
use parachains_common::{impls::ToStakingPot, xcm_config::ConcreteNativeAssetFrom};
use parachains_common::{
impls::ToStakingPot,
xcm_config::{ConcreteNativeAssetFrom, RelayOrOtherSystemParachains},
TREASURY_PALLET_ID,
};
use polkadot_parachain::primitives::Sibling;
use polkadot_runtime_constants::system_parachain::SystemParachains;
use sp_runtime::traits::AccountIdConversion;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
Expand All @@ -34,6 +40,7 @@ use xcm_builder::{
ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
XcmFeesToAccount,
};
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};

Expand All @@ -47,6 +54,7 @@ parameter_types! {
pub const MaxAssetsIntoHolding: u32 = 64;
pub FellowshipLocation: MultiLocation = MultiLocation::new(1, Parachain(1001));
pub const GovernanceLocation: MultiLocation = MultiLocation::parent();
pub TreasuryAccount: Option<AccountId> = Some(TREASURY_PALLET_ID.into_account_truncating());
}

/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
Expand Down Expand Up @@ -209,7 +217,12 @@ impl xcm_executor::Config for XcmConfig {
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type AssetLocker = ();
type AssetExchanger = ();
type FeeManager = ();
type FeeManager = XcmFeesToAccount<
Self,
RelayOrOtherSystemParachains<SystemParachains, Runtime>,
AccountId,
TreasuryAccount,
>;
type MessageExporter = ();
type UniversalAliases = Nothing;
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
Expand Down
Loading