December 12, 2022

CurveFinance, the DEX protocol known for its stableswap and multi-asset pool design, recently announced its stablecoin design.

The 2 most important pillars of its design are LLAMMA and PegKeeper.

LLAMMA stands for Lending-Liquidating AMM Algorithm. It is an automated liquidation/deliquidation procedure, using the features of Uniswap v3.

Compared to other lending protocols such as AaveAave, the liquidation procedure is automated. The AMM converts the collateral to Curve’s stablecoin (let us call it crvUSD for now) when the collateral price drops, converts crvUSD back to the collateral when the price rises.

Due to this feature, there exists a in-the-middle state that is between total liquidation and total deliquidation/collateralization. What is even more interesting is users can potentially get their collaterals back instead of a permanent liquidation, thanks to the range order feature of Uniswap v3.

But why does Curve not use its own in-house AMM, Curve v2?

First, there is no concept of price range in Curve v2. It is a full price range (0 to inf) AMM. Second, there is no analytical solution to calculate the final state for each “price band”. Its calculation involves solving a cubic equation.

The crvUSD white paper divides the entire liquidation range into price bands, with the upper price and lower price for each band denoted as P_up and P_down.

The advantage of rebalancing over multi-bands versus over a single price band is better slippage, by refocusing the liquidity for each band.

The way it denotes the relation between the base price and the upper and lower price for each band is equivalent to price ticks in Uniswap v3.

In each band, the liquidity is uniformly distributed. Therefore, we can provide a simple proof for equation (9) and (10) in the white paper though the author arrived at these relations using numeric computations:

The fungible liquidity inside each price range is also beneficial to multi-user liquidations.

Due to rebalancing, there are permanent losses. How to choose the best parameters (A, n) seems like a challenging problem to tackle.

Permanent loss, slippage, and gas cost all need to be considered.

The 2nd most important pillar, the crvUSD’s PegKeeper, maintains the USD peg of crvUSD as the name suggests.

This is achieved by varying the interest rate based on the discrepancy between the oracle price and instantaneous price in LLAMMA.

If there is increasing demand for crvUSD, lower the interest rate to incentivize borrowing. If the demand is decreasing, dial up the interest rate to incentivize redeeming and burning of crvUSD.

Why not choose other stablecoins to implement this?

First, native stablecoin can generate revenue for Curve. Second, currently there is no other stablecoin that supports LLAMMA.

crvUSD can also take advantage of the existing stableswap infrastructure and related liquidity.

crvUSD White Paper: https://github.com/curvefi/curve-stablecoin/blob/master/doc/curve-stablecoin.pdf