Upgrade WBTC Price Feed for Ethereum USDC Market

Summary

The Compound III USDC Ethereum market currently prices WBTC using the Chainlink BTC / USD price feed. Compound Labs proposes to upgrade the price feed for WBTC to a custom price feed that factors in the exchange rate between WBTC and BTC to protect against potential depegging events. This custom price feed is implemented by Compound Labs and has been audited by OpenZeppelin. To ensure correctness, Gauntlet has backtested the prices returned by the custom price feed.

Context

WBTC is an ERC20 token that is backed 1:1 by Bitcoin, all of which are custodied by BitGo. It is currently the largest wrapped Bitcoin product on Ethereum and allows users to use Bitcoin in Ethereum dapps, like Compound.

WBTC has historically maintained its peg with BTC well and we do not believe there are currently any issues with the peg. However, it is worth noting that in November of 2022, there was a 2% depeg due to fears around the FTX collapse. This fear was based on uncorroborated claims during a time of market turbulence, so WBTC returned to its peg shortly.

Even though WBTC is functioning perfectly well right now, Labs believes that the protocol should protect itself from any potential depegging in the future. The protocol could face heavy losses if it inaccurately prices WBTC during a depeg event.

Custom WBTC Price Feed

Labs implemented a custom WBTC price feed around half a year ago and got it audited by OZ. This price feed reads prices from the Chainlink WBTC / BTC and BTC / USD price feeds and multiplies them together to arrive at the WBTC / USD price.

The price feed was deployed on mainnet 3 months ago and has soaked for some time to allow for backtesting of its price history. We reached out to Gauntlet to run this backtest and they will be sharing their analysis down below. Their findings show no issues with the custom price feed.

Next Steps

We welcome any thoughts on this topic and plan to make a proposal in a few weeks after the community has had the chance to offer their opinions.

3 Likes

Thanks for the post, @kevin . Below is our analysis of the custom price feed:

To assess the Compound V3 WBTC custom price feed, we compared its price dislocations to the chainlink BTC/USD feed on Ethereum and chainlink WBTC/USD price feed on Arbitrum. Our findings show that, when compared to the chainlink BTC/USD feed, Compound’s previous solution, the new implementation does not deviate in price. However, the custom implementation and WBTC feed can significantly deviate during market stress events. The chart below shows the time series of the different price feeds and their price difference in percentage points.


As seen in the chart above, the BTC/USD and Compound Custom feed are closely correlated and have not deviated more than 0.3% in recent weeks, despite the volatility in BTC price. Here is a histogram of price differences between the two feeds. As shown in the table, the price difference in the majority of timestamps is below 0.15. In fact, 77.8% of all price updates have consistently been below 0.1%.

The WBTC/USD and Compound custom feeds are closely correlated except during times of heightened volatility. In the most recent market drawdown for BTC, the prices deviated by 6%, with the Chainlink oracle showing a price of $27,597 while the custom feed showed a price of $25,749. The chart below shows how the feeds updated in the one-hour time frame of high volatility.

Date Chainlink WBTC/USD Compound Custom Feed % Difference
August 17, 2023 21:38:59 27597.718200 27567.595378 0.1%
August 17, 2023 21:45:35 27597.718200 25749.849000 6.7%
August 17, 2023 22:05:35 27597.718200 26439.985488 4.2%
August 17, 2023 22:20:41 26337.234920 26439.985488 0.4%
August 17, 2023 22:25:47 26337.234920 26303.178312 0.1%
August 17, 2023 22:45:59 26337.234920 26311.566634 0.1%

The second highest price dislocation happened on August 1st when the price of BTC spiked. The price feeds deviated by 1.6%. The chart below shows how the feeds updated in the one hour time frame of high volatility.

