Interest Rate Oracles

Notional V2 liquidity pools track two different interest rates, the last traded rate and the oracle rate.

Last traded rate

The last traded rate reflects the implied interest rate of the last trade executed on the liquidity pool. The last traded rate could be manipulated over short time frames (such as via flash loans) to display a rate that does not reflect the true, or equilibrium interest rate of the liquidity pool at a particular time.

These limitations make the last traded rate insecure as a price oracle by which to value fCash. Given that we allow users to borrow against their fCash, we need to ensure that the price oracle used to value fCash can't be manipulated. If the price oracle can be manipulated, an attacker could artificially move interest rates to a level that would push accounts into a state of under-collateralization. The attacker could then liquidate these accounts at an artificial price.

Oracle rate

The oracle rate is designed to mitigate the risk of price manipulation by providing a lagged, dampened price feed that converges to the last traded rate over a time window set by governance. The oracle rate is defined like this:

oracleRate =
  lastTradedRate *
    min((currentBlockTime - lastTradedTime) / timeWindow, 1) +
  previousOracleRate *
    max(timeWindow - (currentBlockTime - lastTradedTime) / timeWindow, 0)

This design ensures that the oracle rate will not be vulnerable to flash loan attacks - trades within a single block will have a currentBlockTime - lastTradedTime value of 0 which means they will have no effect on the oracle rate. Here is an example that illustrates how the oracle rate will respond to trades and converge to the last traded rate over time:

Last updated