Asset Risk Assessment - Terra (UST)
A risk assessment on Terra's UST stablecoin for Curve veCRV holders
Useful links
Terra (UST) as an asset
Useful links:
UST is an algorithmic stablecoin in the Terra protocol. There are three mechanisms that are involved in the minting of stablecoins in the Terra protocol:
UST (or any other stablecoin) is minted when the token LUNA is burnt to increase its supply. Vice-versa, UST supply reduction involves burning UST and minting LUNA.
Open market arbitrage incentives - incentivises stability of the price between the stablecoin and the real world asset (explained further).
Decentralised oracle voting - validators aggregate asset prices into oracles following a consensus mechanism (explained further).
A full audit of the Terra protocol was done by Certik, who reported no critical issues with the chain. A very cool dashboard of their security audit can be found here. It may be worthwhile to note that Certik also appears 4 times on the Rekt leaderboard.
The organisation behind terra is Terraform Labs (legal entity based in Singapore). Currently the organisation is facing ‘fact-finding investigation’ from the United States Securities and Exchange Commission on the legality of Terra offering the Mirror Protocol’s mAssets (mirroring price of securities) to US investors.
UST mint and burn mechanism
Terra (UST) and LUNA mints and burns happen natively in the Terra blockchain. Here is an example transaction where 3.26 UST is minted and 0.05 LUNA is burnt (the decimals for UST and LUNA is 6):
The burnt LUNA is sent to the address : terra1untf85jwv3kt0puyyc39myxjvplagr3wstgs5s, which does not exist if you query it on Terra block explorers.
Price Oracles
Oracle Module
Useful links:
The terra blockchain constructs a price feed using the Terra Oracle Module. This assigns two roles to a Terra validator:
Consensus for block production
(Optional) Voting on the oracle (Github code): the cross exchange rate of LUNA and other stable-assets (UST in this case). Voting on the oracle is unique to Terra. A validator may choose to abstain from voting on the Oracle. Any node (not necessarily a validator node) may participate in the oracle voting: this is similar to Chainlink oracle consensus mechanisms. The incentive to maintain this is for seigniorage: LUNA -> UST swaps result in fees which are distributed to nodes that vote for the exchange rate.
This framework relies on external validators to vote on the current LUNA exchange rate (in different currency denominations) using price information extrinsic to the blockchain (off-chain prices from centralised exchanges). The oracle module reaches a consensus from the supplied exchange rate from validators and nodes. Although validators may use their own price and aggregation logic, LUNA price reported by validators is an aggregation from LUNA/USD or LUNA/USDT and USDT/USD prices at different exchanges. The dependency on LUNA prices at centralised exchanges is integral to the blockchain itself.
Risks - Consensus attacks
There must be a validator diversity so that centralisation cannot cause Terra Oracle module manipulation. Consensus for block production in Terra requires 2/3rd of all votes for the next block to be appended onto the chain. This means controlling 1/3rd of the votes is enough for a malicious group of validators to deny block production by voting against the next block. There are currently 130 validators (as of 19th December 2021), with the largest 5 validators controlling 28.4% of the voting power (this changes over time).
Certus One - Stake ID. They are also the ones behind the Wormhole bridge. The main entity behind Certus One is JumpCrypto.
Risks - Oracle attacks
There exists a possibility where the oracle can be attacked via a DDoS. An example of a recent DDoS attack was on September 3, 2021 where an attacker blocked access to the public node used by most validators using a DDoS attack.
(deprecated) Oracle votes are included in the same block, but do not have a priority over other transactions in the block. This means that, if the network is congested, oracles cannot be voted on and price data cannot be updated: this has historically occurred during product launches on Terra.
Note: risk #2 has been deprecated following updates to Terra which will prioritise oracle votes over other transactions.
UST/USD stability
Adoption of the Terra ecosystem (at the time of writing this report) is at its peak, with the UST stablecoin in high demand. The stablecoin peg to the dollar has seen erratic volatility in the past, but seems to have calmed in more recent times. This has to do with the fact that there exists an on-chain redemption capacity or the max mint or burn cap at lower spreads: this is a soft cap. This was previously set to 20 million UST/LUNA at 2% spreads with larger mints and burns experiencing exponential increases in spreads between LUNA/UST market module swaps (mints/burns). This is a soft cap: larger redemptions may occur but have exponentially increaseing spreads. This was insufficient to contain depeg events due to cascading liquidations (explained further ahead).
The primary reason for capping on-chain redemption of LUNA/UST was to ensure that on-chain liquidity could not exceed off-chain liquidity. The logic is: if off-chain liquidity of LUNA/UST is lower than on-chain liquidity, price oracle manipulations are economically cheaper to orchestrate. If there are no caps, the following can occur:
Raise LUNA price off-chain (higher bids with very large volumes) since off-chain liquidity is low and oracles rely on off chain prices.
Burn LUNA on-chain to mint UST, since on-chain oracle now reports higher LUNA prices.
Market dump LUNA at higher prices to drive down prices reported by on-chain oracles.
Burn UST to mint LUNA cheap: you now have more LUNA than you started with.
Introducing an on-chain redemption cap ensures better control over on-chain liquidity. However, having levers that limit flexibility of the Terra protocol poses challenges: in the event of cascading liquidations, a redemption cap would limit the ability of the system and its participants to absorb price volatility. After a certain point, the protocol can do nothing but wait for the UST peg to recover (time based arbitrage). This happened with Terra's Anchor protocol in recent history:
Affect of cascading liquidation events on LUNA stability
Useful links:
Terra twitter thread on the effect of cascading liquidations and redemption caps
Anchor Protocol tweet thread on addressing challenges faced by liquidation cascade events
Explained very well in this twitter thread, the thread of events unfurls as follows:
Extreme volatility in crypto markets affected LUNA prices.
Sharp price decline in LUNA was accompanied by cascading liquidations in Anchor protocol.
LUNA/UST redemptions exceeded 80 million in its peak: this exceeded the redemption cap of 20 million, introducing a spread of 7-8%.
Large spreads led to unprofitable fast arbitrage of UST, so the market had to wait for the peg to recover (buy cheap UST, wait for re-peg, redeem USD at profit) -> time based arbitrage.
Fast arbitrage efforts resulted in amplified price drops of LUNA: buy cheap UST, redeem for LUNA when spreads were favorable, sell LUNA in the open market to complete arbitrage.
The fix
Following this, the on-chain redemption cap has been raised to 100 million dollars at 0.5% spreads. This has thus far stabilised the peg. Further on, Anchor protocol proposed changes to its liquidation mechanism to combat cascading liquidations.
The system responded in kind to the effect of cascading liquidations and UST de-pegs, and the data shows that this has worked quite well so far, since UST has managed to absorb other examples of extreme market volatility events since the May crash. Since then, UST peg-stability insurance now is a thing.
UST on EVM chains
Useful links:
The tokens used in Curve pools are listed in the following.
wrappedUST with the address: 0xa47c8bf37f92aBed4A126BDA807A7b7498661acD. The token contract was deployed by the Terra deployer in block 11345219, Nov-28-2020 05:49:59 AM +UTC.
wormholeUST token with the address: 0xbd31EA8212119f94A611FA969881CBa3EA06Fa3d. The token contract was deployed at block 13408366, Oct-13-2021 06:08:47 AM +UTC. The token is not verified at the time of publishing this article.
The wrapped UST (among other wrapped Terra protocol tokens) are bridged over to Ethereum (or Binance Smart Chain and Harmony) using the Terra Shuttle Bridge and the Wormhole v2 bridge. There seem to be no audits for both.
An example of a UST mint transaction from the Shuttle bridge:
Terra Transaction Hash (memo of the transaction hash is the Ethereum recipient address) > Ethereum Transaction Hash
Shuttle UST to Wormhole v2 UST migration
The wormhole v2 bridge is posed to be the successor of the shuttle bridge, The bridge already exists and serves its users, and has more than 470 million of liquidity locked in its Ethereum bridge contract. Wrapped UST is planned to be phased out in favor of Wormhole UST (or USTw). This phase out will involve a token migration between wrapped UST from the shuttle bridge to wormhole UST using a Token Migrator Contract. USTw is currently traded on Curve in Factory pool 53.
The token migrator contract is currently unverified: this makes security assessment challenging. A key issue we observe is that Terra is currently driving up Shuttle UST liquidity as well as Wormhole UST liquidity. This impedes any migration activity as liquidity generally follows incentives.
The wormhole v2 bridge is a step towards improvement, with its decentralised design: it is building towards a cross-chain future. The bridge is experimental, unaudited, and holds a massive amount of liquidity: this is the market signalling its value. However, the bridge being unaudited imposes significant risk on Curve’s liquidity providers.
Terra (UST) as an asset on curve pools
There are a few pools on curve.fi (Ethereum). The numbers indicated below are as of 22nd December 2021.
MIM-wrappedUST Factory pool 48: 1 billion USD in liquidity
USTw 3crv factory pool 53 (Wormhole v2 pool): 391 million USD in liquidity
wrappedUST-3crv pool: 38 million in liquidity
wormholeUST-FRAX factory pool 74: Empty pool (Curve Governance Proposal for gauge)
We focus on the first 3 pools, since that’s where most of the trading activity takes place. Total CRV in USD emitted to these three pools is 15.55 million (as of 23rd December 2021), while the revenue generated is 3.37 million USD combined. The pool has a low revenue/emissions ratio, owing to their participation in gauge-bribing, which attracts vast amounts of liquidity for large amounts of CRV emissions.
The pool activity has seen an upwards trajectory in all three, and is summarised in the following:
Swap Volumes, Sizes
UST is a very popular asset traded on Curve generating good amount of revenue for LPs and veCRV holders.
Revenue generated
Data acquired from llama.airforce. The website tracks claimed admin fees:
Curve pools have significant wormhole UST and shuttle UST trading activity and an increase in liquidity thanks to Votium and Convex. This comes from Terra protocol considering bribing CRV holders for directing more gauge votes towards their pool.
This has boosted wrapped UST and wormhole UST liquidity in Ethereum on curve pools, which has been able to handle the incoming trading activity caused by Abracadabra’s new Degenbox Strategy.
Summary
Terra UST is a decentralised stablecoin pegged to the UST using an intricate combination of mint and burn issuance mechanism with LUNA (Terra's native asset akin to ETH), arbitrage and market sentiment. The asset's peg stability to the USD is governed by Oracles which are Terra nodes and validators voting on the price: similar to how Chainlink operators report on asset prices. There is no collateralisation associated with LUNA, so calculating C-ratios is an effort in futility. UST is minted and burnt by burning and minting LUNA, accessible via Terra's native wallet. This makes the asset strictly demand-driven: users have to burn their LUNA in order to mint UST. This places a requirement on the user to want to hold the LUNA asset, thus making market sentiment around LUNA a component around UST's stability.
The arbitrage conducted to balance UST to USD involves the reported on-chain oracle prices (attack vector), and fast arbitrage using LUNA mint and burn mechanism: if UST is below peg, buy cheap UST off the market > swap for LUNA at 1:1 parity (excluding 2% slippage until 100 million USD) > sell LUNA at 1 USD parity with the market (similar mechanics with over peg scenario). This fast arbitrage mechanism has caps designed to balance on-chain and off-chain liquidity of assets involved in the minting and burning process such that oracle manipulations are economically non-viable.
Historically, UST has seen severe price volatility against USD, with intervention requiring from the community protocols (Anchor with its improvement proposals on handling liquidations better, JumpTraders recommending higher redemption caps on minting and burning UST/LUNA, Chainlink integration) which have thus far had a positive impact on UST/USD stability. Of late, major drops in LUNA price has seen a more resilient UST stablecoin.
The UST asset has enjoyed Curve's concentrated liquidity AMMs and generates significant amounts of volume and trading fees. The asset has been heavily incentivised in Curve pools following Terra’s participation in gauge bribes via Votium. In the past few months, we have observed an exponential increase in UST volumes across the crypto markets. This comes with increase in UST mints for yield farming strategies, and the market speculation around the token (which increases the buffer for UST mints).
On decentralisation …
The stablecoin is fairly decentralised in its minting process: users can easily mint and burn UST via the Terra station wallet.
The blockchain seems decentralised at first glance (lots of validators), but the top 10 validators may have the ability to halt block production and effectively impose censorship (validator collusion).
The DAO mechanism of Terra is via the Terra station, where voters can vote on governance forum and key changes to the protocol. For an interesting breakdown of the kinds of proposals Terra has seen in the past, refer to this Flipsidecrypto dashboard.
The Terra Shuttle bridge is centralised. Terra’s plan is to phase out of Shuttle and onboard the Wormhole v2 Bridge (running in production already), which aims to be a step towards bridge decentralisation.
On risk …
Market risk
The algorithmic nature of UST’s peg to USD adds significant risk to the asset. However, it is important to note that effectively the entire Terra ecosystem and its users are incentivised to mitigate risk associated with UST. The UST/USD peg is so important, it is practically written into the core of the protocol.
Oracle risk
Since the price oracle votes occupy blockspace, validator collusion could influence Terra oracle prices indirectly by block censorship.
Oracle price votes do not have priority in the blockspace (yet). In the event of a congested network, oracle price updates can be slower: this is a risk to the stablecoin’s peg during extreme market volatility.
Smart contract risk
Certik’s audits showed no issues with Terra’s blockchain code. However, Certik is on the rekt.news leaderboard for four times (at the time of writing this report).
The wormhole UST token isn’t verified. The Shuttle and wormhole bridges are not audited. These are significant risk factors on the asset.
Regulatory risk
The reviewer anticipates low regulatory backlash on UST, since the current fact-finding investigation concerns the Mirror Protocol and not UST.
Does the asset meet minimum requirements?
Is it possible for a single entity to rug its users?
This possibility may exist: no audits exist to eliminate this as a potential risk.
If the team vanishes, can the project continue?
No. Terra is a test-in-prod work-in-progress defi experiment. The same applies to wormhole UST and wrapped UST.
Do audits reveal any concerning signs?
There are no audits from coveted audit firms. Several Wormhole UST contracts are not even verified.
Recommendation.
The Terra protocol could benefit significantly if top level audit firms (e.g. ChainSecurity, Trail of Bits, Formal Verification, Consensys Diligence) were given the opportunity to look into Terra’s infrastructure.
Wormhole UST needs audits and more transparency.
Wormhole UST contracts need to be verified.
Migration of wrapped UST to wormhole UST cannot happen if wrapped UST is being incentivised.
With regards to wormhole UST, it is prudent to wait for audits and verified contracts for Wormhole UST first before incentivisation (in favor against). For wrapped UST: not incentivising pools will help liquidity migrate to wormhole UST pools (after wormholeUST has audits and verified contracts). For now wrapped UST seems to be the superior of the two (in favor for).
Oracle risk #2 is not valid. It was prioritized since Sep 24
Oracle risk #2 is not valid. It was prioritized since Sep 24