# How it Works

## How the CDP Market (feUSD) works

feUSD is a CDP stablecoin protocol. As stated in this [page](https://usefelix.gitbook.io/docs/lending-products/quickstart), it functions as a money market between feUSD minters / borrowers and stability pool depositors.

With the CDP Market (feUSD), users can permissionlessly use various tokens as collateral to mint **feUSD**, a stablecoin pegged to the U.S. dollar. feUSD can then be used to swap into other assets - this effectively is a form of leverage.

Felix is an **over-collateralized system.** Over-collateralization provides a safety buffer to protect the system against market volatility and to ensure that feUSD maintains solvency. feUSD has no centralized custodian and relies on liquidators and redeemers to ensure that circulating feUSD is wholly backed.

## Key Risks per User Type

| User                          | Primary Risks                                                                                                                                          |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Minters / Borrowers**       | **Liquidation risk** if collateral value falls above LTV. **Redemption risk** if feUSD trades below $1 and arbitrageurs redeem against their position. |
| **Stability-Pool Depositors** | **Liquidation volatility** – their feUSD is burned during liquidations and they receive volatile collateral instead.                                   |
| **feUSD DEX LPs**             | **Impermanent loss** from feUSD <> Other asset price moves                                                                                             |

## Key Components to the Felix Protocol

There are two key challenges involved in maintaining the Felix CDP stablecoin system:

1. **Maintaining the $1 feUSD Peg**
   * Ensuring that feUSD consistently trades at or very close to $1.00 is crucial
   * Price deviations can undermine both borrowing and saving activity
2. **Efficient Processing of Liquidations**
   * Swift and fair liquidation processes protect the protocol from accumulating bad debt
   * Efficient liquidations ensure that the protocol maintains its solvency

### Peg Maintenance: feUSD Redemption Mechanics

Redemptions allow feUSD holders to exchange their feUSD directly for $1-worth of collateral at face value from the protocol. Redemptions are processed against open positions in order of those paying the lowest rate of interest first. Positions that are redeemed against are not charged a penalty like they would be in the event of an liquidation, but do effectively lose directional exposure to their deposited collateral.

#### **How Redemptions Help Maintain the Peg:**

This mechanism creates an arbitrage opportunity whereby any feUSD acquired below-peg on secondary markets can be used to purchase liquid collateral assets for a profit. Moreover, redemptions reduce the circulating supply of feUSD, helping to push its market price back towards peg.

#### **Redemption Process**

1. **Initiation:** A user sends a specified amount of feUSD to the protocol for redemption.
2. **Debt Reduction:** Protocol reduces the debt of all positions needed to meet the redeemed amount
3. **Collateral Transfer:** $1 of collateral per feUSD redeemed minus a fee is transferred to the user
4. **Equilibrium Rate:** Protocol now has a higher average rate of interest across open positions

### Efficient Liquidations: Stability Pool Vaults

Felix allows users to deposit into dedicated pools ("vaults") corresponding to each supported collateral asset. These deposits are used to absorb the debt of positions denominated in the collateral asset when they fall below their liquidation threshold. Users are paid per block for providing this capital with the lion's share of the interest generated by the debt backed by the target collateral asset, and are entitled to liquidation profits as their capital is tapped.

**How the Stability Pool Vault Works**

* **Debt Absorption:** When a borrower position is liquidated, its outstanding debt is netted out against feUSD in the Stability Pool via burning.
* **Collateral Distribution:** The collateral from the liquidated borrower position is distributed proportionally across Stability Pool depositors.

## Understanding Redemptions

The walk‑through below shows how a real redemption impacts borrowers / minters:

#### Scenario: feUSD trades at $0.993

1. **Market dislocation** – selling pressure nudges feUSD to **$0.993** (‑0.7 %).
2. **Arbitrage set‑up** – Alice buys **500,000 feUSD** on a DEX for **$496,500** worth of HYPE (a $3,500 discount).
3. **Redemption TX** – she calls `redeem()` with the 500,000 feUSD.

#### How the queue is processed

| CDP (before) | Debt (feUSD) | Collateral Value | Borrower‑set Rate |
| ------------ | ------------ | ---------------- | ----------------- |
| Bob          | 300,000      | $450,000         | **1.0 %**         |
| Carol        | 400,000      | $600,000         | **2.0 %**         |
| Dave         | 600,000      | $900,000         | **3.0 %**         |

Debt is cancelled from the **lowest‑rate positions first**:

| CDP (after) | Debt Repaid by Redemption | Remaining Debt | Collateral Seized |
| ----------- | ------------------------- | -------------- | ----------------- |
| Bob         | 300,000 (100 %)           | 0              | $300000 HYPE      |
| Carol       | 200,000 (50 %)            | 200,000        | $200000 HYPE      |
| Dave        | 0                         | 600,000        | –                 |

#### Impact on interest‑rate distribution

| Metric             | Before       | After            |
| ------------------ | ------------ | ---------------- |
| Total System Debt  | 1.30 M feUSD | **0.80 M feUSD** |
| Weighted Avg. Rate | 2.46 %       | **2.75 %**       |

#### Take‑aways for each actor

* **Arbitrageur** – locks in arbitrage profit (spread − fee) minus gas.
* **Borrowers** – Bob exits; Carol’s debt/collateral shrink; Dave unchanged.

This concrete flow shows how redemptions nudge the peg even during small deviations and organically re‑price the debt book toward equilibrium.

***

## Understanding Liquidations

Liquidation occurs when borrow position health falls below a certain threshold, which varies with each supported collateral asset. This can happen when either the value of the position collateral decreases.

### **Liquidation Health and Collateralization Ratio**

The Collateralization Ratio (CR) measures the health of your loan:

$$
\text{Collateralization Ratio (CR)} = \left( \frac{\text{Value of Collateral}}{\text{Value of Debt}} \right) \times 100%
$$

If you deposit $1,500 worth of HYPE and borrow 1,000 feUSD, your CR is:

$$
\text{CR} = \left( \frac{1,500}{1,000} \right) \times 100% = 150%
$$

### **Avoiding Liquidation**

* **Monitor Your CR:** Keep an eye on market prices to ensure your CR remains healthy.
* **Add More Collateral:** If your CR is dropping, you can deposit more collateral to improve it.
* **Repay feUSD Debt:** Reducing your debt increases your CR.

### **Liquidation Sequence**

* **Collateral Seizure:** If your CR falls below the liquidation threshold, your collateral is seized to repay your debt plus a bonus for the liquidator.
* **Retention of feUSD:** You still retain the feUSD you borrowed.
* **Position Closure:** Your debt position is effectively closed through liquidation.

### **Example Scenario**

* **Liquidation Event:** A borrower's position falls below the liquidation threshold
* **Debt Cancellation:** The borrower's debt is canceled using feUSD from the Stability Pool
* **Collateral Allocation:** The seized collateral is distributed to Stability Pool depositors pro rata
* **Depositor Gains:** Depositors receive collateral assets plus a liquidation bonus
