Il 15 giugno 2021, gli utenti hanno proposto ufficialmente di cambiare il sistema Oracle di Compound da Coinbase a Chainlink Price Feeds. I dettagli sono i seguenti:
- La votazione ufficiale inizia il 16 giugno 2021 alle 19:00 UTC.
- Questa proposta proviene da un forum che sostiene la necessità di miglioramenti al sistema Oracle dell'attuale composto.
- Uniswap v2 rimane ancorato e l'intervallo di deviazione dell'ancoraggio viene ridotto dal 20% al 15%.
Vedi il dettaglio della proposta
Introduction
This proposal will change the current oracle system from using Coinbase as the primary reporter of prices to Chainlink Price Feeds. Uniswap v2 is still used as an anchor (circuit breaker) and the anchor deviation window will change from 20% to 15%. As a precaution, the community multisig has the ability to engage a failover that will switch a market’s primary oracle from the current Price Feeds to Uniswap v2.
Proposal Call
Change the Comptroller oracle from 0x4007B71e01424b2314c020fB0344b03A7C499E1A to 0x841616a5CBA946CF415Efe8a326A621A794D0f97
Oracle Update Details
Each asset supported on the Compound market has a corresponding USD-paired price feed reference contract and a validatorProxy contract (which allows for the UniswapAnchorView (UAV) oracle contract to be updated by the community as new markets are added). When the reference contract of a Price Feed is updated by a decentralized network of oracle nodes with a new aggregated price value, the transmitter of that data also calls the validate() function on the market’s validatorProxy contract. When this function is called, the validatorProxy calls validate() on the UAV, which queries Uniswap v2 to check if the new price is within the Uniswap v2 TWAP anchor. If valid, the UAV is updated with the asset’s price. If invalid, the price data is not stored. Additional details on this process can be found in this comment here on the Compound forum.
Here is a visual example of how BAT/USD price feed is used, though this flow is the same for all asset markets.
The frequency of updates for each price feed depends on two triggers:
- Deviation threshold - when the off-chain price of an asset is witnessed to have moved more than x% of the previously reported price, an on-chain update is initiated.
- Heartbeat threshold - If x minutes have passed without an update, a new on-chain update is initiated.
More information can be found on data.chain.link. Example: ETH / USD.
Price update events can be witnessed on the Etherscan events tab.
The UniswapAnchorView token configuration has two additional fields: reporter & reporterMultiplier.
- reporter: The address that submits prices for a particular cToken. This is always a ValidatorProxy contract that is always called by a price feed reference contract for each relevant price update posted by oracle nodes. In this case, 0xeBa6F33730B9751a8BA0b18d9C256093E82f6bC2 is the reporter of the price of BAT.
- reporterMultiplier: Used to transform the price reported by the price feeds to the correct base unit that the UniswapAnchoredView expects. This is required because the price feeds report prices with different decimal placement than the UniswapAnchoredView.
Audit report: Trail of Bits was commissioned for audit of the contracts.ToB Audit report
Forum discussion and additional details: Oracle Infrastructure: Chainlink Proposal
Why
In late January I wrote on the forum “Compound NEEDS to improve the current oracle infrastructure as a matter of safety and growth. I think it is evident to users that the current solution is not ideal and not close to ideal. The event that occurred in November with Dai liquidations was preventable….In addition to preventing the November event from transpiring again, I think it is also in the protocol’s best interest to improve the oracle situation so Compound can safely support more assets.”
Five months, two forum threads, 114 forum replies, numerous calls, countless messages, and finally, we have a robust solution to improve the oracle system. This has been a long process, going over and re-reviewing many nuanced details with the community. Building in public is not always easy, but it was an insightful process and I am excited to see more assets on Compound. I look forward to continuing to improve the oracle system as the crypto landscape changes.