Omniscia Steer Protocol Audit

LiquidityManagerHelper Code Style Findings

LiquidityManagerHelper Code Style Findings

LMH-01C: Ineffectual Usage of Safe Arithmetics

TypeSeverityLocation
Language SpecificLiquidityManagerHelper.sol:
I-1: L120
I-2: L121

Description:

The linked mathematical operations are guaranteed to be performed safely by surrounding conditionals evaluated in either require checks or if-else constructs.

Example:

src/helpers/LiquidityManagerHelper.sol
120amount0Used = ((cross - 1) / total1) + 1;
121amount1Used = ((cross - 1) / total0) + 1;

Recommendation:

Given that safe arithmetics are toggled on by default in pragma versions of 0.8.X, we advise the linked statements to be wrapped in unchecked code blocks thereby optimizing their execution cost.

Alleviation (121dc0b1329a48555f90bb92e58a95e8ff8a7c79):

An unchecked code block has been introduced for the referenced operations, optimizing their gas cost.

LMH-02C: Redundant Salt Argument

Description:

The salt argument of the LiquidityManagerHelper::_previewBurn function will always be bytes32(0) within the LiquidityManagerHelper and LiquidityManagerVault contracts, rendering it redundant.

Example:

src/helpers/LiquidityManagerHelper.sol
150) external view override returns (uint256 total0, uint256 total1) {
151 // Start with tokens currently held inside the vault
152 total0 = vaultBalance0;
153 total1 = vaultBalance1;
154
155 // Calculate value in positions
156 for (uint256 i = 0; i < positions.length; i++) {
157 (uint256 amount0, uint256 amount1) = _previewBurn(
158 poolManager,
159 poolId,
160 vaultAddress,
161 positions[i].lowerTick,
162 positions[i].upperTick,
163 bytes32(0),
164 totalFee,
165 feeDivisor
166 );
167 total0 += amount0;
168 total1 += amount1;
169 }
170}
171
172/// @notice Preview the principal + fees you'd get by burning a position.
173/// @dev Pass `salt = bytes32(0)` when you minted without a custom salt.
174/// @param poolManager The pool manager contract
175/// @param poolId The pool ID
176/// @param vaultAddress The address of the vault
177/// @param tickLower Lower tick of the range
178/// @param tickUpper Upper tick of the range
179/// @param salt Salt used when the position was minted
180/// @param totalFee The total fee percentage (multiplied by 10,000)
181/// @param feeDivisor The fee divisor constant
182/// @return amount0 Currency0 returned (principal + fees)
183/// @return amount1 Currency1 returned (principal + fees)
184function _previewBurn(
185 IPoolManager poolManager,
186 PoolId poolId,
187 address vaultAddress,
188 int24 tickLower,
189 int24 tickUpper,
190 bytes32 salt,
191 uint256 totalFee,
192 uint256 feeDivisor
193) private view returns (uint256 amount0, uint256 amount1) {

Recommendation:

We advise it to be omitted, optimizing the code's gas cost.

Alleviation (121dc0b1329a48555f90bb92e58a95e8ff8a7c79):

The salt argument has been properly omitted from the function call chain, optimizing the code's gas cost.