Omniscia Bluejay Finance Audit

TwapOracle Code Style Findings

TwapOracle Code Style Findings

TOE-01C: Inexistent Visibility Specifier

TypeSeverityLocation
Code StyleTwapOracle.sol:L11

Description:

The linked variable has no visibility specifier explicitly set.

Example:

packages/contracts/contracts/TwapOracle.sol
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

TypeSeverityLocation
Code StyleTwapOracle.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:

packages/contracts/contracts/TwapOracle.sol
90function consult(address token, uint256 amountIn)
91 public
92 view
93 override
94 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.