Fix prices function

This commit is contained in:
Louise Poole
2024-04-15 17:41:16 +01:00
parent 306293764c
commit 45dc7aa457
2 changed files with 3 additions and 2 deletions

View File

@@ -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]);

View File

@@ -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);