Notional Finance fCash
Notional Finance fCash Oracle Implementation
🔎 High-level Overview
The Oracle implementation uses Notional's Interest Rate Oracles to fetch a dampened price that converges to the last traded rate over a window of time. After the price is retrieved, we format and convert the rate to a per-second value that is used by the Relayer to push values to Collybus.
🐣 Initialization
The Oracle uses active markets that are retrieved from the deployed Notional contract via a View interface.
These are the parameters needed to define a NotionalFinanceValueProvider
Oracle:
timeUpdateWindow
- the minimum time between updates for the oracle ratenotional
- the address of the Notional deployed oraclecurrencyId
- the id of each currency as defined in the Notional protocoloracleRateDecimals
- the decimal precision of the Notional provided oracle ratematurityDate
- the maturity date of the pool.
All of the initial parameters are immutable
which means once they are set they can not be modified.
🌈 Execution Flow
Each specific oracle implementation must define the Oracle.getValue()
function. This function is called when the global execution flow is triggered by the Relayer.
The oracle rate is retrieved by calling getMarket(currencyId, maturityDate, settlementDate)
on the Notional contract.
After the value is retrieved it goes through a few processing steps that convert it to the format that is required by Collybus. First, the value is converted to an 18-digit(WAD) fixed-point number, after that, it is transformed from an annual rate to a per-second rate then the last step is to convert it from a continuous compounding to a discrete compounding rate.
If getValue
is called after the maturity date the call will revert. In this scenario, the update()
process will continue but the current value will be considered invalid.
📑 Public Methods
These methods can be called by anyone:
notional
Returns the address of the deployed Notional contract that is needed in order to fetch the oracle rate and compute the per second rate
currencyId
Returns the Currency ID, ETH = 1, DAI = 2, USDC = 3, WBTC = 4
maturityDate
Returns the maturity date of the Pool
oracleRateDecimals
Returns the precision of the Notional oracle rate
getValue
Computes and returns the discount rate.
getSettlementDate
Computes and returns the pool settlement date
📘 References
Last updated