# 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.**

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.

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:

Last modified 8mo ago