ReserveOracle
Reserve oracles are used to determine the LST provider exchange rate and is utilizated by Ion's liquidation module. Liquidations will only be triggered against this exchange rate and will be completely market-price agnostic. Importantly, this means that liquidations will only be triggered through lack of debt repayment or slashing events.
In order to protect against potential provider bugs or incorrect one-off values (malicious or accidental), the reserve oracle does not use live data. Instead it will query the exchange every intermittent period and persist the value and this value can only move up or down by a maximum percentage per query. If additional data sources are available, they can be involved as FEED
s. If other FEED
s are provided to the reserve oracle, a mean of all the FEED
s is compared to the protocol exchange rate and the minimum of the two is used as the new exchange rate. This final value is subject to the bounding rules.
State Variables
ILK_INDEX
QUORUM
MAX_CHANGE
FEED0
FEED1
FEED2
currentExchangeRate
lastUpdated
Functions
constructor
Creates a new ReserveOracle
instance.
Parameters
_getProtocolExchangeRate
Returns the protocol exchange rate.
Must be implemented in the child contract with LST-specific logic.
Returns
getProtocolExchangeRate
Returns the protocol exchange rate.
Returns
_aggregate
Queries values from whitelisted data feeds and calculates the mean. This does not include the protocol exchange rate.
Parameters
_bound
Bounds the value between the min and the max.
Parameters
_initializeExchangeRate
Initializes the currentExchangeRate
state variable.
Called once during construction.
updateExchangeRate
Updates the currentExchangeRate
state variable.
Takes the minimum between the aggregated values and the protocol exchange rate, then bounds it up to the maximum change and writes the bounded value to the state. NOTE: keepers should call this update to reflect recent values