Skip to content

Commit

Permalink
fix: zero check
Browse files Browse the repository at this point in the history
  • Loading branch information
fp-crypto committed Jan 3, 2025
1 parent f707353 commit e72d078
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/yearn-vaults-v3
4 changes: 2 additions & 2 deletions src/swappers/UniswapV3Swapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e72d078

Please sign in to comment.