Omniscia Steer Protocol Audit
SteerPeriphery Code Style Findings
SteerPeriphery Code Style Findings
SPY-01C: Ineffectual Usage of Safe Arithmetics
| Type | Severity | Location |
|---|---|---|
| Language Specific | ![]() | SteerPeriphery.sol: • I-1: L464 • I-2: L468 • I-3: L588 • I-4: L597 • I-5: L605 |
Description:
The linked mathematical operations are guaranteed to be performed safely by surrounding conditionals evaluated in either require checks or if-else constructs.
Example:
462if (amount0Desired > amount0) {463 token0.approve(vaultAddress, 0);464 token0.safeTransfer(msg.sender, amount0Desired - amount0);465}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 (fbb15dfb5ea6fad8296e934a8eb87c9fc3ef13cd):
The Steer Protocol team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.
SPY-02C: Inefficient Approvals of Zero
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() | SteerPeriphery.sol:L584, L593 |
Description:
The referenced approvals of zero do not need to be performed if the amountXDesired is equal to the vars.amountXUsed variable in each instance.
Example:
582// Cleanup approvals and refund unused583if (!useNativeForToken0 && amount0Desired > 0) {584 IERC20(vars.currency0).approve(vaultAddress, 0);585 if (amount0Desired > vars.amount0Used) {586 IERC20(vars.currency0).safeTransfer(587 msg.sender,588 amount0Desired - vars.amount0Used589 );590 }591}592if (amount1Desired > 0) {593 IERC20(vars.currency1).approve(vaultAddress, 0);594 if (amount1Desired > vars.amount1Used) {595 IERC20(vars.currency1).safeTransfer(596 msg.sender,597 amount1Desired - vars.amount1Used598 );599 }600}Recommendation:
We advise the code to relocate those statements within each inner if block and to flatten the two nested if blocks, optimizing the code's gas cost.
Alleviation (fbb15dfb5ea6fad8296e934a8eb87c9fc3ef13cd):
The Steer Protocol team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.
SPY-03C: Suboptimal Struct Declaration Styles
| Type | Severity | Location |
|---|---|---|
| Code Style | ![]() | SteerPeriphery.sol: • I-1: L209-L227 • I-2: L246-L263 • I-3: L273 |
Description:
The linked declaration styles of the referenced structs are using index-based argument initialization.
Example:
209IMultiPositionManager.VaultDetails(210 IVaultRegistry(vaultRegistry).beaconTypes(vault),211 vaultInstance.token0(),212 vaultInstance.token1(),213 IERC20Metadata(vault).name(),214 IERC20Metadata(vault).symbol(),215 IERC20Metadata(vault).decimals(),216 token0.name(),217 token1.name(),218 token0.symbol(),219 token1.symbol(),220 token0.decimals(),221 token1.decimals(),222 IUniswapV3Pool(vaultInstance.pool()).fee(),223 vaultInstance.totalSupply(),224 bal0,225 bal1,226 vault227);Recommendation:
We advise the key-value declaration format to be utilized instead in each instance, greatly increasing the legibility of the codebase.
Alleviation (fbb15dfb5ea6fad8296e934a8eb87c9fc3ef13cd):
The Steer Protocol team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.
