# 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](https://etherscan.io/address/0x618788357D0EBd8A37e763ADab3bc575D54c2C7d).

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](https://docs.reflexer.finance/liquidation-protection/uni-v2-rai-eth-savior-math#minimum-savior-balance-formula).&#x20;

$$
\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}}
$$

&#x20;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.&#x20;

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

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.reflexer.finance/liquidation-protection/curve-v1-savior-details.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
