Omniscia Steadefi Audit
TraderJoeYieldFarmReader Code Style Findings
TraderJoeYieldFarmReader Code Style Findings
TJF-01C: Ineffectual Usage of Safe Arithmetics
Type | Severity | Location |
---|---|---|
Language Specific | TraderJoeYieldFarmReader.sol:L93, L178 |
Description:
The linked mathematical operation is guaranteed to be performed safely by surrounding conditionals evaluated in either require
checks or if-else
constructs.
Example:
90// in underflow condition return 091if (_assetValue < _debtValue) return 0;92
93return _assetValue - _debtValue;
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 (4325253d6de0ea91c1e9fb9e01d2e7e98f3d83a9):
The first referenced statement has been properly wrapped in an unchecked
code block whereas the second statement is no longer part of the codebase. As a result, we consider this exhibit fully alleviated.
TJF-02C: Repetitive Value Literal
Type | Severity | Location |
---|---|---|
Code Style | TraderJoeYieldFarmReader.sol:L174, L176, L178 |
Description:
The linked value literal is repeated across the codebase multiple times.
Example:
174require(ERC20(_token).decimals() <= 18, 'Asset should have less than 18 decimals');
Recommendation:
We advise it to be set to a constant
variable instead optimizing the legibility of the codebase.
Alleviation (4325253d6de0ea91c1e9fb9e01d2e7e98f3d83a9):
The referenced code is no longer part of the codebase, rendering this exhibit no longer applicable.
TJF-03C: Variable Mutability Specifiers (Immutable)
Type | Severity | Location |
---|---|---|
Gas Optimization | TraderJoeYieldFarmReader.sol:L36-L38 |
Description:
The linked variables are assigned to only once during the contract's constructor
.
Example:
31constructor(32 ITraderJoeYieldFarmVault _vault,33 ITraderJoeYieldFarmManager _manager,34 IChainLinkOracle _priceOracle35) {36 vault = _vault;37 manager = _manager;38 priceOracle = _priceOracle;39}
Recommendation:
We advise them to be set as immutable
greatly optimizing their read-access gas cost.
Alleviation (4325253d6de0ea91c1e9fb9e01d2e7e98f3d83a9):
All variables have been set as immutable
per our recommendation, greatly reducing their read-access gas cost.