Skip to main content
Case studiesdefaultDeFi

Decoding the LUNA crash: The early warnings from DEX liquidity pools

By May 17, 2023No Comments8 min read

The financial earthquake that sent shockwaves through the crypto universe in 2022 was instigated by the sudden collapse of Terra Luna. Both its digital currencies – LUNA and UST – held top positions within the top 10 market cap cryptocurrencies before the event.

Background

This section serves to elucidate the relationship between Terra’s UST and LUNA, particularly for those unfamiliar with the specifics. Terra operated on a twin token system where UST functioned as an algorithmic stablecoin pegged to the US dollar, and LUNA, as its accompanying seigniorage share, was designed to cushion the volatility that might otherwise destabilize the stablecoin.

UST’s stability was assured through an on-chain mint and burn protocol, a conceptual automatic market maker (vAMM) founded on the premise that 1 UST, regardless of its market value, equates to around $1 of LUNA. This arrangement was designed to mitigate UST price fluctuations and volatility by adjusting the UST and LUNA supply through on-chain arbitrage.

Let’s consider a scenario where UST’s market value escalates significantly above its peg, say to $1.10. In such a case, an arbitrageur can buy $1.00 worth of LUNA and exchange it for UST through the on-chain protocol, trading the $1.00 LUNA for a newly minted UST, valued at $1.10. The arbitrageur could then sell the UST at market price, pocketing the difference between the market value of UST and the on-chain protocol’s value. This operation, if carried out repeatedly, would increase UST’s supply until it aligns with its demand at around $1.00.

Conversely, if UST’s market value drops below its peg, for instance, to $0.90, an arbitrageur could buy UST at this reduced price and exchange it for LUNA using the on-chain protocol. The $0.90 valued UST would be swapped for $1.00 worth of LUNA. The arbitrageur would again profit from the gap between the market and the on-chain protocol’s UST value, playing a critical role in reducing UST’s supply until it reattains its peg.

UST formed the backbone of numerous protocols across the Terra ecosystem, with its most notable use case being Anchor – a popular lending and borrowing protocol offering high fixed interest rates for depositors. Prior to the incident on May 7th, almost 75% of the total UST market capitalization was deposited into Anchor.

Terra/UST stabilisation mechanism, source: thetie.io

In theory everything was supposed to work perfectly, until the May of 2022. Let’s take a look into the events.

First signs in Curve pools

Curve Finance is a decentralized exchange (DEX) that has been optimized for stablecoin trading. It provides users with low slippage, minimal fees, and the potential to earn interest through liquidity provision. The key feature of Curve Finance is its algorithm, specifically designed for stablecoins, which enables users to trade between different stablecoins with low slippage and fees while maximizing their fee earnings.

One of Curve Finance’s most popular liquidity pools is the 3Pool, also known as the 3CRV pool. It comprises three of the most widely-used stablecoins: DAI, USDC, and USDT, all pegged to the US dollar. Liquidity providers can deposit any of these three stablecoins into the 3Pool and receive 3CRV tokens in return. These tokens represent the provider’s share of the pool and can be redeemed for a portion of the trading fees generated by the pool.

A unique feature of Curve Finance is its specialized liquidity pools, with our focus today being on the UST-3Pool. This pool incorporated the Terra USD (UST) stablecoin alongside the three stablecoins present in the 3CRV pool.

The UST-3Pool was designed to facilitate efficient, low-slippage swaps between UST and the other three stablecoins, largely due to the pool’s substantial liquidity. This setup also allowed liquidity providers to earn yield from trading fees, making the UST-3Pool an attractive option for those seeking passive income opportunities within the DeFi space.

May 7th:

Terraform Labs (TFL) withdrew $150 million in UST liquidity at 21:44 GMT, leading to a slightly destabilized but relatively balanced Curve pool. Soon after, an inactive account (“Wallet A”) disrupted this balance with an $85 million UST for USDC swap, the largest-ever transaction in this Curve pool. Almost immediately, a smart trader transferred $85M in UST from the Terra to the Ethereum blockchain, profiting from a lucrative UST for USDC swap on the UST/3CRV Curve meta pool.

Between 22:32 to 22:38 GMT, “Wallet B” further unbalanced the pool, executing three transactions totaling a $75 million UST swap. The pool was now critically imbalanced. Despite TFL withdrawing another $100 million in UST liquidity at 22:52, the pool remained vulnerable, a condition exacerbated when Wallet B swapped an additional $25 million UST at 22:59.

These large-scale swaps triggered a wave of similar trades, resulting in a massive UST sell-off and an increased UST market share within the pool. Despite a minor price drop, UST’s future was still undetermined. The UST price on Binance dipped to $0.99, setting off a liquidity crisis on DEXes.

Next days

Snapshot data from the UST-3CRV pool on Curve Finance highlighted that following a significant sell-off by a handful of UST holders, UST’s reserves came to represent more than 60% of the total pool reserves. This imbalance could have triggered an early de-pegging of the UST price, but it was averted due to Curve’s pricing algorithm.

On May 10th, the situation further escalated. UST reserves surged to account for over 90% of the total pool volume, exacerbating the imbalance. However, despite the UST/3CRV pool’s imbalance, no massive de-pegging of UST’s price was observed on either DEXs or CEXs. This delay between changes in Curve pool reserves and UST price shifts suggests that Curve’s stableswap invariant successfully shielded UST holders from a precipitous and premature drop in price.

Curve UST-3Pool on May 7-12. Red lines are detected anomalies.

Centralized exchanges (CEXes)

Centralized Exchanges (CEXes) reacted more slowly, attempting to restore the peg even when the situation on Decentralized Exchanges (DEXes) was already apparent.

Four to five days later, retail traders caught wind of the fact that UST was trading at a slight but steady discount to the US dollar. This information led to a rapid, widespread sell-off on CEXes, causing UST to plummet to $0.7. This triggered a liquidity crisis on major CEXes such as Binance, which experienced a severe depletion of their buy-side order books for UST markets.

The market’s response varied between CEXes and DEXes, as evidenced by the trading volumes across both types of exchanges. On DEXes, the traded volume reached an all-time high on May 9th, just before the price dipped below $0.9. However, on CEXes, there was a lag of one to two days in trading volume, which peaked on May 10th and 11th. This delay meant that UST holders on CEXes were unable to avoid the de-pegging of UST’s price.

TerraUSD price on CEXes 7-12 May

Summary

The sudden collapse of Terra Luna serves as a stark reminder of the importance of monitoring DEX liquidity pools. These pools served as early warning systems for the impending crisis, displaying signs of instability days before the widespread panic and sell-off.

Decentralized Exchanges (DEXes) are increasingly proving themselves to be leading indicators of market movements. Their open and transparent nature allows for real-time tracking of liquidity and price fluctuations, providing invaluable insights into potential market shifts.

This is where our early warning DeFi service at Chainkraft comes into play. We offer a platform that continuously monitors these market movements, alerting users of impending crises and enabling them to act swiftly to protect their assets.

In the case of the UST crash, the information asymmetry between CEXes and DEXes led to substantial losses for those who entered late into the market. UST holders trading on CEXes appeared to react one to two days after their DEX counterparts, by which time prices had already plunged to $0.8.

Therefore, the key takeaway from this incident is the crucial role of vigilance in cryptocurrency trading. Paying close attention to liquidity pool dynamics on DEXes can provide advanced warning of impending market fluctuations, enabling traders to make informed decisions and minimize potential losses.