Omniscia Bluejay Finance Audit
TwapOracle Code Style Findings
TwapOracle Code Style Findings
TOE-01C: Inexistent Visibility Specifier
Type | Severity | Location |
---|---|---|
Code Style | TwapOracle.sol:L11 |
Description:
The linked variable has no visibility specifier explicitly set.
Example:
11IUniswapV2Pair immutable pair;
Recommendation:
We advise one to be set so to avoid potential compilation discrepancies in the future as the current behaviour is for the compiler to assign one automatically which may deviate between pragma
versions.
Alleviation:
The public
visibility specifier has been introduced for the referenced variable alleviating this exhibit.
TOE-02C: Potentially Misleading Error Message
Type | Severity | Location |
---|---|---|
Code Style | TwapOracle.sol:L102 |
Description:
The linked error message states that the price may be invalid if the amountOut
is zero, however, the same condition can be true
if the amountIn
is zero which is not prohibited.
Example:
90function consult(address token, uint256 amountIn)91 public92 view93 override94 returns (uint256 amountOut)95{96 if (token == token0) {97 amountOut = _decode144(price0Average * amountIn);98 } else {99 require(token == token1, "Invalid swap");100 amountOut = _decode144(price1Average * amountIn);101 }102 require(amountOut > 0, "Invalid price");103}
Recommendation:
We advise either the amountIn
to be validated or the error message corrected, the latter of which we advise.
Alleviation:
The error message has been updated to instead indicate "Zero output"
ensuring that off-chain processes are adequately informed of the error that arose.