Skip to main content

Liquidation

Overview

Liquidation in the Chromatic Protocol is triggered by keepers at each oracle version's price update. It occurs when the unrealized Profit and Loss (PnL) of a position is calculated, and either the taker margin cannot cover the position's loss or the maker margin cannot cover the position's profit.

Liquidation Process

The liquidation process involves the following steps:

  1. Unrealized PnL Calculation: At each oracle version update, the unrealized PnL of positions is calculated. This calculation compares the entry price of the position with the current price feed.

  2. Check for Margin Coverage: If the taker margin is insufficient to cover the position's loss or the maker margin is insufficient to cover the position's profit, liquidation is triggered.

  3. Exit Price Determination: The exit price for the liquidation is set as the oracle price at the current version.

  4. Claim Position: The liquidation process follows the same steps as the claimPosition function, where the user can claim the tokens associated with the closed position.

  5. Keeper Fee: In case the position results in a profit, the keeper fee is paid from the maker margin. Conversely, if the position incurs a loss, the keeper fee is paid from the taker margin.