Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Asset conversion nits #2860

Merged
merged 29 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d17f3ce
[asset-conv] Unused Balances type
bkontur Jul 13, 2023
3ec9dd4
[asset-conv] native asset change
bkontur Jul 13, 2023
a249fb4
Dedicated `AssetBalance` type for `pallet_assets` instances
bkontur Jul 14, 2023
fefbed3
Merge remote-tracking branch 'origin/master' into bko-asset-conv
bkontur Jul 14, 2023
691e6df
Improved local vs foreign asset handling + test for not allowing pool…
bkontur Jul 14, 2023
a6e428d
Removed `into_multiasset_id`
bkontur Jul 14, 2023
6636b6b
Fix
bkontur Jul 14, 2023
5e404f3
Refactor
bkontur Jul 14, 2023
b8f86cf
Fixed create_pool for benchmark with LocalAndForeignAssets (finally f…
bkontur Jul 14, 2023
757a07b
Merge remote-tracking branch 'origin/master' into bko-asset-conv
bkontur Jul 14, 2023
f2d5086
".git/.scripts/commands/fmt/fmt.sh"
Jul 14, 2023
3726ab8
Revert
bkontur Jul 15, 2023
c86ec4e
Merge remote-tracking branch 'origin/bko-asset-conv' into bko-asset-conv
bkontur Jul 15, 2023
7733ee3
fmt
bkontur Jul 15, 2023
02890dd
Migrates pools with `MultiLocation { parents: 0, interior: Here }` to…
bkontur Jul 17, 2023
ac8accb
Allow `set_storage` for `AllowMultiAssetPools` / `LiquidityWithdrawal…
bkontur Jul 17, 2023
636c6ed
Merge remote-tracking branch 'origin/master' into bko-asset-conv
bkontur Jul 18, 2023
4ed8483
Benchmarks work
bkontur Jul 18, 2023
899590f
Merge remote-tracking branch 'origin/master' into bko-asset-conv
bkontur Jul 18, 2023
6964a27
Removed comment + more defensive migration
bkontur Jul 19, 2023
c01e7d7
`T::Currency::transfer` -> `Balances::transfer_all` in migration
bkontur Jul 19, 2023
73b4521
Change pool_id in migration
bkontur Jul 19, 2023
a301fda
Update parachains/runtimes/assets/asset-hub-westend/src/lib.rs
jsidorenko Jul 19, 2023
45af713
Merge remote-tracking branch 'origin/master' into bko-asset-conv
Jul 21, 2023
8c6275c
Merge remote-tracking branch 'origin/master' into bko-asset-conv
bkontur Jul 21, 2023
7fb4784
Bump substrate (manually)
bkontur Jul 21, 2023
b8f0892
Bump polkadot
bkontur Jul 21, 2023
d2f6b85
Fixes from polkadot + clippy
bkontur Jul 21, 2023
d8bcb0b
Fix for xcm-emulator tests (thank you Nacho)
bkontur Jul 21, 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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use xcm_emulator::Parachain;
fn swap_locally_on_chain_using_local_assets() {
const ASSET_ID: u32 = 1;

let asset_native = Box::new(MultiLocation { parents: 0, interior: Here });
let asset_native = Box::new(asset_hub_westend_runtime::xcm_config::WestendLocation::get());
let asset_one = Box::new(MultiLocation {
parents: 0,
interior: X2(PalletInstance(50), GeneralIndex(ASSET_ID.into())),
Expand Down Expand Up @@ -99,7 +99,7 @@ fn swap_locally_on_chain_using_foreign_assets() {
use frame_support::weights::WeightToFee;

const ASSET_ID: u32 = 1;
let asset_native = Box::new(MultiLocation { parents: 0, interior: Here });
let asset_native = Box::new(asset_hub_westend_runtime::xcm_config::WestendLocation::get());

let foreign_asset1_at_asset_hub_westend = Box::new(MultiLocation {
parents: 1,
Expand Down
2 changes: 1 addition & 1 deletion parachains/runtimes/assets/asset-hub-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ impl pallet_asset_conversion::Config for Runtime {
type MaxSwapPathLength = ConstU32<4>;

type MultiAssetId = Box<MultiLocation>;
type MultiAssetIdConverter = MultiLocationConverter<Balances, UniversalLocation>;
type MultiAssetIdConverter = MultiLocationConverter<UniversalLocation, WestendLocation>;

type MintMinLiquidity = ConstU128<100>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use pallet_asset_conversion::MultiAssetIdConverter;
use parachains_common::{AccountId, AssetIdForTrustBackedAssets};
use sp_runtime::{traits::MaybeEquivalence, DispatchResult};
use sp_std::{boxed::Box, marker::PhantomData};
use xcm::{latest::MultiLocation, opaque::lts::Junctions::Here};
use xcm::latest::MultiLocation;
use xcm_builder::AsPrefixedGeneralIndex;
use xcm_executor::traits::JustTry;

Expand All @@ -41,18 +41,18 @@ fn is_local<TrustBackedAssetsPalletLocation: Get<MultiLocation>>(
AsPrefixedGeneralIndex::<TrustBackedAssetsPalletLocation, AssetIdForTrustBackedAssets, JustTry>::convert(&multilocation)
}

pub struct MultiLocationConverter<Balances, ParachainLocation: Get<InteriorMultiLocation>> {
_phantom: PhantomData<(Balances, ParachainLocation)>,
pub struct MultiLocationConverter<ParachainLocation: Get<InteriorMultiLocation>, NativeAssetLocation: Get<MultiLocation>> {
_phantom: PhantomData<(ParachainLocation, NativeAssetLocation)>,
}

impl<Balances, ParachainLocation> MultiAssetIdConverter<Box<MultiLocation>, MultiLocation>
for MultiLocationConverter<Balances, ParachainLocation>
impl<ParachainLocation, NativeAssetLocation> MultiAssetIdConverter<Box<MultiLocation>, MultiLocation>
for MultiLocationConverter<ParachainLocation, NativeAssetLocation>
where
Balances: PalletInfoAccess,
ParachainLocation: Get<InteriorMultiLocation>,
NativeAssetLocation: Get<MultiLocation>,
{
fn get_native() -> Box<MultiLocation> {
Box::new(MultiLocation { parents: 0, interior: Here })
Box::new(NativeAssetLocation::get())
}

fn is_native(asset_id: &Box<MultiLocation>) -> bool {
Expand Down