Omniscia Steer Protocol Audit
PluginHelper Code Style Findings
PluginHelper Code Style Findings
PHR-01C: Generic Typographic Mistakes
| Type | Severity | Location |
|---|---|---|
| Code Style | ![]() | PluginHelper.sol: • I-1: L332 • I-2: L465 |
Description:
The referenced lines contain typographical mistakes (i.e. private variable without an underscore prefix) or generic documentational errors (i.e. copy-paste) that should be corrected.
Example:
332function _redeemVaultShares(address vault, uint256 shares, uint256 totalShares, uint256 totalDeposit)Recommendation:
We advise them to be corrected enhancing the legibility of the codebase.
Alleviation:
The Steer Protocol team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.
PHR-02C: Ineffectual Usage of Safe Arithmetics
| Type | Severity | Location |
|---|---|---|
| Language Specific | ![]() | PluginHelper.sol: • I-1: L160 • I-2: L161 • I-3: L228 • I-4: L244 • I-5: L360 • I-6: L376 |
Description:
The linked mathematical operations are guaranteed to be performed safely by surrounding conditionals evaluated in either require checks or if-else constructs.
Example:
151// If cross is zero, this means that the inputted ratio is totally wrong152// and must be adjusted to better match the vault's held ratio.153// This pretty much only happens if all of the vault's holdings are in one token,154// and the user wants to exclusively deposit the other token.155require(cross > 0, "C");156
157// Round up amounts158// cross - 1 can be unchecked since above we require cross != 0159// total1 and total0 are also both > 0160amount0Used = ((cross - 1) / total1) + 1;161amount1Used = ((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:
The Steer Protocol team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.
PHR-03C: Redundant Evaluation of Conditional
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() | PluginHelper.sol:L477-L479, L481 |
Description:
The referenced code will evaluate a statement in an if conditional, yield true if it evaluates to true, and yield false otherwise.
Example:
476// Check if unused amounts are greater than the minimum specified477if (unusedPercent0 > maximumUsedPercent || unusedPercent1 > maximumUsedPercent) {478 return true;479}480
481return false;Recommendation:
We advise the result of the conditional itself to be yielded, optimizing the code's gas cost.
Alleviation:
The referenced logic is no longer present in the contract, rendering this exhibit no longer applicable.
PHR-04C: Repetitive Value Literal
| Type | Severity | Location |
|---|---|---|
| Code Style | ![]() | PluginHelper.sol:L118, L119, L467, L474, L475 |
Description:
The linked value literal is repeated across the codebase multiple times.
Example:
118total0 = (total0 * percentage) / 100;Recommendation:
We advise it to be set to a constant variable instead, optimizing the legibility of the codebase.
In case the constant has already been declared, we advise it to be properly re-used across the code.
Alleviation:
The referenced value literal 100 has been properly relocated to a contract-level constant declaration labelled PERCENTAGE_DIVISOR, optimizing the code's legibility.
