Asset Conversion: Pool Account ID derivation with additional Pallet ID seed (#3250)

Introduce `PalletId` as an additional seed parameter for pool's account
id derivation.

The PR also introduces the `pallet_asset_conversion_ops` pallet with a
call to migrate a given pool to thew new account. Additionally
`fungibles::lifetime::ResetTeam` and `fungible::lifetime::Refund`
traits, to facilitate the migration of pools.

---------

Co-authored-by: command-bot <>
This commit is contained in:
Muharem
2024-04-17 12:39:23 +02:00
committed by GitHub
parent e6f3106d89
commit 4e10d3b0a6
31 changed files with 1647 additions and 39 deletions
@@ -244,6 +244,11 @@ ord_parameter_types! {
pub const AssetConversionOrigin: u64 = AccountIdConversion::<u64>::into_account_truncating(&AssetConversionPalletId::get());
}
pub type PoolIdToAccountId = pallet_asset_conversion::AccountIdConverter<
AssetConversionPalletId,
(NativeOrWithId<u32>, NativeOrWithId<u32>),
>;
impl pallet_asset_conversion::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
@@ -252,8 +257,8 @@ impl pallet_asset_conversion::Config for Runtime {
type Assets = UnionOf<Balances, Assets, NativeFromLeft, NativeOrWithId<u32>, AccountId>;
type PoolId = (Self::AssetKind, Self::AssetKind);
type PoolLocator = Chain<
WithFirstAsset<Native, AccountId, NativeOrWithId<u32>>,
Ascending<AccountId, NativeOrWithId<u32>>,
WithFirstAsset<Native, AccountId, NativeOrWithId<u32>, PoolIdToAccountId>,
Ascending<AccountId, NativeOrWithId<u32>, PoolIdToAccountId>,
>;
type PoolAssetId = u32;
type PoolAssets = PoolAssets;