Compound UAV v3 Upgrade
GFX Labs is proposing on behalf of Chainlink to upgrade the protocol's oracle contract (currently v2) to v3, which switches the anchor market from Uniswap v2 to v3.
Forum Post
-
The new UniswapAnchoredView (UAV) no longer records and keeps observations but instead queries the respective Uniswap V3 pool’s observe function to get a TWATP with the set anchor period when it’s needed (i.e., when a reporter calls validate on the UAV).
-
The price of an asset in Uniswap V3 is a function of the “tick” of the pool. The formula is price = 1.0001^tick. The math required for conversion between posted prices and the Uniswap V3 TWATP and the UAV representation has been modified to support this. Relevant libraries (TickMath and FullMath) have been included from the Uniswap V3 codebase.
-
The tests from the original UAV have been adapted to the new Uniswap V3 architecture - i.e., observations/TWATP tests were removed. Hardhat (+typechain) has been implemented so real Uniswap V3 pools can be used via forked mainnet in tests and eliminate the need for mocking Uniswap V3 pools.
-
Chainlink has increased the Uniswap observation cardinality to 150 on pools that were below 150.
Dedaub & ABDK audits: link
Open Zeppelin report: link
Oracle Contract