Skip to content

Oracles

Michael Elliot edited this page Mar 9, 2021 · 2 revisions

Oracle price feeds are needed in three places in the Maple protocol:

  1. Determining amount collateral needed to satisfy collateral ratio at time of Loan drawdown
  2. Determining minAmountOut parameter for liquidation Uniswap transaction (used for slippage)
  3. Determining minAmountOut parameter for MapleTreasury Uniswap transaction (used for slippage)

Chainlink oracles are used as price feeds, with an oracle wrapper contract as a safeguard against oracle downtime. For USDC prices, a constant USD oracle will be deployed, with a constant price of 1 * 10 ** 8 (Chainlink price feeds use 8 decimals of precision).

Oracles for given assets are set using Globals.setPriceOracle(). For the majority of assets this will be Chainlink oracle wrappers, for USDC it will be a constant USD oracle. Oracle wrappers have the capability to provide a manual price in the event of an oracle outage, using the security multisig. In all other cases, it will simply pass through the value from getLatestPrice in the Chainlink oracle.