Themis Protocol accounts for collateral assets after performing a compound calculation of the underlying assets of the collateral. The underlying asset price feed are updated with Chainlink Price Feeds, a code base hosted on GitHub and maintained by the community.
Price Feed consists of three main contracts.
- PriceOracleSentinel: Contract validates if the operations are allowed depending on the PriceOracle health. The
PriceOracleis considered healthy once its completely up and the grace period has passed.
- ThemisOracle: Contract to get asset prices, manage price sources and update the fallback oracle. Themis Protocol V2 uses Chainlink Aggregators as the source of all asset prices.
- M1CollateralValueCalculator: Aggregation contracts used to calculate the value of M1 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. The
RISK_ADMINis able to change to a failover for single markets. The Uniswap V2 TWAP price is used as the failover.