Skip to content

Commit b5c98a6

Browse files
Update code style
1 parent 4b205ba commit b5c98a6

File tree

1 file changed

+20
-28
lines changed
  • cumulus/parachains/runtimes/assets/asset-hub-westend/src

1 file changed

+20
-28
lines changed

cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs

+20-28
Original file line numberDiff line numberDiff line change
@@ -2164,48 +2164,40 @@ impl_runtime_apis! {
21642164
fn worst_case_asset_exchange() -> Result<(XcmAssets, XcmAssets), BenchmarkError> {
21652165
use xcm::latest::MAX_ITEMS_IN_ASSETS;
21662166

2167-
let wnd: Location = Parent.into();
2167+
let relay_location = WestendLocation::get();
21682168
let (account, _) = pallet_xcm_benchmarks::account_and_location::<Runtime>(1);
2169-
let signed_origin = RuntimeOrigin::signed(account.clone());
2169+
let origin = RuntimeOrigin::signed(account.clone());
21702170

21712171
// Simulate the maximum possible assets for 'give' and 'receive'
21722172
let mut give_assets = XcmAssets::new();
21732173
let mut receive_assets = XcmAssets::new();
21742174

21752175
// Setup assets and pools
21762176
for i in 0..MAX_ITEMS_IN_ASSETS {
2177-
let asset_id: AssetId = Location::new(1, [Parachain((2000 + i) as u32)]).into();
2177+
let asset_location = Location::new(1, [Parachain((2000 + i) as u32)]);
2178+
let asset_id = AssetId(asset_location.clone());
21782179

21792180
// Mint foreign asset
2180-
assert_ok!(ForeignAssets::mint(
2181-
signed_origin.clone(),
2182-
asset_id.clone().into(),
2183-
account.clone().into(),
2184-
3 * UNITS,
2185-
));
2186-
2181+
ForeignAssets::mint(origin.clone(), asset_location.clone().into(), account.clone().into(), 3_000 * UNITS)
2182+
.map_err(|_| BenchmarkError::Override)?;
21872183
// Create pool
2188-
assert_ok!(AssetConversion::create_pool(
2189-
signed_origin.clone(),
2190-
wnd.clone().into(),
2191-
asset_id.clone().into(),
2192-
));
2193-
2184+
AssetConversion::create_pool(origin.clone(), relay_location.clone().into(), asset_location.clone().into())
2185+
.map_err(|_| BenchmarkError::Override)?;
21942186
// Add liquidity
2195-
assert_ok!(AssetConversion::add_liquidity(
2196-
signed_origin.clone(),
2197-
wnd.clone().into(),
2198-
asset_id.clone().into(),
2199-
1 * UNITS, // wnd amount
2200-
2 * UNITS, // asset_id amount
2201-
1, // min wnd
2202-
1, // min asset_id
2187+
AssetConversion::add_liquidity(
2188+
origin.clone(),
2189+
relay_location.clone().into(),
2190+
asset_location.clone().into(),
2191+
1_000 * UNITS,
2192+
2_000 * UNITS,
2193+
1,
2194+
1,
22032195
account.clone().into(),
2204-
));
2196+
)
2197+
.map_err(|_| BenchmarkError::Override)?;
22052198

2206-
// Adjust give/receive to match pool ratio (1 wnd : 2 asset_id)
2207-
give_assets.push((wnd.clone().into(), 1 * UNITS).into()); // Give 1 wnd
2208-
receive_assets.push((asset_id.clone(), 2 * UNITS).into()); // Receive 2 asset_id
2199+
give_assets.push((AssetId(relay_location.clone()), 1_000 * UNITS).into());
2200+
receive_assets.push((asset_id, 2_000 * UNITS).into());
22092201
}
22102202

22112203
Ok((give_assets.into(), receive_assets.into()))

0 commit comments

Comments
 (0)