wstETH-WETH market temporarily disabled

An unusually high number of swaps has recently been observed through the wstETH-WETH GMX V2 pool. The change in GM token price for this pool also does not exactly match expectations.

Due to these observations, the wstETH-WETH GMX V2 market has been temporarily disabled as a precaution. Contributors are investigating the situation in detail with Chainlink, the Oracle data provider, and Chaos Labs, the security and risk assessment partner.

In addition, swap, deposit and withdrawal fees for the wstETH-USDe pool have been increased to 0.5% as a precautionary measure.

Updates will be shared when more information is available. Please stay tuned.

3 Likes

Overview

Chaos Labs observed unusual activity in the wstETH-WETH GMX V2 pool.

Our analysis has revealed significant discrepancies between the Chainlink wstETH/wETH Oracle price reports and the UNI V3 price of wETH/wstETH.

These discrepancies were observed consistently before, during, and after extreme market volatility on 2024/08/05. Major price discrepancies between Chainlink Oracle and Uniswap V3 spot prices are not isolated incidents. We observed extreme gaps during last week’s market turbulence, but critically, they persist even in calm market conditions.

Chainlink is actively investigating the root cause.

wstETH/WETH Price Deviation: Chainlink Oracle vs. Uniswap V3

The observed price discrepancies are significant, often exceeding 0.75% during periods of normal market conditions. During the extreme volatility on 08/05, these deviations were even more pronounced, as illustrated in the data below.

Temporary Risk Mitigation Measures

These actions are designed to provide immediate risk mitigation. However, they are not intended to be permanent.

We will reassess and adjust the fees once the underlying issue is resolved and Chainlink’s Oracle precision is restored to expected levels.

Meanwhile, Chaos Labs will work closely with GMX and Chainlink to develop a more resilient oracle solution.

To address Oracle price discrepancies, we recommend the following temporary measures:

  1. Re-enabling the wstETH/wETH market
  2. Increasing the swap fee to 1% for both wstETH/wETH and wstETH/USDe pairs

Recommendations

wsETH/wETH Pool:

  • Re-enable pool
  • Update swap fee to 1%

wstETH/USDe Pool:

  • Update swap fee to 1%
3 Likes

The contributors are investigating the pool issue, how it affected users, and what can be done to address it and avoid this issue in the future :handshake:

Users affected by the arbitrage of the wstETH-WETH pool have been reimbursed with WETH for the impacted value. You can find the transaction here:

Currently, the pool has a 1% withdrawal fee in place to prevent any further arbitrage. GMX is working with its oracle and risk management partners to bring this fee back to normal as soon as possible.

1 Like

It’s taking longer than expected to get all the data needed for the reconfiguration, sorry for that. A resolution should be coming next week.

2 Likes

contributors are working to normalize this
there are a lot of issues and hence need a bit of testing to make sure no bots / malicious actors do arbitrage.
thanks for your understanding =)

1 Like

Summary

This report analyzes the wstETH/USD Chainlink oracle proposed by Chainlink and provides parameter recommendations for the wstETH/USDe and wstETH/wETH swap pools on GMX. Our findings reveal significant deviations between the Chainlink stETH/USD oracle and on-chain prices, primarily due to the oracle not integrating the major source of stETH liquidity, which is on-chain. To address potential arbitrage risks and protect LPs, we recommend specific swap fees and price impact factors.

Introduction

In response to Chainlink’s suggested wstETH oracle, we have conducted an analysis to assess its suitability for use on GMX. We provide parameter recommendations for the wstETH/USDe and wstETH/wETH swap pools. According to Chainlink’s proposal, the wstETH/USD feed is constructed by taking the wstETH/stETH conversion rate from the Lido contract and multiplying it by the stETH/USD price stream.

Analysis of the stETH/USD Oracle

Comparison with On-Chain Prices

