From 45dc7aa45778c9301be90f2859ea79a724d0df79 Mon Sep 17 00:00:00 2001 From: Louise Poole Date: Mon, 15 Apr 2024 17:41:16 +0100 Subject: [PATCH] Fix prices function --- evm/src/balancer-v2/BalancerV2SwapAdapter.sol | 1 + evm/test/BalancerV2SwapAdapter.t.sol | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/evm/src/balancer-v2/BalancerV2SwapAdapter.sol b/evm/src/balancer-v2/BalancerV2SwapAdapter.sol index 040aba9..e93702b 100644 --- a/evm/src/balancer-v2/BalancerV2SwapAdapter.sol +++ b/evm/src/balancer-v2/BalancerV2SwapAdapter.sol @@ -106,6 +106,7 @@ contract BalancerV2SwapAdapter is ISwapAdapter { address buyToken, uint256[] memory specifiedAmounts ) external returns (Fraction[] memory calculatedPrices) { + calculatedPrices = new Fraction[](specifiedAmounts.length); for (uint256 i = 0; i < specifiedAmounts.length; i++) { calculatedPrices[i] = priceSingle(poolId, sellToken, buyToken, specifiedAmounts[i]); diff --git a/evm/test/BalancerV2SwapAdapter.t.sol b/evm/test/BalancerV2SwapAdapter.t.sol index a336af8..3be35a5 100644 --- a/evm/test/BalancerV2SwapAdapter.t.sol +++ b/evm/test/BalancerV2SwapAdapter.t.sol @@ -40,8 +40,8 @@ contract BalancerV2SwapAdapterTest is Test, ISwapAdapterTypes { function testPrice() public { uint256[] memory amounts = new uint256[](2); - amounts[0] = amount0; - amounts[1] = amount1; + amounts[0] = 1e18; + amounts[1] = 2e18; Fraction[] memory prices = adapter.price(B_80BAL_20WETH_POOL_ID, BAL, WETH, amounts);