A few weeks ago, Terra (LUNA) and UST crashed, following what may have been a coordinated attack. Here’s what we think happened.
- LUNA and UST were intertwined thanks to three different mechanisms
- Two destabilization events occurred, making the Terra ecosystem more fragile
- The alleged attack built on these characteristics and succeeded
The relationship between UST and LUNA
There are three types of stablecoins: fiat-collateralized stablecoins, crypto-collateralized stablecoins, and non-collateralized stablecoins. Fiat-collateralized and crypto-collateralized stablecoins are backed 1:1 with the reference asset, often USD. Examples include USDT and USDC (fiat-collateralized) and DAI (crypto-collateralized). Non-collateralized stablecoins, like UST, are also called algorithmic stablecoins because they typically use an algorithm or smart contract instead of collateral to manage the supply of tokens and maintain their value, or peg, to the reference asset.
The Terra protocol relied on three mechanisms to mint stablecoins:
- Open-market arbitrage incentives. These incentives are meant to maintain the stability of the price between the stablecoin and the real world asset. For example, if 1 UST is trading at .99 USD, traders can buy 1 UST for .99 USD. Traders then use Terra Station’s market swap function to trade 1 UST for 1 USD of Luna. The swap burns 1 UST and mints 1 USD worth of Luna, thus decreasing UST supply and increasing LUNA supply. In order to profit, traders must sell the LUNA they receive into the open market. This arbitrage continues, and UST is burned to mint Luna until the price of UST rises back to 1 USD. Because LUNA is being sold and its supply increases, LUNA’s price decreases and UST returns to its peg level.
- Mint-and-burn emission mechanism. UST (or any other stablecoin on the Terra protocol) was minted when LUNA tokens were burned to increase the UST supply. Importantly, this worked in the opposite way as well: UST could be burned to mint and increase the supply of LUNA.
The chart below shows how the spike in UST supply correlated 1:1 with LUNA burned, and not coincidentally with a skyrocketing LUNA price (due to supply decreasing). Due to limited data availability, we only have statistics through the end of 2021.
This mechanism explains why the supply of LUNA ballooned from around 1 billion in circulating supply to 7 trillion during a three day period as UST holders sought shelter from the de-pegging (see chart below). As UST was sold or burned, LUNA had to be minted to compensate the UST holders 1:1. It also makes the asset strictly demand-driven: Users have to burn their LUNA in order to mint UST. This made market sentiment around LUNA an important factor of UST’s stability.
- Decentralized oracle voting. Validators aggregated asset prices into oracles following a consensus mechanism. These validators used off-chain asset prices (mostly from centralized exchanges) to inform the LUNA/UST exchange rate. Terra validators had two roles:
- Providing consensus for block production just like in any other blockchain
- Unique to Terra, validators voted on the Terra Oracle Module which informed the LUNA/UST exchange rate. Any node could participate in the oracle voting – which was incentivized via fees generated from LUNA/UST swaps. This means that validators had to use off-chain price information to vote on the on-chain exchange rate. The dependency on LUNA prices at centralized exchanges wass integral to Terra’s blockchain operating smoothly.
How the UST/USD peg broke
After looking through on-chain data (see these two threads here and here) it appears that a few connected wallets were responsible for the initial UST/USD de-peg. The scenario we’ve described below is our best effort at trying to make sense of the data, but we cannot be certain this is how the de-peg unfolded.
Although most of the action occurred during the days of May 8-12, the first event driving the destabilization happened on March 22 when Luna Foundation Guard (LFG), whose purpose is to protect the Terra ecosystem and UST’s peg, began buying bitcoin (BTC) to partially collateralize UST. Over the course of the next 1.5 months, LFG amassed a $3B+ BTC position, meaning that 1/6th of UST’s market cap was collateralized prior to the de-peg. Given the large amount of bitcoin LFG bought, LFG placed their trades using OTC desks where they could discretely execute large orders. There is heavy speculation that the consortium that sold their bitcoin to LFG also conducted the attack. In order to profit from the trade, they would have needed to borrow some (or all) of the bitcoin so they could sell it short (to LFG) in return for UST.
The second destabilizing event happened when Frax (FXS/FRAX) and Redacted Cartel (BTRFLY), two notable DeFi protocols, announced a partnership to launch “4pool” on Curve, and that over the following weeks they would aim to drain the “3pool” where over $1B in UST sat. This improved the attackers’ chances of succeeding because UST would have less liquidity on EVM chains, thus requiring less capital to execute the next steps of the trade.
To recap, the alleged attacker consortium took the following actions:
- The short: They borrowed and placed a ~100k BTC short that was valued at ~$4.2B based on an average buy price of $42k from March 27 to April 11.
- The swap: They swapped BTC for UST with Do Kwon. They sold ~15k of the 100k BTC to LFG in exchange for ~$600M in UST, and used some of the additional proceeds to buy another $400M of UST to create a $1B long in UST via OTC desks.
- The sell: Their next move was to take advantage of LFG reducing liquidity in 3pool to move it to 4pool. They would have done that by selling ~$350M of UST into USDC, USDT & DAI – causing UST’s peg to break and its price to fall to $0.97.
LFG then began selling its BTC to defend UST’s peg, which sent a negative message to the market, namely that the Terra team was concerned about the peg breaking further. The sale of BTC also incited panic among bitcoin holders and in the broader crypto market because it was unclear how much BTC LFG would sell to defend the peg (and how much lower this could drive the price of BTC).
Due to the algorithmic nature of UST (and the fact that it was only partially collateralized by BTC), the panic in the market increased as many players understood that UST was only backed by LUNA and that more LUNA had to be minted to burn (decrease the supply of) UST. In this sense, the market’s emotional response to UST’s depeg was justified. In turn, it increased the selling pressure on LUNA. Combined with the fall of UST, it led to an increase of LUNA supply from ~1bn to 7 trillion on May 7, and a price fall of 99% due to this hyperinflationary event.
In summary, the reflexive relationship of LUNA and UST drove both the ecosystem’s massive growth from <$1bn to $100bn+ in market capitalization, and back down to near zero where we sit today. As for the alleged attackers, they would have been able to buy back their short position around $30-32k, meaning they would have profited nearly ~$1B off that leg of the trade (short 100k BTC at $42k, buy back at $30k for a profit of $10k per BTC, or ~$1B).
- A coordinated attack on the peg might have caused market panic
- UST’s algorithmic backing by the network’s native token, LUNA, and by a small amount of Bitcoin left investors feeling vulnerable, exacerbating panic
- LUNA hyperinflated due to Terra’s mint-and-burn model and its mechanism of off-chain pricing informing on-chain pricing. The result was that LUNA’s price crashed to near zero, making it impossible to maintain UST’s peg to USD.