In order to ensure that each Hue token is backed by at least 1 Hue worth of Eth, liquidators are empowered to correct any positions that endanger the system.

Liquidation simply means that when a position doesn't have enough collateral, a liquidator can pay off the debt (Hue) to ensure that it doesn't endanger the system, and receives a greater value of collateral (Eth) in return. The protocol benefits because there is less risk to the system. The liquidator benefits as they have gained value. The position owner takes the loss that the liquidator gains for endangering the protocol. This also serves as an incentive for position owners to never endanger the protocol, and to maintain sufficient collateralization.

TCP implements novel liquidation logic in order to ensure that positions can be instantly liquidated as soon as they pose any danger to the system. It works by separating discovering and correcting an undercollateralized position and settling it into two steps, so that there is never a case where an undercollateralized position goes uncorrected because the liquidator doesn't have enough capital to correct the position.

Liquidation Phase 1: Discovery

The Keeper does the following:

  1. Any keeper can use fully on-chain keeper data and simple logic to discover that positions are undercollateralized.
  2. They call the liquidation discovery function with a list of positionIDs they believe are undercollateralized. That's it! TCP does the rest.

TCP does the rest:

  1. TCP gets an updated price of Eth to Hue (Collateral to Debt) from the Uniswap V3 TWAP
  2. TCP confirms which positions are in fact undercollateralized using the position and price data
  3. TCP removes the debt and an equal value of collateral with an additional penalty to the liquidation pool. It also pays a penalty in Eth collateral from the position to the liquidator.

Liquidation Phase 2: Settlement

Anyone can pay off debt from the liquidation pool and get an equal portion of collateral back. If the liquidation pool has 100 Hue and 2 Eth, someone could send 50 Hue to the pool and recieve 1 Eth back. They could also flash loan Hue from another system like Uniswap, pay off all of the debt in the pool, and receive all of the collateral back to pay off the loan, and keep the proceeds for themselves.

This model has a couple of advantages. The first is that it removes the requirement that the one discovering liquidations must also write logic to source liquidity, instantly discovering and pooling undercollateralized debt. The second is that all debt is pooled, and can be dealt in a single transaction by a keeper that specializes in sourcing liquidity.