Fix prices function
This commit is contained in:
@@ -106,6 +106,7 @@ contract BalancerV2SwapAdapter is ISwapAdapter {
|
|||||||
address buyToken,
|
address buyToken,
|
||||||
uint256[] memory specifiedAmounts
|
uint256[] memory specifiedAmounts
|
||||||
) external returns (Fraction[] memory calculatedPrices) {
|
) external returns (Fraction[] memory calculatedPrices) {
|
||||||
|
calculatedPrices = new Fraction[](specifiedAmounts.length);
|
||||||
for (uint256 i = 0; i < specifiedAmounts.length; i++) {
|
for (uint256 i = 0; i < specifiedAmounts.length; i++) {
|
||||||
calculatedPrices[i] =
|
calculatedPrices[i] =
|
||||||
priceSingle(poolId, sellToken, buyToken, specifiedAmounts[i]);
|
priceSingle(poolId, sellToken, buyToken, specifiedAmounts[i]);
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ contract BalancerV2SwapAdapterTest is Test, ISwapAdapterTypes {
|
|||||||
|
|
||||||
function testPrice() public {
|
function testPrice() public {
|
||||||
uint256[] memory amounts = new uint256[](2);
|
uint256[] memory amounts = new uint256[](2);
|
||||||
amounts[0] = amount0;
|
amounts[0] = 1e18;
|
||||||
amounts[1] = amount1;
|
amounts[1] = 2e18;
|
||||||
|
|
||||||
Fraction[] memory prices = adapter.price(B_80BAL_20WETH_POOL_ID, BAL, WETH, amounts);
|
Fraction[] memory prices = adapter.price(B_80BAL_20WETH_POOL_ID, BAL, WETH, amounts);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user