Onchain Wizard - Understanding the Mechanics of the Rise & Fall of LUNA/UST
In this paid issue, I will be walking through the mechanics at play behind the rise and fall of UST/LUNA. If you read my thread on twitter about the UST attack, and found yourself a bit lost, my goal is you will have better understanding of the tokenomics, liquidity and flows behind the collapse after reading through this (but will also give you some color on how UST demand exploded leading up to the attack). Also as a reminder, paid subs will be getting a bonus post on Friday where I will go through what I’m seeing from “smart money” wallet activity.
The beginning of LUNA + UST:Lets start with a bit of background. The LUNA token was launched in January of 2019, with an ICO token price of $0.80 per LUNA (source). And the associated Terra blockchain (an L1) was launched in April of 2019. But it was not until late 2020 when things really started to heat up. In fact, until late 2020, the LUNA token spent its life as a sub ~$200mm market cap token.
Anchor, the protocol where UST holders could receive a yield on their stables, was not launched until July of 2020. While, UST, the stablecoin for the Terra/LUNA network, was not launched until September 2020. And then in December of 2020, Terra’s synthetic asset protocol, Mirror, was launched.
Now before we start thinking about how the bubble was formed, and then ultimately collapsed, we need to understand the mechanics of 4 things:
LUNA & UST for Dummies:As a reminder, a stablecoin exists to act as an asset pegged to the price of $1 of fiat. At a very basic level, there are only 4 types of stablecoins (there are some hybrids, but really there are just 4).
- Fiat backed (meaning dollars are the collateral protecting the peg)
- Crypto backed (crypto is the collateral, protecting the peg)
- Commodity backed (for example, a gold backed stablecoin)
- Algorithmic (uses algos, tokenomics and smart contracts to control price stability)
For collateral based stablecoins, the mechanism to retain the peg is simple in theory - the stablecoin should have a matching amount of dollars (or overcollateralized crypto or commodities) behind the stablecoin, so that users can always freely swap 1 stablecoin for one dollar of the collateralized asset.
But UST was launched as an algorithmic stablecoin, which used LUNA tokens to keep its price stability. How? Because of LUNA’s burn or mint mechanism. The LUNA token mechanics allowed any user to exchange 1 UST for $1 worth of LUNA and vice versa. So as demand for UST grows, UST in circulation grows, and $1 worth of LUNA is removed from its circulating supply when 1 UST is created. In reverse, if people want out of UST, and its circulating supply shrinks, the supply of LUNA goes up (or is minted).
So when UST would drift below $1 (signaling sell pressure), there is an arbitrage opportunity to redeem the discounted UST for $1 worth of LUNA. To redeem the discounted UST, you would obviously need to buy it, which in a perfect world would restore the peg, and keep the stablecoin algorithmically pegged to $1 (as UST supply also comes down).
When starting at UST in circulation of zero, this model allowed LUNA holders to see its price skyrocket, as surging UST in circulation adds significant buy/burn pressure to LUNA (sending the amount of LUNA in circulation down).
Mirror Protocol:Ok so you are the founders + investors of LUNA, and you are sitting at a sub $200mm market cap in December of 2020. To pump up the value of LUNA, you need to drive demand for UST + attract users to your blockchain (because growth in UST leads to buy pressure and burns of LUNA). The 2 main protocols that attracted capital to the LUNA ecosystem were Mirror and Anchor.
I’m not going to go too in depth on the tokenomics of Mirror itself, but the simple way to understand Mirror is that it was a place where people could trade synthetic versions of stocks on the blockchain, 24/7. These synthetic assets were backed by UST, and traded in UST. And you could provide liquidity in these pools using the synthetic asset (mTSLA for example) and UST. The ability to both farm and trade synthetic stocks led to a flood of capital into Mirror, reaching $650mm by February 2021, and at its peak was $2.4bn in May of 2021. Note: the SEC was not a fan of Mirror.
Source: https://mirror.smartstake.io/
This was rocket fuel to the LUNA price, as UST in circulation went from $20mm in December of 2020 to $2.1bn by May of 2021. LUNA’s price went from $0.50 in December 2020 to $17 in May of 2021 (or a ~34x), with the market cap hitting $6.5bn.
As crypto markets cooled off in May of 2021, with ETH falling from $4k at its peak to ~$1,800 at its July 2021 trough, UST locked into the Mirror ecosystem began to fade, with TVL falling ~$600mm over this time. UST in circulation flatlined from May to July, and another source of UST demand was needed to drive LUNA higher (LUNA fell ~65% peak to trough during this period).
Anchor:Enter Anchor, a protocol where users could deposit UST and receive 20% “risk free” yields on their stablecoin. Given the perceived safety of the UST stablecoin and the size of LUNA, people viewed this as an alternative savings account, where they could park their hard earned money. UST demand flowed initially from Mirror to Anchor during the pullback in crypto over the summer of 2021, and then exploded from there. The final leg of the explosion came in the form of Degenbox (launched in October 2021), from the one and only Dani Sesta, of Wonderland (TIME) and Abracadabra (SPELL) fame, which allowed users to deposit UST to mint MIM (SPELL’s stablecoin) at a 90% loan to value ratio. They would loop this transaction up to 10x to give you a ~100%+ APY (deposit UST, borrow MIM, get more UST, deposit on Anchor, mint more MIM, etc).
Source: https://defillama.com/protocol/anchor
Anchor’s total value locked went from $1.1bn in August of 2021 to $17bn by May of 2022. Especially as the crypto market started breaking down earlier this year, investors flocked to Anchor as a place where they could stay “safe” and ride out a crypto bear market. This TVL growth came in the form of newly minted UST, which grew from $2bn to $19bn over this time, and LUNA went from $10 to ~$116 at its peak. The combination of LUNA’s and UST’s market cap had now grown to ~$57bn at the peak, putting LUNA as a top 10 market cap within crypto.
But was it sustainable?:Ok so now you have a good overview of how we got to the point where my twitter thread roughly starts. UST in circulation grows to $17bn, while LUNA’s price skyrockets, driven by yields on Anchor (and Degenbox from SPELL into Anchor). But if you have been reading my content, you know that in crypto, you need to know where your yield is coming from, and if you don’t know you may be walking into a disaster.
So where was this 20% risk free yield coming from? Well Anchor had a “yield reserve” that paid out these rewards (so the yield was nothing other than a house of cards). Terraform Labs (founders of LUNA) funded this yield out of their own pocket, to keep the show going. But at a ~$17bn TVL in Anchor, that is $3.4bn per year of rewards! Somebody had to keep footing this bill to keep the whole game going, or else people would leave Anchor, exit their UST and cause a run on the bank.
So Anchor & UST were getting too big to handle, and the Anchor Yield reserve was down to just $200mm by May 6th (after the Terra team added another $450mm in February). The Terra team was also reluctant to reduce Anchor rates, as it would create a run on the bank.
So coming into early May 2022, the Anchor Reserve had less than 1 month of runway. The yield was looking very unsustainable, so the LUNA foundation starts accumulating BTC (and the LFG Reserve has now deleted their account) to try and protect UST in the event of a bank run.
So the stage is set. Runway to pay yields for UST on Anchor are dwindling to nothing. LFG acquires billions of BTC to try and back UST, to fight any bank run or de-pegging event. But there is also one key issue on why this bank run was going to be fatal before it ever happened: Liquidity.
UST Exit Liquidity (No Way Out):UST on Anchor was ~70% of total UST supply, at ~$17bn in early May. If you were to panic and exit, where could you go?
Well, you could just redeem your 1 UST for $1 of LUNA, right? Yes, to a point. Real LUNA trading volumes were only ~$300-600mm/day according to Messari. So if you started minting $1bn clips of LUNA, the LUNA price and the UST price are going to fall. In short, There was a massive liquidity mismatch here.
The same thing was true for UST volumes themselves - trading volumes + liquidity were very low, so a mass run for the exits would swamp the UST price, causing it to de-peg.
And then your last form of liquidity is from the stablecoin swap provider, Curve, which had over $1bn of liquidity back in April, but was drained in advance of the 4pool transition.
The Collapse:Ok so now we’re at my thread - On 5/7 $150mm of liquidity is pulled from Curve by the Luna Foundation. Just 13 minutes later a freshly funded wallet drains $85mm of UST from the pool. And then over the course of a few days the remainder of the Curve liquidity is drained.
So a question I get asked is what does “drained liquidity” mean in this situation. Well the Curve pool for swapping UST to USDC/USDT/DAI keeps UST pegged to $1, because there is liquidity on both sides of the swap. Similar to what I’ve talked about in my summaries of how AMMs work, when you aggressively sell one side of the pair, and no one adds liquidity, eventually there is no liquidity for anyone else to sell. In this situation, the pool ended up being 100% UST, meaning you could not swap it into other stables. So while this liquidity pool only de-pegged UST to ~97c (due to Curve’s structure), one of the deepest exits for UST was now closed. After this point, your only exits were redeeming 1 UST for $1 of LUNA or trying to exit via centralized exchanges like Binance.
There was limited liquidity of UST on centralized exchanges, with one of the main exits being Binance where you could exit to USDT. Our attacker aggressively sells UST there, causing it to de-peg downward to ~80c early on, and given the liquidity is still very low, the de-pegging only got worse (no buy-side pressure). This sparks the panic where the real de-pegging starts to happen.
Ok so lets look at LUNA. On 5/10 its price had fallen from ~$60 to $30, as people minted LUNA to exit (or were front running how this story was potentially going to end), with the market cap falling to $11bn. But the circulating market cap of UST was still ~$16bn! This sets up the LUNA/UST death spiral. Given you can mint $1 of LUNA for 1 UST, this meant that the entire ecosystem was actually insolvent. You had $16bn trying to exit UST in any way possible, and could mint $1 of LUNA for your UST. So as the UST price de-pegged, to get your $1 of value, you could mint LUNA, and then sell it. But you have $16bn of liabilities trying to redeem for $11bn of assets (where the liquidity was low). So what happens? The LUNA price gets lower, and lower, which also means the dilution of the $1 LUNA mints got worse and worse on the way down. Eventually LUNA lost all of its value, and now trades at ~$0.0002, because the dilution of the LUNA mints sent the circulating supply of LUNA tokens from ~344mm to 6.5 trillion!
In a nutshell, some sort of bank run on UST was bound to happen, because Anchor was becoming unsustainably large, and the liquidity to exit was too low ($17bn trying to exit in $700mm/day of trading volumes + reflexivity on the way down). With the Curve exit door closed, UST started to materially de-peg (and the Luna foundation sold their BTC to try and save the peg). Both UST and LUNA death spiraled out of control, as the sell pressure of LUNA was massive in comparison to is liquidity, eventually rendering it insolvent as the market cap of LUNA was lower than UST in circulation. This was an Enron sized blowup that will be talked about for many years to come, and the attacker likely shorted both BTC (in size) and LUNA (in lesser size), and made a mountain of money from the attack.
So What can we learn from this?
- Remember to know the source of yield for anything you are doing in DeFi. A quick look at the Anchor reserve yield would have told you that the runway was gone, and if they turned off the Anchor rewards, people would have started exiting anyway
- Watch liquidity - outside of a few majors, liquidity is not high in crypto. $17bn in assets in comparison to limited exit liquidity added fuel to the fire in this situation
- Stablecoin projects are risky. Of all the projects that blowup, it seems a lot of them have a stablecoin involved (that can either de-peg, or be exploited for an infinite mint)
- And that algo stables are even more risky. Stables are going to be regulated following this event anyway, but its important to note that if your stable does not have collateral behind it, it can de-peg very quickly
- Be careful of crypto visionaries - We’ve seen this now with Andre and FTM, Dani with SPELL & TIME, and now Do Kwon with LUNA. When someone starts to get a massive cult behind them, a lot of money can be made, but also a higher level of caution should be exerted
I hope this deep dive into some of the liquidity and tokenomic mechanics behind the rise and fall of LUNA will help you protect your portfolio, and spot future projects with similar issues. I’ll be doing more content like this looking at the rise and fall of other crypto blowups, so that we can all sharpen our pencils and learn what to look out for to both make money and avoid landmines. I’ll also be doing a bonus post this Friday on wallet activity for folks I am following, so make sure you check that out as well.
Stay safe out there, and give me a shoutout on twitter if you thought this was cool!
Disclaimer: This content is for informational purposes only, you should not construe any such information or other material as legal, tax, investment, financial, or other advice.