From f7073537f2329325fd9cc2eb5ccab4cc88e280e6 Mon Sep 17 00:00:00 2001 From: FP <83050944+fp-crypto@users.noreply.github.com> Date: Fri, 3 Jan 2025 10:41:49 -0800 Subject: [PATCH 1/2] fix: minAmountToSellComparison --- src/swappers/UniswapV3Swapper.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/swappers/UniswapV3Swapper.sol b/src/swappers/UniswapV3Swapper.sol index 16c941d..3256739 100644 --- a/src/swappers/UniswapV3Swapper.sol +++ b/src/swappers/UniswapV3Swapper.sol @@ -75,7 +75,7 @@ contract UniswapV3Swapper { uint256 _amountIn, uint256 _minAmountOut ) internal virtual returns (uint256 _amountOut) { - if (_amountIn > minAmountToSell) { + if (_amountIn >= minAmountToSell) { _checkAllowance(router, _from, _amountIn); if (_from == base || _to == base) { ISwapRouter.ExactInputSingleParams memory params = ISwapRouter @@ -138,7 +138,7 @@ contract UniswapV3Swapper { uint256 _amountTo, uint256 _maxAmountFrom ) internal virtual returns (uint256 _amountIn) { - if (_maxAmountFrom > minAmountToSell) { + if (_maxAmountFrom >= minAmountToSell) { _checkAllowance(router, _from, _maxAmountFrom); if (_from == base || _to == base) { ISwapRouter.ExactOutputSingleParams memory params = ISwapRouter From 4485a748872009e89569aef87347580d095ed633 Mon Sep 17 00:00:00 2001 From: FP Date: Fri, 3 Jan 2025 11:05:19 -0800 Subject: [PATCH 2/2] fix: zero check --- src/swappers/UniswapV3Swapper.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/swappers/UniswapV3Swapper.sol b/src/swappers/UniswapV3Swapper.sol index 3256739..424121c 100644 --- a/src/swappers/UniswapV3Swapper.sol +++ b/src/swappers/UniswapV3Swapper.sol @@ -75,7 +75,7 @@ contract UniswapV3Swapper { uint256 _amountIn, uint256 _minAmountOut ) internal virtual returns (uint256 _amountOut) { - if (_amountIn >= minAmountToSell) { + if (_amountIn != 0 && _amountIn >= minAmountToSell) { _checkAllowance(router, _from, _amountIn); if (_from == base || _to == base) { ISwapRouter.ExactInputSingleParams memory params = ISwapRouter @@ -138,7 +138,7 @@ contract UniswapV3Swapper { uint256 _amountTo, uint256 _maxAmountFrom ) internal virtual returns (uint256 _amountIn) { - if (_maxAmountFrom >= minAmountToSell) { + if (_maxAmountFrom != 0 && _maxAmountFrom >= minAmountToSell) { _checkAllowance(router, _from, _maxAmountFrom); if (_from == base || _to == base) { ISwapRouter.ExactOutputSingleParams memory params = ISwapRouter