Notional Finance fCash
Notional Finance fCash Oracle Implementation
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.
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
timeUpdateWindow- the minimum time between updates for the oracle rate
notional- the address of the Notional deployed oracle
oracleRateDecimals- the decimal precision of the Notional provided oracle rate
maturityDate- the maturity date of the pool.
All of the initial parameters are
immutablewhich means once they are set they can not be modified.
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.
getValueis 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.
These methods can be called by anyone:
Returns the address of the deployed Notional contract that is needed in order to fetch the oracle rate and compute the per second rate
Returns the Currency ID, ETH = 1, DAI = 2, USDC = 3, WBTC = 4
Returns the maturity date of the Pool
Returns the precision of the Notional oracle rate
Computes and returns the discount rate.
Computes and returns the pool settlement date