To evaluate the quality of the stETH/USD Chainlink price stream, we compared it to the most liquid stETH/ETH market, which is the Curve stETH/ETH pool on Ethereum. We then multiplied the on-chain stETH/ETH price by the ETH/USD price to derive an on-chain stETH/USD price.

Observations

Our analysis revealed significant deviations between the Chainlink oracle-derived stETH/USD price and the on-chain derived stETH/USD price. This implies that the Chainlink stETH/USD price stream is suboptimal, as it does not account for the primary source of stETH liquidity, which is the on-chain Curve pool. These deviations can lead to inaccurate pricing on GMX and open opportunities for arbitrage exploitation.

Impact on GMX Swap Markets

Deviation in wstETH/wETH Exchange Rates

We examined the expected wstETH/wETH exchange rate on GMX by taking the wstETH’s oracle price (as per Chainlink’s proposed method) and dividing it by the ETH/USD price. We then compared this rate to the on-chain wstETH/wETH prices on Arbitrum to assess deviations.

Results

Price Deviation Percentiles (in basis points):

Percentile Deviation (bps)
95% 11
99% 19
99.5% 29
99.9% 62

These results indicate that in up to 0.5% of cases, the price deviation can be as high as 29 bps, and in rare cases (0.1%), up to 62 bps. Such deviations can lead to substantial arbitrage opportunities if not properly mitigated.

Recommendations for Swap Fees and Price Impact Factors

Swap Fee Recommendations

To protect LPs and minimize arbitrage risks, we recommend setting the swap fees as follows:

  • wstETH/wETH Swap Pool: Set the swap fee to 30 bps.
  • wstETH/USDe Swap Pool: Set the swap fee to 25 bps, which is 5 bps less than the wstETH/wETH pool due to additional swaps needed in arbitraging through USDe.

Setting the swap fee at these levels ensures that it exceeds the typical price deviations in 99.5% of cases, making it economically unviable to exploit small deviations while still allowing reasonable liquidity provision and trading.

Swap Price Impact Factors

We also recommend the following price impact factors:

  • Negative Price Impact Factor: 1e-8
  • Positive Price Impact Factor: 5e-9

Impact Analysis

For a swap pool with approximately $2 million in liquidity:

  • A trade creating a 1% imbalance ($20k) incurs a price impact fee of approximately 9 bps.
  • A 5% imbalance ($100k) results in a price impact fee of about 26 bps.
  • A 10% imbalance ($200k) leads to a price impact fee of approximately 47 bps.

Combined with the base swap fee, large trades causing significant imbalances become economically unattractive for arbitrageurs, thereby protecting the swap pools from exploitation.

Considerations for the wstETH/USDe Market

Since the wstETH/USDe market can be used for arbitrage when wstETH/wETH arbitrage opportunities occur (e.g., wstETH–USDe–USDC–wETH on GMX), it is crucial to maintain similar swap fee and price impact parameters to those of the wstETH/wETH pool. This consistency ensures that arbitrageurs cannot exploit discrepancies between the two markets.

Due to the additional swaps required when arbitraging through USDe, we recommend setting the base swap fee for the wstETH/USDe pool slightly lower at 25 bps, while keeping the same price impact factors as the wstETH/wETH pool to prevent potential exploits during significant price deviations.

Recommendations

Based on our analysis, we recommend the following parameters for the swap pools:

Pool Swap Fee (Negative) Swap Fee (Positive) Price Impact Factor (Negative) Price Impact Factor (Positive)
wstETH/wETH 30 bps 30 bps 1e-8 5e-9
wstETH/USDe 25 bps 25 bps 1e-8 5e-9

Conclusion

In summary, the Chainlink stETH/USD oracle, as currently proposed, does not adequately reflect the true market price of stETH due to its lack of on-chain liquidity data integration. This mispricing presents risks for accurate wstETH valuation on GMX and opens up arbitrage opportunities that could harm LPs.

