Skip to main content

Curve V1 Savior Details

This is the math and logic that would apply in the case of a Curve V1 saviour integrated with the RAI protocol.

Overview

The Curve V1 savior requires SAFE owners to deposit Curve RAI/3Pool LP tokens. The RAI/3Pool contract can be found here.

Upon liquidation, the Curve savior will withdraw all underlying liquidity (RAI + 3Pool tokens) from the LP shares protecting the liquidated SAFE. It will then use the withdrawn RAI to pay back as much debt as possible from the SAFE. The 3Pool tokens aren't used in this process and will need to be withdrawn manually from the savior at a later date.

Minimum Savior Balance Calculation

We reuse the variable naming and debt/collateral liquidation relationship from the Uni-v2 savior calculation.

$$ \frac{C + C{lp}}{D - D{lp}} = \frac{A{cc}R{tar}P{rp}}{P{liq}} $$

In the curve savior we aren't adding any collateral, therefore $$C{lp}=0$$. For$$D{lp}$$ we have to calculate the amount of RAI withdrawn from the pool. We will assume that the USD value of the pool stays 50/50 and that RAI trades close to it redemption price. Therefore for each RAI-3Pool LP token $$K{RAI3Pool}$$ we are getting $$D = \frac{K{RAI3Pool}}{2 P_{rp}}$$RAI which give us the following formula:

$$ \frac{2CP{rp}}{2P{rp}D - K{RAI3Pool}} = \frac{A{cc}R{tar}P{rp}}{P_{liq}} $$

Which then gives us (after also replacing the liquidation price):

$$ K = 2P{rp}D- \frac{2CP{liq}}{A{acc}R{tar}} = 2P{rp}D-\frac{2DP{rp}R{liq}}{R{tar}} = 2P{rp}D( 1 - \frac{R{liq}}{R_{tar}}) $$

To this we have to add the $2000 liquidator fee.

To help with the whole calculation, you can use the following spreadsheet:

{% embed url="https://docs.google.com/spreadsheets/d/1GeY8B6RW01GeQiM1FIFBIlgA5bV6Qdzv1XsvYKwVU4Y/edit#gid=0" %}