diff --git a/src/contracts/BPool.sol b/src/contracts/BPool.sol index 53ae2576..8e2f0774 100644 --- a/src/contracts/BPool.sol +++ b/src/contracts/BPool.sol @@ -383,7 +383,7 @@ contract BPool is BBronze, BToken, BMath { calcInGivenOut(tokenInBalance, inRecord.denorm, tokenOutBalance, outRecord.denorm, tokenAmountOut, _swapFee); require(tokenAmountIn <= maxAmountIn, 'ERR_LIMIT_IN'); - tokenOutBalance = badd(tokenOutBalance, tokenAmountIn); + tokenInBalance = badd(tokenInBalance, tokenAmountIn); tokenOutBalance = bsub(tokenOutBalance, tokenAmountOut); spotPriceAfter = calcSpotPrice(tokenInBalance, inRecord.denorm, tokenOutBalance, outRecord.denorm, _swapFee); diff --git a/test/unit/BPool.t.sol b/test/unit/BPool.t.sol index 9c59a572..e5a7ed81 100644 --- a/test/unit/BPool.t.sol +++ b/test/unit/BPool.t.sol @@ -794,9 +794,7 @@ contract BPool_Unit_SwapExactAmountOut is BasePoolTest { _; } - // TODO: fix this test function test_HappyPath(SwapExactAmountOut_FuzzScenario memory _fuzz) public happyPath(_fuzz) { - vm.skip(true); uint256 _maxPrice = type(uint256).max; uint256 _maxAmountIn = type(uint256).max; bPool.swapExactAmountOut(tokenIn, _maxAmountIn, tokenOut, _fuzz.tokenAmountOut, _maxPrice);