Omniscia Avocado Fund Audit
AvocadoVault Code Style Findings
AvocadoVault Code Style Findings
AVT-01C: Ineffectual Usage of Safe Arithmetics
| Type | Severity | Location |
|---|---|---|
| Language Specific | ![]() | AvocadoVault.sol: • I-1: L97 • I-2: L280 • I-3: L282 |
Description:
The linked mathematical operation is guaranteed to be performed safely by logical inference, such as surrounding conditionals evaluated in require checks or if-else constructs.
Example:
contracts/src/AvocadoVault.sol
96if (current >= vaultCap) return 0;97return vaultCap - current;Recommendation:
Given that safe arithmetics are toggled on by default in pragma versions of 0.8.X, we advise the linked statement to be wrapped in an unchecked code block thereby optimizing its execution cost.
Alleviation (a859cd2191):
The optimization has been partially applied as the second instance (I-2) retains usage of checked arithmetic.
The BPS_DENOMINATOR - targetIdleRatio part of the highlighted calculation can be safely wrapped in an unchecked code block.
Alleviation (ca4268ecd3):
The optimization has been fully applied across the final instance (I-2), addressing this exhibit in full.
