Skip to content

Commit

Permalink
xcm nit
Browse files Browse the repository at this point in the history
  • Loading branch information
bkontur committed May 24, 2024
1 parent 42dd2e9 commit d39cfd6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,7 @@ impl_runtime_apis! {
use sp_storage::TrackedStorageKey;
use xcm::latest::prelude::{
Asset, Fungible, Here, InteriorLocation, Junction, Junction::*, Location, NetworkId,
NonFungible, Parent, ParentThen, Response, XCM_VERSION,
NonFungible, Parent, ParentThen, Response, XCM_VERSION, Assets as XcmAssets,
};

use frame_system_benchmarking::Pallet as SystemBench;
Expand Down Expand Up @@ -1446,7 +1446,7 @@ impl_runtime_apis! {
}

fn set_up_complex_asset_transfer(
) -> Option<(xcm::v4::Assets, u32, Location, Box<dyn FnOnce()>)> {
) -> Option<(XcmAssets, u32, Location, Box<dyn FnOnce()>)> {
// Transfer to Relay some local AH asset (local-reserve-transfer) while paying
// fees using teleported native token.
// (We don't care that Relay doesn't accept incoming unknown AH local asset)
Expand Down Expand Up @@ -1477,7 +1477,7 @@ impl_runtime_apis! {
);
let transfer_asset: Asset = (asset_location, asset_amount).into();

let assets: xcm::v4::Assets = vec![fee_asset.clone(), transfer_asset].into();
let assets: XcmAssets = vec![fee_asset.clone(), transfer_asset].into();
let fee_index = if assets.get(0).unwrap().eq(&fee_asset) { 0 } else { 1 };

// verify transferred successfully
Expand Down Expand Up @@ -1513,7 +1513,7 @@ impl_runtime_apis! {
fn valid_destination() -> Result<Location, BenchmarkError> {
Ok(KsmLocation::get())
}
fn worst_case_holding(depositable_count: u32) -> xcm::v4::Assets {
fn worst_case_holding(depositable_count: u32) -> XcmAssets {
// A mix of fungible, non-fungible, and concrete assets.
let holding_non_fungibles = MaxAssetsIntoHolding::get() / 2 - depositable_count;
let holding_fungibles = holding_non_fungibles.saturating_sub(2); // -2 for two `iter::once` bellow
Expand Down Expand Up @@ -1574,7 +1574,7 @@ impl_runtime_apis! {
(0u64, Response::Version(Default::default()))
}

fn worst_case_asset_exchange() -> Result<(xcm::v4::Assets, xcm::v4::Assets), BenchmarkError> {
fn worst_case_asset_exchange() -> Result<(XcmAssets, XcmAssets), BenchmarkError> {
Err(BenchmarkError::Skip)
}

Expand All @@ -1591,9 +1591,9 @@ impl_runtime_apis! {
Ok(KsmLocation::get())
}

fn claimable_asset() -> Result<(Location, Location, xcm::v4::Assets), BenchmarkError> {
fn claimable_asset() -> Result<(Location, Location, XcmAssets), BenchmarkError> {
let origin = KsmLocation::get();
let assets: xcm::v4::Assets = (AssetId(KsmLocation::get()), 1_000 * UNITS).into();
let assets: XcmAssets = (AssetId(KsmLocation::get()), 1_000 * UNITS).into();
let ticket = Location { parents: 0, interior: Here };
Ok((origin, ticket, assets))
}
Expand Down
14 changes: 7 additions & 7 deletions system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ impl_runtime_apis! {
use sp_storage::TrackedStorageKey;
use xcm::latest::prelude::{
Asset, Fungible, Here, InteriorLocation, Junction, Junction::*, Location, NetworkId,
NonFungible, Parent, ParentThen, Response, XCM_VERSION,
NonFungible, Parent, ParentThen, Response, XCM_VERSION, Assets as XcmAssets,
};

use frame_system_benchmarking::Pallet as SystemBench;
Expand Down Expand Up @@ -1438,7 +1438,7 @@ impl_runtime_apis! {
}

fn set_up_complex_asset_transfer(
) -> Option<(xcm::v4::Assets, u32, Location, Box<dyn FnOnce()>)> {
) -> Option<(XcmAssets, u32, Location, Box<dyn FnOnce()>)> {
// Transfer to Relay some local AH asset (local-reserve-transfer) while paying
// fees using teleported native token.
// (We don't care that Relay doesn't accept incoming unknown AH local asset)
Expand Down Expand Up @@ -1469,7 +1469,7 @@ impl_runtime_apis! {
);
let transfer_asset: Asset = (asset_location, asset_amount).into();

let assets: xcm::v4::Assets = vec![fee_asset.clone(), transfer_asset].into();
let assets: XcmAssets = vec![fee_asset.clone(), transfer_asset].into();
let fee_index = if assets.get(0).unwrap().eq(&fee_asset) { 0 } else { 1 };

// verify transferred successfully
Expand Down Expand Up @@ -1505,7 +1505,7 @@ impl_runtime_apis! {
fn valid_destination() -> Result<Location, BenchmarkError> {
Ok(DotLocation::get())
}
fn worst_case_holding(depositable_count: u32) -> xcm::v4::Assets {
fn worst_case_holding(depositable_count: u32) -> XcmAssets {
// A mix of fungible, non-fungible, and concrete assets.
let holding_non_fungibles = MaxAssetsIntoHolding::get() / 2 - depositable_count;
let holding_fungibles = holding_non_fungibles.saturating_sub(2); // -2 for two `iter::once` bellow
Expand Down Expand Up @@ -1566,7 +1566,7 @@ impl_runtime_apis! {
(0u64, Response::Version(Default::default()))
}

fn worst_case_asset_exchange() -> Result<(xcm::v4::Assets, xcm::v4::Assets), BenchmarkError> {
fn worst_case_asset_exchange() -> Result<(XcmAssets, XcmAssets), BenchmarkError> {
Err(BenchmarkError::Skip)
}

Expand All @@ -1583,9 +1583,9 @@ impl_runtime_apis! {
Ok(DotLocation::get())
}

fn claimable_asset() -> Result<(Location, Location, xcm::v4::Assets), BenchmarkError> {
fn claimable_asset() -> Result<(Location, Location, XcmAssets), BenchmarkError> {
let origin = DotLocation::get();
let assets: xcm::v4::Assets = (AssetId(DotLocation::get()), 1_000 * UNITS).into();
let assets: XcmAssets = (AssetId(DotLocation::get()), 1_000 * UNITS).into();
let ticket = Location { parents: 0, interior: Here };
Ok((origin, ticket, assets))
}
Expand Down

0 comments on commit d39cfd6

Please sign in to comment.