Liquidation Specs

Liquidations

When a JuiceAccount is created, it deploys a Liquidator contract. This Liquidator contract registers tasks with the Gelato Automate contract to monitoring the Account's health via the JuiceAccountManager and initiate its target Account's liquidations and debt repayment when the Account is reported as liquidatable.

The Manager uses a cross-margin approach to determine the account's liquidatable status.

It sums up the collateral, investment, and credit value into one value, which it calls equity. This equity value is required to be greater than than loan value by some threshold. Otherwise, the account is liquidatable.

When the Liquidator triggers an Account liquidation, all Account functionality is disabled outside of debt repayments. Once an Account liquidation has started, it is put into a Liquidating state. On liquidation:

  • The Account's collateral is available to be purchased at a discount. This is in the form of a liquidation bonus.

    • Given some debt amount, with a 10% collateral bonus and 1 USDB worth of WETH and 2 USDB of debt, liquidator can pay between 0.909 USDB and 2 USDB to purchase the user's WETH, with 0.909 being the optimal debt to pay off.

  • Strategy withdrawals are initiated one by one in a circular buffer in case of unexpected revertions or multi-step actions.

All liquidated funds (from collateral auction or Strategy withdrawal) are sent to the Liquidator contract, which takes a % protocol fee from them as a liquidation fee, before using the rest to pay off the Account's debt.

Once the Account's debt has been paid off, it is marked as Healthy and the Account owner can claim any remaining USDB that wasn't used for repayment. If the liquidation was too late and results in bad debt (debt that cannot be repaid with the Account's equity), the Account will no longer be detected as liquidatable, but it will be left in the Liquidating state until the Account owner returns and pays off their debt.

Last updated