---
description: Liquidations in Hedgehog Protocol
---

# Liquidations

This mechanism is a pivotal part of risk management within the protocol, ensuring stability and security for all participants by addressing debt positions that become under-collateralized.

**Step 1: Monitoring Collateral Health**

The protocol continuously monitors the health of all active CDPs to ensure that each position is adequately collateralized. This oversight is based on the current market value of wstETH and the value of the minted Basefee derivative tokens.

1. **Thresholds and Health Metrics**: The protocol establishes specific thresholds for collateral-to-debt ratios. If the market value of the staked wstETH drops below this critical level relative to the debt (Basefee tokens minted), the CDP is marked as under-collateralized.
2. **Warnings and User Notifications**: Usually, the protocol provides warnings as a CDP approaches unsafe levels. Users should monitor their positions closely, especially in volatile market conditions, to avoid liquidation.

**Step 2: Liquidation Initiation**

If a CDP falls below the required collateral-to-debt ratio, it triggers the liquidation process. This action is automatic and designed to mitigate the risk for the protocol and its participants.

1. **Automatic Trigger**: The protocol's system automatically identifies the at-risk CDP and initiates the liquidation process. This step involves selling off the collateral to cover the user's debt.
2. **Partial Liquidation Options**: In some protocols, if the CDP is only slightly below the threshold, a partial liquidation may occur, allowing the user to keep the position open but at a reduced risk level.

**Step 3: Collateral Auction**

The primary mechanism to cover the debts of under-collateralized positions is through a collateral auction. The protocol sells the staked wstETH to the highest bidders in exchange for Basefee tokens or the protocol's stablecoin, depending on the design.

1. **Auction Announcement**: The protocol announces the liquidation event and the start of the auction, allowing interested parties (often other protocol participants) to bid on the collateral.
2. **Bidding Process**: Bidders participate by offering an amount of Basefee tokens or stablecoin (as designed by the protocol) in exchange for a specified amount of wstETH. The auction continues until it finds the highest bidder within the auction period.

**Step 4: Debt Repayment and Slippage Handling**

The received Basefee tokens from the auction are used to cover the debts of the under-collateralized position. Any excess funds after covering the debt and liquidation penalty may be returned to the user.

1. **Debt Settlement**: The protocol uses the assets acquired in the auction to cover the user's debt, effectively closing the risky CDP.
2. **Handling Surplus**: If the auction brings in funds exceeding the debt and liquidation penalty, the surplus may be returned to the original CDP owner. If there's a deficit, the protocol might cover it using insurance funds or through other mechanisms established for risk management.

**Step 5: Finalization and User Notification**

After the auction concludes and the debts are settled, the protocol finalizes the liquidation process.

1. **Position Closure**: The under-collateralized CDP is closed, and the remaining assets, if any, are dispatched according to the protocol's rules.
2. **User Notification**: The user receives the notification of the liquidation event's conclusion, including a summary of the auction, the debt covered, and details of any funds returned to them.
