Omniscia Bluejay Finance Audit

TwapOracle Manual Review Findings

TwapOracle Manual Review Findings

TOE-01M: Improper Calculation of Cumulative Delta

Description:

The linked cumulative delta calculations should be performed in an unchecked code block to allow them to underflow given that it is a desired trait as per the official Uniswap implementation.

Example:

packages/contracts/contracts/TwapOracle.sol
52price0Average = uint224(
53 (price0Cumulative - price0CumulativeLast) / timeElapsed
54);
55price1Average = uint224(
56 (price1Cumulative - price1CumulativeLast) / timeElapsed
57);

Recommendation:

We advise an unchecked code block to wrap the cumulative price subtractions.

Alleviation:

The calculations are now performed in an unchecked code block similarly to the original Uniswap codebase alleviating this exhibit.