PredMart > Documentation > Liquidation

Liquidation

Liquidation protects lenders when a borrower's position becomes unhealthy. When a position's health factor falls below 1.0, the protocol fully liquidates — seizing 100% of the collateral, selling it on Polymarket's CLOB, repaying the debt, paying a liquidator fee (see Protocol Constants), and retaining any residual USDC in the lending pool. This is a full-liquidation model similar to perpetual futures on centralized exchanges: a liquidated position does not return residual USDC to the borrower.


When Does Liquidation Trigger?

Health Factor Below 1.0

A position is eligible for liquidation when its health factor drops below 1.0:

Health Factor = (Collateral Amount × Price × Liquidation Threshold) / Debt

When Health Factor < 1.0, it means:

Debt > Collateral Amount × Price × Liquidation Threshold

In other words, the borrower's debt has exceeded what the protocol considers a safe level relative to their collateral's current value.

What Causes the Health Factor to Drop?

Three factors can push a health factor below 1.0:

  1. Price decline (most common): When the Polymarket share price drops, the value of your collateral falls, pulling your health factor down toward the liquidation threshold (85%). A large enough drop brings the position to the point of liquidation.

  2. Interest accrual (gradual): Over time, the borrower's debt increases due to interest. If the borrower doesn't repay or add collateral, the health factor slowly decreases even with a stable price.

  3. Market resolution (instant): When a Polymarket market resolves against the borrower's position (the outcome doesn't happen), the shares become worthless ($0.00). This is an instantaneous health factor drop to zero. However, this is handled separately through the market resolution system rather than standard liquidation.


The Liquidation Process

PredMart's liquidation process differs from many DeFi protocols in that it is not open to arbitrary third-party liquidators. Instead, liquidation is executed exclusively by PredMart's relayer — the same backend service that processes borrows and withdrawals. This ensures liquidations are performed efficiently and with accurate, oracle-signed prices.

Detection: Real-Time Monitoring

PredMart's backend continuously monitors all active positions for health factor changes. When a collateral token's price drops, the system recalculates health factors and triggers liquidation for any position with health factor < 1.0. Multiple redundant monitoring paths ensure liquidations execute even if one system experiences an outage.

Execution: On-Chain Liquidation

Once the backend identifies a liquidatable position, it:

  1. Fetches fresh oracle price — the average price to sell $1,000 of shares into the order book (manipulation-resistant)
  2. Signs price data with the oracle key
  3. Submits liquidate(borrower, tokenId, repayAmount, priceData) to Polygon via the relayer

Smart Contract Checks

The liquidate() function on the smart contract performs the following verifications:

Liquidation During Pause

Liquidations are explicitly allowed even when the protocol is paused. This ensures that unhealthy positions can always be closed to protect lenders, regardless of protocol state.


Full Collateral Seizure Model

When health factor < 1.0, the liquidator seizes 100% of the borrower's collateral in a single transaction:

  1. All collateral is seized and sold on Polymarket's CLOB
  2. Debt is repaid (principal + accrued interest)
  3. Liquidator fee is paid (see Protocol Constants)
  4. Residual retained by the pool — flows into totalAssets, raising the pUSDC exchange rate for lenders. The borrower receives $0.

This ensures clean, atomic liquidations with no partial positions left in limbo.


Liquidator Fee

The liquidator receives a fee calculated on the debt amount as compensation for executing the liquidation. This fee covers gas costs and operational overhead. For the current liquidator fee percentage, see Protocol Constants.

Example: - Borrower's position: 10,000 shares at $0.50, debt = $3,200 - Health factor < 1.0 - All 10,000 shares are seized and sold for $5,000 - Debt repaid + liquidator fee deducted from proceeds - Residual retained by pool - Borrower receives: $0

Had the borrower exited proactively (manual flash close, take-profit/stop-loss, or partial repay) before the health factor crossed 1.0, they would have received the surplus.


Underwater Positions: When Collateral < Debt

A position is underwater when the total value of the collateral is less than the outstanding debt:

Underwater: Collateral Amount × Price < Debt

This scenario can occur when: - A rapid, large price drop outpaces the liquidation engine - The price drops through an illiquid range where efficient liquidation is difficult - Multiple positions need liquidation simultaneously, creating a queue

Underwater Liquidation Mechanics

When a position is underwater, the liquidation follows the same seize-first model:

  1. All collateral is seized: The liquidator takes all of the borrower's collateral for that position.

  2. Collateral is sold on market: The seized shares are sold on Polymarket's CLOB at the current market price.

  3. Debt repayment from proceeds: Whatever USDC is obtained from the sale is used to repay the debt.

  4. Bad debt absorption: The shortfall (debt minus sale proceeds) becomes bad debt that is absorbed by the lending pool: Bad Debt = Debt - Sale Proceeds

Bad Debt Socialization

When bad debt occurs, it is socialized across all lenders in the pool. In practical terms: - The pool's totalBorrowAssets is reduced by the full debt amount - But only the sale proceeds are actually added to the pool's USDC balance - The difference (bad debt) effectively reduces totalAssets - This means the pUSDC exchange rate decreases slightly - All lenders share the loss proportionally to their pool ownership

Example: 5,000 shares at $0.30, debt = $2,000. Shares sell for $1,500. Bad debt = $500, absorbed by the pool.


What Happens to Seized Collateral

After a liquidation, the seized Polymarket shares are sent to PredMart's admin wallet. The protocol then automatically sells these shares on Polymarket's CLOB to convert them back to USDC.

Auto-Sell System

PredMart automatically sells seized collateral on Polymarket's CLOB using Fill-or-Kill (FOK) orders with no slippage cap — the order signs at the worst valid price, but FOK semantics mean it actually fills at the best available bid in a single atomic shot. This prioritizes execution certainty over price precision: in thin markets, the fill can be meaningfully below the displayed midpoint, and that loss is absorbed by the pool (raising bad-debt risk for lenders).

Other auto-sell behaviors:

Liquidation Cooldown

To prevent redundant transactions for the same position, PredMart enforces a cooldown between liquidation attempts for each borrower-token pair. This prevents wasting gas on duplicate liquidation transactions during rapid price movements.


Liquidation Speed

The system monitors prices continuously and executes liquidations within seconds of detecting an unhealthy position. Redundant monitoring paths keep liquidations prompt even during outages.


How to Avoid Liquidation


Liquidation Event Data

On-Chain Events

Every liquidation emits events on the blockchain:

event Liquidated(
    address indexed liquidator,
    address indexed borrower,
    uint256 indexed tokenId,
    uint256 collateralSeized,
    uint256 debtRepaid
);

// If bad debt occurs:
event BadDebtAbsorbed(
    address indexed borrower,
    uint256 indexed tokenId,
    uint256 amount
);

API Access

You can query liquidation history through the API:

GET https://api.predmart.com/lending/liquidations/{wallet_address}

This returns all liquidation events for a specific wallet, including timestamps, amounts, and transaction details.


Next Steps