# Mechanics

## Overview

Libre's liquidation system is designed to be **predictable and fair**, giving borrowers time to respond to market volatility while protecting lender funds.

## Liquidation Thresholds

| Loan-to-Value (LTV)  | Status               | Borrower Action               | Timeline     |
| -------------------- | -------------------- | ----------------------------- | ------------ |
| **0-70%**            | **Safe Zone**        | Monitor your loan             | Ongoing      |
| **70-80%**           | **Warning Zone**     | Consider adding collateral    | Ongoing      |
| **80%+**             | **Liquidation Risk** | Must act to avoid liquidation | **72 hours** |
| **80%+ (after 72h)** | **Liquidation**      | Automatic execution           | Immediate    |

## How Liquidation Works

### Example Scenario

Let's walk through a liquidation example:

**Initial Loan Setup**

* Bitcoin price: $100,000
* Collateral: 0.2 BTC = $20,000
* Loan amount: $10,000 USDT
* Initial LTV: 50%

**Price Movement Triggers**

* **At $87,500 BTC**: LTV hits 70% (Warning Zone)
* **At $62,500 BTC**: LTV hits 80% (Liquidation Risk - 72-hour timer starts)
* **After 72 hours**: If still at 80%+ LTV, liquidation executes

### The 72-Hour Buffer

When LTV reaches 80%, borrowers have **exactly 72 hours** to:

1. **Add more Bitcoin collateral** to reduce LTV below 80%
2. **Make a partial repayment** to reduce the loan balance
3. **Repay the full loan** to close the position

### Automatic Liquidation

If no action is taken within 72 hours:

1. **Smart contract execution**: Liquidation triggers automatically
2. **Bitcoin sale**: Collateral sold on libreDEX at market rate
3. **Lender repayment**: USDT lenders are repaid first (principal + interest)
4. **Excess distribution**: Any remaining Bitcoin value goes back to borrower

## Liquidation Math

### Calculation Example

**Liquidation Scenario:**

* Collateral: 0.2 BTC at $62,500 = $12,500 value
* Outstanding debt: $10,000 + interest = $10,275
* Liquidation sale: 0.2 BTC sold at current market rate

**Proceeds Distribution:**

1. **Platform fee**: 1% of collateral value = $125
2. **Lender repayment**: $10,275 (principal + interest)
3. **Borrower receives**: $12,500 - $125 - $10,275 = $2,100

*Note: If Bitcoin price recovered above $62,500 during the 72-hour period, liquidation could be avoided by the improved LTV ratio.*

## Why 72 Hours?

### Protection Against Volatility

* **Market corrections**: Time for temporary price dips to recover
* **Weekend gaps**: Allows response even during market closures
* **Global accessibility**: Accommodates users in different time zones
* **Technical issues**: Buffer for wallet or connectivity problems

### Fair Warning System

* **No surprise liquidations**: Clear advance notice
* **Multiple response options**: Add collateral, repay, or close position
* **Transparent rules**: Everyone knows exactly when liquidation occurs

## Monitoring Your Position

### Real-Time Tracking

* **Dashboard alerts**: Visual warnings as LTV approaches thresholds
* **Email notifications**: Alerts sent to registered email addresses
* **Mobile app**: Push notifications for critical LTV levels
* **API access**: Programmatic monitoring for advanced users

### LTV Calculation

```
Current LTV = (Loan Balance / Collateral Value) × 100

Where:
- Loan Balance = Principal + Accrued Interest
- Collateral Value = Bitcoin Amount × Current BTC Price
```

## Avoiding Liquidation

### Best Practices

1. **Maintain buffer**: Keep LTV well below 70% when possible
2. **Monitor regularly**: Check your position during volatile markets
3. **Set alerts**: Use notifications to stay informed
4. **Have a plan**: Know how you'll respond if LTV rises

### Response Options

* **Add collateral**: Send more Bitcoin to your vault address
* **Partial repayment**: Reduce loan balance to improve LTV
* **Full repayment**: Close the position entirely
* **Refinance**: Move to a different pool with better terms

## Liquidation vs. Traditional Platforms

| Feature                  | Libre                   | Traditional Platforms |
| ------------------------ | ----------------------- | --------------------- |
| **Warning period**       | 72 hours                | Often immediate       |
| **Liquidation trigger**  | 80% LTV                 | Varies (often 75-85%) |
| **Process transparency** | Fully on-chain          | Often opaque          |
| **Borrower protection**  | Grace period + warnings | Limited               |
| **Excess recovery**      | Returned to borrower    | Varies by platform    |

## Technical Implementation

### Smart Contract Logic

* **Price oracles**: Real-time Bitcoin price feeds
* **Automated monitoring**: Continuous LTV calculation
* **Timer mechanisms**: Precise 72-hour countdown
* **Liquidation execution**: Atomic settlement process

### libreDEX Integration

* **Market sale**: Liquidated Bitcoin sold at current rates
* **Slippage protection**: Safeguards against price manipulation
* **Transparent pricing**: All trades visible on-chain
* **Immediate settlement**: Fast conversion to USDT

The liquidation system balances **borrower protection** with **lender security**, ensuring fair outcomes for all participants in the Libre ecosystem.
