Omniscia Euler Finance Audit
SDaiOracle Code Style Findings
SDaiOracle Code Style Findings
SDO-01C: Potential Usage of Library
Type | Severity | Location |
---|---|---|
Code Style | SDaiOracle.sol:L36, L38, L41 |
Description:
The referenced statements can be executed via the ScaleUtils::getDirectionOrRevert
function.
Example:
29/// @notice Get a quote by querying the exchange rate from the DSR Pot contract.30/// @dev Calls `chi`, the interest rate accumulator, to get the exchange rate.31/// @param inAmount The amount of `base` to convert.32/// @param base The token that is being priced. Either `sDai` or `dai`.33/// @param quote The token that is the unit of account. Either `dai` or `sDai`.34/// @return The converted amount.35function _getQuote(uint256 inAmount, address base, address quote) internal view override returns (uint256) {36 if (base == sDai && quote == dai) {37 return inAmount * IPot(dsrPot).chi() / 1e27;38 } else if (base == dai && quote == sDai) {39 return inAmount * 1e27 / IPot(dsrPot).chi();40 }41 revert Errors.PriceOracle_NotSupported(base, quote);42}
Recommendation:
We advise this to be done so, optimizing the code's legibility.
Alleviation:
The Euler Finance team stated that they do not consider the recommended change a legibility improvement as they wish straightforward wrapped variant oracles to utilize a direct comparison.
Given that the approach the Euler Finance team wishes to retain is uniformly applied to the class of oracles described, we consider this exhibit as an inapplicable recommendation and concur with the Euler Finance team's assessment.
SDO-02C: Repetitive Value Literal
Type | Severity | Location |
---|---|---|
Code Style | SDaiOracle.sol:L37, L39 |
Description:
The linked value literal is repeated across the codebase multiple times.
Example:
37return inAmount * IPot(dsrPot).chi() / 1e27;
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 1e27
has been properly relocated to a contract-level constant
declaration labelled RAY
, optimizing the code's legibility.