From e72d0788ab38e98f8f96c0237d65a68f44fa6f40 Mon Sep 17 00:00:00 2001 From: FP Date: Fri, 3 Jan 2025 11:03:51 -0800 Subject: [PATCH] fix: zero check --- Makefile | 3 ++- lib/forge-std | 2 +- lib/openzeppelin-contracts | 2 +- lib/tokenized-strategy | 2 +- lib/yearn-vaults-v3 | 2 +- src/swappers/UniswapV3Swapper.sol | 4 ++-- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index eb1d3e8..b9f5fe4 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,8 @@ trace-contract :; forge test -vvv --match-contract $(contract) --fork-url ${FOR test-test :; forge test -vv --match-test $(test) --fork-url ${FORK_URL} --ffi trace-test :; forge test -vvv --match-test $(test) --fork-url ${FORK_URL} --ffi -script :; forge script script/${script} --rpc-url ${FORK_URL} --broadcast -vvv +run-script :; forge script ${script} --rpc-url ${FORK_URL} -vv +broadcast-script :; forge script ${script} --rpc-url ${FORK_URL} -vv snapshot :; forge snapshot --fork-url ${FORK_URL} --ffi diff :; forge snapshot --diff --fork-url ${FORK_URL} --ffi diff --git a/lib/forge-std b/lib/forge-std index e8a047e..5dd1c68 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit e8a047e3f40f13fa37af6fe14e6e06283d9a060e +Subproject commit 5dd1c68131ddd3c89ef169666eb262b92e90507c diff --git a/lib/openzeppelin-contracts b/lib/openzeppelin-contracts index bd325d5..dc44c9f 160000 --- a/lib/openzeppelin-contracts +++ b/lib/openzeppelin-contracts @@ -1 +1 @@ -Subproject commit bd325d56b4c62c9c5c1aff048c37c6bb18ac0290 +Subproject commit dc44c9f1a4c3b10af99492eed84f83ed244203f6 diff --git a/lib/tokenized-strategy b/lib/tokenized-strategy index 8280628..7bf1870 160000 --- a/lib/tokenized-strategy +++ b/lib/tokenized-strategy @@ -1 +1 @@ -Subproject commit 82806289f967590c4efbf6bc3d237e4e7f0a0966 +Subproject commit 7bf187015f5f7159276f80cd52204431ab1b3b8b diff --git a/lib/yearn-vaults-v3 b/lib/yearn-vaults-v3 index 104a2b2..9fbc614 160000 --- a/lib/yearn-vaults-v3 +++ b/lib/yearn-vaults-v3 @@ -1 +1 @@ -Subproject commit 104a2b233bc6d43ba40720d68355b04d2dc31795 +Subproject commit 9fbc614bbce9d7cbad42e284a15f0f43cf1a673f 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