πŸ“œPrice feed

Introduction

Middle Lend accounts for collateral assets after performing a compound calculation of the underlying assets of the collateral. The underlying asset price feed is updated with Chainlink Price Feeds, a code base hosted on GitHub and maintained by the community.

Architecture

Price Feed consists of three main contracts.

  • PriceOracleSentinel: Contract validates if the operations are allowed depending on the PriceOracle health. The PriceOracle is considered healthy once it's completely up and the grace period has passed.

  • MiddleLendOracle: Contract to get asset prices, manage price sources and update the fallback oracle. Middle Lend uses Chainlink Aggregators as the source of all asset prices.

  • CollateralValueCalculator: Aggregation contracts used to calculate the value of collateral.

This architecture allows multiple views to use the same underlying price data, but to verify the prices in their own way. Bridged Assets will be fixed to the original chain price feed.

As a precaution, the ACLManager has the ability to engage a failover that will switch a market’s primary oracle from the Chainlink Price Feeds to Uniswap v2. This RISK_ADMIN is able to change to a failover for single markets. The Uniswap V2 TWAP price is used as the failover.

Last updated