# RAI Liquidations: What They Mean for Safe Owners

**URL:** <https://community.reflexer.finance/t/rai-liquidations-what-they-mean-for-safe-owners/286>\
**Category:** General Discussion\
**Created:** [May 23, 2022, 12:39pm UTC](https://community.reflexer.finance/t/rai-liquidations-what-they-mean-for-safe-owners/286 "2022-05-23T12:39:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![btbt](https://avatars.discourse-cdn.com/v4/letter/b/ac91a4/32.png) [@btbt](https://community.reflexer.finance/u/btbt)\
**Post date:** [May 23, 2022, 12:39pm UTC](https://community.reflexer.finance/t/rai-liquidations-what-they-mean-for-safe-owners/286/1 "2022-05-23T12:39:25Z")

</div>

## Liquidation Overview

Liquidations are required in the RAI system to a ensure sufficient collateralization of the system. If a safe’s collateral(ether) to debt(RAI) ratio goes under a certain threshold, the safe will be liquidated.

During a liquidation, the safe’s collateral and debt are seized and the collateral is sold to raise the required debt. The liquidation will raise extra debt on top of the safe’s existing debt as a penalty to the safe owner for liquidation. The debt is raised by selling the safe’s collateral at a discount price in exchange for RAI. If there are no immediate bidders, the system will increase the discount to make the sale more attractive to buyers.

The liquidation process incurs a loss for the safe owner due to

1. the extra debt that is raised
2. the collateral being sold at a discount

Depending on the safe’s collateral/debt ratio at liquidation, the safe may or may not receive a small amount of leftover collateral after liquidation. The safe owner keeps the orignal debt generated by the safe.

## Liquidation Parameters

These are parameter relevant to liquidation for the mainnet RAI system.

| Parameter | Description | Value |
| --- | --- | --- |
| `liquidationRatio` | Smallest amount of collateral/debt ratio allowed by the system before a safe is liquidated. RAI debt is valued at the redemption price(USD) and collateral is the value of ether locked(USD) | 1.35 |
| `liquidationPenalty` | The amount of extra RAI that is raised when a safe is liquidated | 10% |
| `collateralDiscount` | The discount offered to liquidators as an incentive to liquidate the safe | 8-10% |
| `liquidationQuantity` | The maximum amount of RAI per auction. | 90,000 RAI |
| `minDiscount` | The minimum discount collateral is sold for | 8% |
| `maxDiscount` | The maximum discount collateral is sold for | 10% |
| `maxDiscountUpdateRateTimeline` | The time it takes for the discount to go from `minDiscount` to `maxDiscount` | 2700 secs |

## Detailed Steps of a Liquidation

### 1) The conditions of liquidation are met for a safe.

When the following condition is met, a safe can be liquidated:

 ![](https://canada1.discourse-cdn.com/flex030/uploads/reflexer/original/1X/b41c50f0c70821303b3134ab5c6d22f5e46aac91.png)

Where `debt value` and `collateral value` are denominated in USD.

The above inequality can be caused by:

**a) a _decrease_ in collateral value**

A decrease in the ETH/USD price is the most common catalyst for safe liquidation. The ETH/USD price enters the system w/ **a one-hour delay** through the [OSM](https://docs.reflexer.finance/system-contracts/oracle-module/fsm/oracle-security-module).

**b) an _increase_ in debt value**

An increase in debt value can occur due to interest charged to the safe(the borrow fee) and/or an _increasing_ redemption price. Since both of the these factors typically alter the debt value very slowly, increasing debt value inside the system will rarely cause liquidations.

### 2) The safe is liquidated and an auction is started

A collateral auction keeper bot calls `liquidateSAFE()` on the [LiquidationEngine](https://docs.reflexer.finance/system-contracts/core/liquidation-engine) for the underwater safe.

If a safe has more debt than `liquidationQuantity/liquidationPenalty`, then `liquidateSAFE()` can be called multiple times for a single safe, starting multiple auctions. Each auction will have an amount of collateral for sale proportionate to the amount of RAI to raise.

[Liquidation Engine](https://docs.reflexer.finance/system-contracts/core/liquidation-engine) then calls `confiscateSAFECollateralAndDebt()` on the [SAFE Engine](https://docs.reflexer.finance/system-contracts/core/safe-engine).  
This transfers the safe’s collateral to the [Liquidation Engine](https://docs.reflexer.finance/system-contracts/core/liquidation-engine) in preparation for auction and transfers the debt of the safe to the [Accounting Engine](https://docs.reflexer.finance/system-contracts/core/accounting-engine).

Finally, [Liquidation Engine](https://docs.reflexer.finance/system-contracts/core/liquidation-engine) calls `startAuction()` on the [Increasing Discount Collateral Auction House](https://docs.reflexer.finance/system-contracts/auction-module/increasing-discount-collateral-auction-house). The starting discount price for collateral sold in the auction is 8%.

### 3) Collateral is sold

A collateral auction keeper bot calls `buyCollateral()` on the [Increasing Discount Collateral Auction House](https://docs.reflexer.finance/system-contracts/auction-module/increasing-discount-collateral-auction-house). The keeper pays RAI in exchange for discounted ether.

_ **The collateral discount is calculated using the Chainlink spot ETH/USD price, not the OSM price that initiated the safe liquidation. This is to ensure the latest price is used in order to improve profitability of the auction and stability of the system** _

The discount price of the collateral increases from 8% to 10% over a period `2700` seconds.

After `2700` seconds, the discount remains at 10%.

**Collateral can be bought from an auction until** :

1. The target amount of RAI has been raised  
_or_
2. All collateral has been sold.

Finall, any leftover collateral is transferred back to the liquidated safe, where it can be claimed in the Reflexer UI.

## Liquidation Examples

- [Example #1, Minimum Discount](#Liquidation-Example-#1:-Minimum-Discount)
- [Example #2, Increasing Discount](#Liquidation-Example-#2:-Increasing-Discount)
- [Example #3, No leftover collateral](#Liquidation-Example-#3:-No-Leftover-Collateral)

### Liquidation Example #1: Minimum Discount

**Starting Parameters** :

safe locked collateral = 10.0 ether  
safe generated debt = 6000 RAI  
Redemption Price = 3.0  
ETH/USD = $2600  
safe C-ratio = 10.0 \* $2600/6000 \* 3.0 = 144%

**Sequence of events** :

1. The system is updated with a new, 1-hour delayed ETH/USD price of **$2400**

2. The safe is liquidated and an auction is started at Chainlink spot ETH/USD price of **$2390**

3. A collateral keeper buys collateral at a discount

### Liquidation Example #2: Increasing Discount

**Starting Parameters** :

safe locked collateral = 10.0 ether  
safe generated debt = 6000 RAI  
Redemption Price = 3.0  
ETH/USD = $2600  
safe C-ratio = 10.0 \* $2600/6000 \* 3.0 = 144%

**Sequence of events** :

1. The system is updated with a new, 1-hour delayed ETH/USD price of **$2400**

2. The safe is liquidated and an auction is started at Chainlink spot ETH/USD price of **$2390**

3. A collateral keeper buys collateral at a discount

### Liquidation Example #3: No Leftover Collateral

**Starting Parameters** :

safe locked collateral = 10.0 ether  
safe generated debt = 6000 RAI  
Redemption Price = 3.0  
ETH/USD = $2600  
safe C-ratio = 10.0 \* $2600/6000 \* 3.0 = 144%

**Sequence of events** :

1. The system is updated with a new, 1-hour delayed ETH/USD price of **$2100**

2. The safe is liquidated and an auction is started at Chainlink spot ETH/USD price of **$2100**

3. A collateral keeper buys collateral at a discount

### Visualizing Leftover Ether

Using the same starting safe parameters as above:

safe locked collateral = 10.0 ether  
safe generated debt = 6000 RAI  
Redemption Price = 3.0

Here are charts of how much ether will be leftover after liquidation for both 8% and 10% discounts.

 ![](https://canada1.discourse-cdn.com/flex030/uploads/reflexer/original/1X/8f63a6b0c42cc79f9e43133effd502986741ba8a.png)

 ![](https://canada1.discourse-cdn.com/flex030/uploads/reflexer/original/1X/59e6fc9e285760d692b0c17958621385db773aa2.png)
