Omniscia XFai Audit

XPriceOracle Manual Review Findings

XPriceOracle Manual Review Findings

XPO-01M: Small TWAP Window

TypeSeverityLocation
Logical IssueMinorXPriceOracle.sol:L14

Description:

The Time-Weighted-Average-Price window set by the XFai team is 1 hours which can be deemed small, especially so for the XFai token which at first will be relatively illiquid.

Example:

contracts/XPriceOracle.sol
12using FixedPoint for *;
13
14uint256 public constant PERIOD = 1 hours;
15
16IUniswapV2Pair immutable pair;
17address public immutable token0;
18address public immutable token1;

Recommendation:

We advise a larger TWAP window to be set, potentially 24 hours, to ensure a more accurate TWAP reading on each consult invocation.

Alleviation:

The XFai team stated that the small time window is desired during the genesis of the project as a high volume is anticipated that will cause the price to greatly fluctuate in the short term. As a solution, the PERIOD was made to be adjustable and will be adjusted as the project's trading volume subsides to a longer interval. We should note that the currently set 5 minutes interval is still relatively low and can be impacted by flash loans.