From 4485a748872009e89569aef87347580d095ed633 Mon Sep 17 00:00:00 2001 From: FP Date: Fri, 3 Jan 2025 11:05:19 -0800 Subject: [PATCH] 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