By implementing the recommended swap fees and price impact factors, we can mitigate these risks, ensuring that the swap pools remain robust, fair, and economically viable for LPs and traders alike.

3 Likes

Hi everyone, Raoul from Chainlink Labs here.

The above post from Chaos Labs appears to not include any data from the new, upgraded feed. The analysis instead pulls data from the original wstETH/USD price feed, based on the previous design. The analysis ends on September 9, 2024, which is before the deployment of the new faster feed on September 24, 2024.

The charts below—using the correct Data Streams price feed—show that the updated feed’s performance has been highly accurate, with tight deviation compared to the benchmark exchanges. The new feed tracks very closely to a composite wstETH/USD price created by multiplying both the ByBit and OKX stETH/USD prices with the wstETH/stETH exchange rate. It also closely tracks the onchain wstETH prices from Uniswap V3 on Ethereum.

We’re happy to continue our collaboration with Chaos Labs on behalf of GMX, and invite them to perform their analysis on the updated feed.

2 Likes

This follow-up report reassesses the wstETH/USD Chainlink Oracle based on its testnet performance between September 27 and September 29, 2024. We aim to determine if the updated oracle feed shows improved accuracy in reflecting on-chain prices and whether we can proceed with its implementation using the previously recommended parameters.

Test 1: Comparison of wstETH/USD Chainlink Oracle to Derived On-Chain Price Using Curve Pool Data

Description: In this test, we compare the wstETH/USD Chainlink oracle price stream to a derived price calculated using:

  • The wstETH/stETH multiplier from the Lido contract.
  • The stETH/ETH price from the Curve stETH/ETH pool on Arbitrum, which is the primary on-chain source of stETH liquidity.
  • The ETH/USD Chainlink price stream.

Test 1: Comparison of wstETH/USD Chainlink Oracle to Derived On-Chain Price Using Curve Pool Data

Test 2: Comparison of wstETH/USD Chainlink Oracle to Prices Derived from Uniswap V3 wstETH/wETH Pool on Arbitrum

Description: This test compares the wstETH/USD Chainlink oracle price stream to a price derived from:

  • The wstETH/wETH price from the Uniswap V3 pool on Arbitrum, which is a key on-chain source of wstETH liquidity on Arbitrum.
  • The ETH/USD Chainlink price stream.

Test 2: Comparison of wstETH/USD Chainlink Oracle to Prices Derived from Uniswap V3 wstETH/wETH Pool on Arbitrum

Conclusion and Recommendation

The lower deviations across both tests compared to our initial analysis suggest that the updated Chainlink oracle feed has improved in accuracy. However, it’s important to note that the test period was relatively short and lacked significant market volatility.

Given the current results, we recommend moving forward with the Oracle, using the fee structure outlined in our previous post, which we will provide again below. We will revisit the performance after a longer period of testing on mainnet and provide updated recommendations if necessary.

Recommendations

Based on our analysis, we recommend the following parameters for the swap pools:

Pool Swap Fee (Negative) Swap Fee (Positive) Price Impact Factor (Negative) Price Impact Factor (Positive)
wstETH/wETH 30 bps 30 bps 1e-8 5e-9
wstETH/USDe 25 bps 25 bps 1e-8 5e-9
2 Likes

Thanks for the exhaustive research, and suggestions.

2 Likes

I understand the new Chainlink feed will soon be updated on Mainnet and once that is done, GMX will update to the new feed and configuration, solving the current issue for LPs.

2 Likes

GMX has switched to the new Chainlink feed today. We’ll observe the feed’s performance in the coming days to ensure everything works as planned, and then the parameters on the wstETH market will be updated ASAP. The warning about the 1% sell fee will also be removed once this has taken place.

2 Likes

Everything looks in order with the updated wstETH feed. The configs for the wstETH/WETH and wstETH/USDe markets have now been updated based on the recommendations in wstETH-WETH market temporarily disabled - #14 by chaoslabs

1 Like