-
Notifications
You must be signed in to change notification settings - Fork 379
Pay XCM execution with local and foreign assets #2854
base: master
Are you sure you want to change the base?
Changes from 7 commits
c322b41
a303989
2e11c16
6a7b39c
b1e4532
470903b
7b334af
76a3c1a
a155a90
a33ce58
9b1be53
9548d4b
4839910
bd91d47
308abf0
f59d16a
88c4e31
94aef1d
081517f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ use assets_common::{ | |
matching::{ | ||
FromSiblingParachain, IsForeignConcreteAsset, StartsWith, StartsWithExplicitGlobalConsensus, | ||
}, | ||
AssetIdForTrustBackedAssetsConvert, | ||
}; | ||
use frame_support::{ | ||
match_types, parameter_types, | ||
|
@@ -46,6 +47,7 @@ use xcm_builder::{ | |
}; | ||
use xcm_executor::{traits::WithOriginFilter, XcmExecutor}; | ||
|
||
use assets_common::local_and_foreign_assets::LocalAndForeignAssets; | ||
#[cfg(feature = "runtime-benchmarks")] | ||
use {cumulus_primitives_core::ParaId, sp_core::Get}; | ||
|
||
|
@@ -469,12 +471,19 @@ impl xcm_executor::Config for XcmConfig { | |
>; | ||
type Trader = ( | ||
UsingComponents<WeightToFee, WestendLocation, AccountId, Balances, ToStakingPot<Runtime>>, | ||
cumulus_primitives_utility::TakeFirstAssetTrader< | ||
AccountId, | ||
AssetFeeAsExistentialDepositMultiplierFeeCharger, | ||
cumulus_primitives_utility::SwapFirstAssetTrader< | ||
PatricioNapoli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Runtime, | ||
LocationToAccountId, | ||
pallet_asset_conversion::Pallet<Runtime>, | ||
WeightToFee, | ||
TrustBackedAssetsConvertedConcreteId, | ||
Assets, | ||
LocalAndForeignAssets< | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also
it took me a while to find a issue with this missing overridden implementations b8f86cf and I am afraid that there could be possible other hidden bugs (maybe not), |
||
Assets, | ||
AssetIdForTrustBackedAssetsConvert<TrustBackedAssetsPalletLocation>, | ||
ForeignAssets, | ||
>, | ||
cumulus_primitives_utility::XcmFeesTo32ByteAccount< | ||
// Revenue could also be Foreign Fungible? Maybe with multi-asset treasury..? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, although Treasury here is just a normal |
||
FungiblesTransactor, | ||
AccountId, | ||
XcmAssetFeesReceiver, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understand is, that we can use the same
TakeFirstAssetTrader
and only provide a differentBalanceToAssetBalance
converter forAssetFeeAsExistentialDepositMultiplierFeeCharger
type.The converter which does the conversion based on the price provided by the pool, instead of min balances ration.
The rest can probably be reused.
One important thing is that the
Trader
is not supposed to perform any transfers/swaps, but only subtract the amount from thepayment
it receives as an argument, place it into its own register to be paid later ondrop
and return theunused
, the executor will placeunused
back to itsholding
register.The
payment
received as an argument is a credit from the executor's holding register, which was already withdrawn from the user's account.I am not really an expert in this topic, but this how I understanding it after reading the executor codebase and it make sense to me, please validate.