Ratio Finance

Liquidation Engine


Liquidations are extremely important for Ratio, they help us keep the protocol healthy and they will allow us to expand into accepting LP tokens with volatile underlying assets.
Ratio's liquidation engine involves real-time monitoring of the health of each user's vault, and relies on external information of the liquidity pool. Since LP tokens form the collateral for minting USDr, it is necessary to constantly check the value of the collateral based on the LP token price, which is a function of total value locked (TVL), volume, individual prices, and price slippage.
In general the market value of LP tokens is calculated by dividing the total liquidity in the pool by the number of LP tokens issued, i.e.,
PXLP=Total Value LockedTotal LP SupplyPX_{LP} = \frac{\text{Total Value Locked}}{\text{Total LP Supply}}
In liquidity pools, the starting or ideal balance of assets is in equal proportions. When a transaction takes place, the proportion of assets in the pool changes, as one asset is exchanged for another. This imbalance is short-lived as the constant product of liquidity pools incentivizes arbitrageurs to rebalance the pool. However, the Market Price of the LP token does not account for the risk of pool imbalance, which could occur from high volume transactions. For example, the Market Price of USDC-USDT might still be $1.04, while the pool is highly imbalanced to the proportion of 5 USDC : 1 USDT. To remedy this situation, we introduce the Fair Price of an LP token.
The calculation of Market Price and Fair Price is pretty straightforward, it just depends on the underlying prices
, composition
and total supply of the LP token
. For a 2-Pool, the functional forms are:
PXLPMarket=PAXA+PBXBLandPXLPFair=2PAXAPBXBLPX^{Market}_{LP} = \frac{P_A X_A + P_B X_B}{L} \quad \text{and} \quad PX^{Fair}_{LP} = 2 \frac{\sqrt{P_A X_A P_B X_B}}{L}
In the following plot we show the almost fixed Market price of the LP token as the blue line while the amount of USDC reserves in the pool ranges from 0.2 million to 23 million, causing the Fair Price to take the shape of an inverted parabola.
With reference to the plot above, this imbalance can be very costly to the LP provider in a case where there is a large amount of USDC and it goes off its $1 peg.
To protect borrowers from the risk of imbalance, Ratio Finance has a dynamic risk management parameter to account for real-time risk of assets using fair pricing called Delta.