N
N
Notional V2
Search…
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:
1
oracleRate =
2
lastTradedRate *
3
min((currentBlockTime - lastTradedTime) / timeWindow, 1) +
4
previousOracleRate *
5
max(timeWindow - (currentBlockTime - lastTradedTime) / timeWindow, 0)
Copied!
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 modified 6mo ago