Skip to content

Commit 4b205ba

Browse files
Update comment
1 parent 6a8d95b commit 4b205ba

File tree

1 file changed

+17
-11
lines changed
  • cumulus/parachains/runtimes/assets/asset-hub-westend/src

1 file changed

+17
-11
lines changed

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

+17-11
Original file line numberDiff line numberDiff line change
@@ -2166,40 +2166,46 @@ impl_runtime_apis! {
21662166

21672167
let wnd: Location = Parent.into();
21682168
let (account, _) = pallet_xcm_benchmarks::account_and_location::<Runtime>(1);
2169+
let signed_origin = RuntimeOrigin::signed(account.clone());
21692170

21702171
// Simulate the maximum possible assets for 'give' and 'receive'
21712172
let mut give_assets = XcmAssets::new();
21722173
let mut receive_assets = XcmAssets::new();
21732174

2174-
// Setup AssetHubWestend assets
2175+
// Setup assets and pools
21752176
for i in 0..MAX_ITEMS_IN_ASSETS {
21762177
let asset_id: AssetId = Location::new(1, [Parachain((2000 + i) as u32)]).into();
21772178

2178-
// Create pool
2179+
// Mint foreign asset
21792180
assert_ok!(ForeignAssets::mint(
2180-
RuntimeOrigin::root(),
2181+
signed_origin.clone(),
21812182
asset_id.clone().into(),
21822183
account.clone().into(),
21832184
3 * UNITS,
21842185
));
2186+
2187+
// Create pool
21852188
assert_ok!(AssetConversion::create_pool(
2186-
RuntimeOrigin::root(),
2189+
signed_origin.clone(),
21872190
wnd.clone().into(),
21882191
asset_id.clone().into(),
21892192
));
2193+
2194+
// Add liquidity
21902195
assert_ok!(AssetConversion::add_liquidity(
2191-
RuntimeOrigin::root(),
2196+
signed_origin.clone(),
21922197
wnd.clone().into(),
21932198
asset_id.clone().into(),
2194-
1 * UNITS,
2195-
2 * UNITS,
2196-
1,
2197-
1,
2199+
1 * UNITS, // wnd amount
2200+
2 * UNITS, // asset_id amount
2201+
1, // min wnd
2202+
1, // min asset_id
21982203
account.clone().into(),
21992204
));
22002205

2201-
give_assets.push((asset_id.clone(), 1 * UNITS).into());
2202-
receive_assets.push((asset_id, 2 * UNITS).into());
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
22032209
}
22042210

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

0 commit comments

Comments
 (0)