@@ -2166,40 +2166,46 @@ impl_runtime_apis! {
2166
2166
2167
2167
let wnd: Location = Parent . into( ) ;
2168
2168
let ( account, _) = pallet_xcm_benchmarks:: account_and_location:: <Runtime >( 1 ) ;
2169
+ let signed_origin = RuntimeOrigin :: signed( account. clone( ) ) ;
2169
2170
2170
2171
// Simulate the maximum possible assets for 'give' and 'receive'
2171
2172
let mut give_assets = XcmAssets :: new( ) ;
2172
2173
let mut receive_assets = XcmAssets :: new( ) ;
2173
2174
2174
- // Setup AssetHubWestend assets
2175
+ // Setup assets and pools
2175
2176
for i in 0 ..MAX_ITEMS_IN_ASSETS {
2176
2177
let asset_id: AssetId = Location :: new( 1 , [ Parachain ( ( 2000 + i) as u32 ) ] ) . into( ) ;
2177
2178
2178
- // Create pool
2179
+ // Mint foreign asset
2179
2180
assert_ok!( ForeignAssets :: mint(
2180
- RuntimeOrigin :: root ( ) ,
2181
+ signed_origin . clone ( ) ,
2181
2182
asset_id. clone( ) . into( ) ,
2182
2183
account. clone( ) . into( ) ,
2183
2184
3 * UNITS ,
2184
2185
) ) ;
2186
+
2187
+ // Create pool
2185
2188
assert_ok!( AssetConversion :: create_pool(
2186
- RuntimeOrigin :: root ( ) ,
2189
+ signed_origin . clone ( ) ,
2187
2190
wnd. clone( ) . into( ) ,
2188
2191
asset_id. clone( ) . into( ) ,
2189
2192
) ) ;
2193
+
2194
+ // Add liquidity
2190
2195
assert_ok!( AssetConversion :: add_liquidity(
2191
- RuntimeOrigin :: root ( ) ,
2196
+ signed_origin . clone ( ) ,
2192
2197
wnd. clone( ) . into( ) ,
2193
2198
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
2198
2203
account. clone( ) . into( ) ,
2199
2204
) ) ;
2200
2205
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
2203
2209
}
2204
2210
2205
2211
Ok ( ( give_assets. into( ) , receive_assets. into( ) ) )
0 commit comments