Date Chainlink WBTC/USD Compound Custom Feed % Difference
August 1, 2023 01:53:47 29275.526246 29267.074974 0.03%
August 1, 2023 02:11:29 28804.697275 29267.074974 1.61%
August 1, 2023 02:14:11 28804.697275 28912.144262 0.37%
August 1, 2023 02:34:47 28804.697275 28912.144262 0.37%
August 1, 2023 02:54:24 28941.564925 28912.144262 0.10%

It’s important to mention that the price dislocations above are also present in the Chainlink BTC/USD and WBTC/USD feed. The chart below shows the timeseries of the two feeds and their price differences.

Aside from the events analyzed above, the price deviations have been consistently below 1%. The chart on the left shows a histogram of price differences between the two oracles. Note that the data points in 6%, 4%, and 1% bins are the two events discussed above, and the rest of the price updates are all in the bins below 1%. The histogram on the right exhibits the price dislocation distribution for price differences below 1% and shows how the distribution skews towards lower bins. It is worth mentioning that 64% of all price updates have consistently been below 0.1%.

Note also that incorporating a WBTC/BTC oracle, in addition to other risks of having multiple oracles, can pose the comet to WBTC price manipulation risks if WBTC/BTC liquidity ever decreases.

3 Likes

Don’t you think there’s some risk here in that WBTC is mainly traded on DEX’s (curve/Uni). Trading a robust market like BTC for a combo of dex pools has its own downsides and could be more harmful than beneficial given the infrequency of depeg events.

Also to note, I think most users of the Comp pool are using WBTC as a stand in for BTC. They don’t want to bet on the price of WBTC, they want BTC. Does adding this feed in make this more or less transparent for the average user?

1 Like

Thanks for bringing this up. The main risk for users is there is much less liquidity for WBTC than BTC, meaning it’s more susceptible to price manipulation attacks. The fact that most of this liquidity lives on DEX’s, where attackers can utilize flash loans, makes this attack even more possible.

These are attacks are somewhat mitigated by the fact that Chainlink price feeds use the Volume-Weighted Average Price (VWAP), which make price manipulation attacks more difficult to execute. However, the threat of these attacks by a well-capitalized actor still exists, so hoping @Gauntlet can provide some of their thoughts on the risks related to price manipulation attacks.

The point above discusses the main risk for users. In actuality, the motivation for this price feed update is to decrease the risk for the protocol. Although most users use WBTC as a stand-in for BTC, it is simply not the same asset. It carries lots of risks that factor into its peg with BTC, which the protocol is not currently accounting for. If the price of WBTC were to depeg, the protocol could be substantially drained. This new price feed will protect the protocol in such situations.

As a side-note, all the L2 markets for Compound already use a WBTC price feed because Chainlink offers WBTC/USD price feeds on those chains. Ethereum mainnet is the only chain where a WBTC/USD is not readily available, which is why the BTC/USD price feed is used instead.

2 Likes

Ethereum v3 USDC - WBTC Oracle Analysis Update (10/30/23)

Our previous analysis included an error due to a difference of time stamps between Ethereum and Arbitrum blocks. After taking a deeper look at the data with Chainlink, we’d like to update our previous post with data from the past month.

In this updated analysis, we again compare the Ethereum Compound Custom Chainlink WBTC/USD price feed to the Arbitrum Chainlink WBTC/USD price feed. The analysis uses 5,000 Ethereum / Arbitrum block pairs from the past month, joined on the exact block timestamp second. The maximum price discrepancy between these feeds is just 0.60%. These minor discrepancies are to be expected.

Below are the results of the analysis:

2 Likes

Thanks to the Chainlink team (@Roger_Brogan, @CL_Michael) and @Gauntlet for sorting out the error in the previous analysis and providing this update. The analysis indicates the custom WBTC price feed is closely aligned with Chainlink’s WBTC/USD price feed on Arbitrum.

Compound Labs plans to make an on-chain proposal later this week to upgrade the price feed.

2 Likes

Just an update that we’re sorting out some delegation issues to our proposer address before we can make the proposal.