@@ -2164,48 +2164,40 @@ impl_runtime_apis! {
2164
2164
fn worst_case_asset_exchange( ) -> Result <( XcmAssets , XcmAssets ) , BenchmarkError > {
2165
2165
use xcm:: latest:: MAX_ITEMS_IN_ASSETS ;
2166
2166
2167
- let wnd : Location = Parent . into ( ) ;
2167
+ let relay_location = WestendLocation :: get ( ) ;
2168
2168
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( ) ) ;
2170
2170
2171
2171
// Simulate the maximum possible assets for 'give' and 'receive'
2172
2172
let mut give_assets = XcmAssets :: new( ) ;
2173
2173
let mut receive_assets = XcmAssets :: new( ) ;
2174
2174
2175
2175
// Setup assets and pools
2176
2176
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( ) ) ;
2178
2179
2179
2180
// 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 ) ?;
2187
2183
// 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 ) ?;
2194
2186
// 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 ,
2203
2195
account. clone( ) . into( ) ,
2204
- ) ) ;
2196
+ )
2197
+ . map_err( |_| BenchmarkError :: Override ) ?;
2205
2198
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( ) ) ;
2209
2201
}
2210
2202
2211
2203
Ok ( ( give_assets. into( ) , receive_assets. into( ) ) )
0 commit comments