Overview of Oracles Used in the RAI Protocol

Overview of Oracles Used in the RAI Protocol

RAI uses several oracles to function, some are core to the system while others are not critical.

This post will describe each oracle used in the RAI protocol and the contracts that depend on them.

All oracles (for compatibility reasons) use the same interface, forked from DS-Value, but with easier to understand function names.

ETH-USD

Name on changelog: MEDIANIZER_ETH
Current Address: 0xb825e25856bD98b3f2FAF2aEb6Cb8742B38C4025
Current Implementation: ChainlinkRelayer

One of the two key oracle components in the system, the FSM (Feed Security Module) will take prices from the ETH oracle and force a 1 hour delay between consecutive updates.

The Oracle Relayer contract consumes the delayed price, divides it by the redemption price and then divides the result again by the Safe liquidation ratio before pushing the final output in the core system.

Contracts that use it:
FEED_SECURITY_MODULE_ETH
GEB_ORACLE_RELAYER (indirectly through FSM)
GEB_DEBT_FLOOR_ADJUSTER
GEB_FIXED_REWARDS_ADJUSTER
GEB_MINMAX_REWARDS_ADJUSTER

RAI-USD

Name on changelog: MEDIANIZER_RAI
Current Address: 0x92dC9b16be52De059279916c1eF810877f85F960
Current Implementation: ChainlinkTWAP

This is the second core oracle used in the system. It produces a RAI-USD time weighted average price and is consumed by the RAI controller, and therefore is key in periodically recalculating the redemption rate.

Contracts that use it:
GEB_RRFM_SETTER
GEB_COLLATERAL_AUCTION_HOUSE_ETH_A
GEB_COIN_ETH_UNISWAP_V2_POOL_SAVIOUR
GEB_DEBT_AUCTION_INITIAL_PARAM_SETTER

FLX-USD

Name on changelog: GEB_PROT_TOKEN_ORACLE
Current Address: 0xF0b9A234C273250F8D3cE047D8b9cea773Ae3adE
Current Implementation: DSValue

This is an auxiliary oracle, used only by periphery contracts. It is currently fixed at 300 USD (a value that can be changed by governance). It could be switched to a proper oracle once a reliable and easy to maintain feed is available.

Contracts that use it:
GEB_DEBT_AUCTION_INITIAL_PARAM_SETTER

Gas Price

Name on changelog: GEB_GAS_PRICE_ORACLE
Current Address: 0x3a3e9d4D1AfC6f9d7e0E9A4032a7ddBc1500D7a5
Current Implementation: DSValue

This is an auxiliary oracle, used only by periphery contracts. It is currently fixed at 150 gwei. Although Chainlink provides a gas price oracle, they do not offer a gas price TWAP. A TWAP would be needed to avoid attacks against the system (overpaying oracles with rewards set at gas price peaks).

Since the contracts using it are non critical, the gas oracle can use a fixed price.

Contracts that use it:
GEB_DEBT_FLOOR_ADJUSTER
GEB_FIXED_REWARDS_ADJUSTER
GEB_MINMAX_REWARDS_ADJUSTER

Implementations

These are implementations used for each of the oracles:

1 Like

thank you for the insightful overview, @fabiohild.
Question: considering

could this be implemented trough state channels instead and would that be less costly?

Thnx

Hey @goron_dan , in this case it doesn’t make sense to use state channels. State channels are useful for n interactions off chain between two parties, only submitting 2 txs on chain to agree on the results (i.e: you could have a chess game and post results with only 1 tx per player). In this case all data is on chain, so there is no benefit in using it AFAIK.

1 Like