From a926bf8919678e901c6d8f0ae1eed5a1f1d2ff17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wei=C3=9Fer=20Hase?= Date: Tue, 16 Jul 2024 15:40:52 +0200 Subject: [PATCH] feat: increasing max swap fee to 99.999% --- src/contracts/BConst.sol | 2 +- test/unit/BPool.t.sol | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/contracts/BConst.sol b/src/contracts/BConst.sol index 3a184a01..5e42302c 100644 --- a/src/contracts/BConst.sol +++ b/src/contracts/BConst.sol @@ -17,7 +17,7 @@ contract BConst { /// @notice The minimum swap fee that can be set. uint256 public constant MIN_FEE = BONE / 10 ** 6; /// @notice The maximum swap fee that can be set. - uint256 public constant MAX_FEE = BONE / 10; + uint256 public constant MAX_FEE = BONE - MIN_FEE; /// @notice The immutable exit fee percentage uint256 public constant EXIT_FEE = 0; diff --git a/test/unit/BPool.t.sol b/test/unit/BPool.t.sol index 39f5fedd..97ad7488 100644 --- a/test/unit/BPool.t.sol +++ b/test/unit/BPool.t.sol @@ -243,6 +243,7 @@ abstract contract BasePoolTest is Test, BConst, Utils, BMath { uint256 _zoo = bsub(BONE, _normalizedWeight); uint256 _zar = bmul(_zoo, _swapFee); uint256 _tokenAmountOutBeforeSwapFee = bdiv(_tokenAmountOut, bsub(BONE, _zar)); + vm.assume(_tokenOutBalance >= _tokenAmountOutBeforeSwapFee); uint256 _newTokenOutBalance = bsub(_tokenOutBalance, _tokenAmountOutBeforeSwapFee); vm.assume(_newTokenOutBalance < type(uint256).max / _tokenOutBalance); @@ -1379,6 +1380,7 @@ contract BPool_Unit_ExitswapPoolAmountIn is BasePoolTest { _fuzz.poolAmountIn, _fuzz.swapFee ); + vm.assume(_fuzz.tokenOutBalance < type(uint256).max / MAX_OUT_RATIO); vm.assume(_tokenAmountOut > bmul(_fuzz.tokenOutBalance, MAX_OUT_RATIO)); _setValues(_fuzz);