From b74d4c9e25a8ced0b506352a431a88fb36aea991 Mon Sep 17 00:00:00 2001 From: TAMARA LIPOWSKI Date: Thu, 6 Mar 2025 10:37:37 -0500 Subject: [PATCH] chore: remove unnecessary min amount check, doc fix --- foundry/src/TychoRouter.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/foundry/src/TychoRouter.sol b/foundry/src/TychoRouter.sol index a84a1ba..29ac360 100644 --- a/foundry/src/TychoRouter.sol +++ b/foundry/src/TychoRouter.sol @@ -124,7 +124,7 @@ contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard { * @param amountIn The input token amount to be swapped. * @param tokenIn The address of the input token. Use `address(0)` for native ETH * @param tokenOut The address of the output token. Use `address(0)` for native ETH - * @param minAmountOut The minimum acceptable amount of the output token. Reverts if this condition is not met. If it's 0, no check is performed. + * @param minAmountOut The minimum acceptable amount of the output token. Reverts if this condition is not met. This should always be set to avoid losing funds due to slippage. * @param wrapEth If true, wraps the input token (native ETH) into WETH. * @param unwrapEth If true, unwraps the resulting WETH into native ETH and sends it to the receiver. * @param nTokens The total number of tokens involved in the swap graph (used to initialize arrays for internal calculations). @@ -174,7 +174,7 @@ contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard { * @param amountIn The input token amount to be swapped. * @param tokenIn The address of the input token. Use `address(0)` for native ETH * @param tokenOut The address of the output token. Use `address(0)` for native ETH - * @param minAmountOut The minimum acceptable amount of the output token. Reverts if this condition is not met. If it's 0, no check is performed. + * @param minAmountOut The minimum acceptable amount of the output token. Reverts if this condition is not met. This should always be set to avoid losing funds due to slippage. * @param wrapEth If true, wraps the input token (native ETH) into WETH. * @param unwrapEth If true, unwraps the resulting WETH into native ETH and sends it to the receiver. * @param nTokens The total number of tokens involved in the swap graph (used to initialize arrays for internal calculations). @@ -278,7 +278,7 @@ contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard { IERC20(tokenOut).safeTransfer(feeReceiver, feeAmount); } - if (minAmountOut > 0 && amountOut < minAmountOut) { + if (amountOut < minAmountOut) { revert TychoRouter__NegativeSlippage(amountOut, minAmountOut); }