Omniscia Tokemak Network Audit

SushiSwapControllerV2 Code Style Findings

SushiSwapControllerV2 Code Style Findings

SSC-01C: Redundant Evaluation

TypeSeverityLocation
Gas OptimizationInformationalSushiSwapControllerV2.sol:L83

Description:

The linked liquidity evaluation is redundant given that the SushiSwap system internally validates that it is always non-zero and the dynamic balance evaluation that follows it also guarantees that it is non-zero.

Example:

contracts/controllers/SushiSwapControllerV2.sol
72( , , uint256 liquidity) = SUSHISWAP_ROUTER.addLiquidity(
73 tokenA,
74 tokenB,
75 amountADesired,
76 amountBDesired,
77 amountAMin,
78 amountBMin,
79 to,
80 deadline
81);
82
83require(liquidity > 0, "ZERO_BALANCE");
84uint256 balanceAfter = pair.balanceOf(address(this));
85require(balanceAfter > balanceBefore, "MUST_INCREASE");

Recommendation:

We advise it to be omitted from the codebase.

Alleviation:

The linked require check has been safely omitted from the codebase.