# Liquidation

### Leverage ratios

Every strategy vault enforces a maximum leverage ratio and every user has a leverage ratio that is a function of the value of their assets and the value of their debt. If the value of a user's assets falls and their leverage ratio breaches the max ratio, they can be liquidated.
The leverage ratio is calculated as the difference between the user's vaultShareValue (their total assets) and their debt, divided by the value of their debt.
$leverage { \ } ratio = \frac{vaultShareValue - debt}{debt}$
By this metric, the closer to 0 the leverage ratio is, the riskier the position. Upon liquidation, a user's leverage ratio will increase and their position will become less risky.

### Liquidation mechanics

In the event of liquidation, a liquidator can purchase a portion of the user's vaultShares at a discount to their value for cash that is used to pay down the user's debt. Economic liquidation details are determined by the following variables that are set on a per-vault basis:
• Maximum leverage ratio: This is the leverage ratio that will trigger a liquidation upon breach.
• Target leverage ratio: The target leverage ratio is lower (less risky) than the maximum leverage ratio, and is used within the liquidation function to determine how much of a user's vaultShares the liquidator is eligible to purchase.
• Liquidation bonus: The bonus that the liquidator receives during liquidation.
• Minimum debt size: The minimum amount of debt a user can hold. No liquidation can bring an account below the minimum debt size unless the liquidation fully zeroes out the user's debt.

#### Calculating the amount to liquidate

Liquidators can specify the number of vaultShares that they want to purchase from an account during liquidation but they can't liquidate an account past the target leverage ratio.
The target leverage ratio sets a cap on the amount of assets that the liquidator can purchase unless the liquidator is forced to close out the account's position completely because they would otherwise have a debt that is below the minimum debt size.

#### Example

Consider the following vault and account:
• Maximum leverage ratio: 0.2
• Target leverage ratio: 0.4
• Liquidation bonus: 5%
• Minimum debt size: 50,000 USDC
• Value per vaultShare: 1 USDC
• Account vaultShares: 590,000
• Account debt: 500,000 USDC
• Account leverage ratio: 0.18
This account is over-levered and eligible for liquidation. The max amount of vaultShares that the liquidator can purchase (math obscured for simplicity) is 330,000 for a price of 314,285 USDC. This liquidation will return the account to the target leverage ratio of 0.4 and it will leave the account with a debt of 185,715 USDC so the account will not be in violation of the minimum debt size.
Note that the account's debt at maturity is closed out one to one with the cash that the liquidator puts in today. This is effectively like the liquidated account is lending the liquidator's cash deposit at 0% from the time of liquidation until maturity. Because cash in Notional is held as cTokens, the account is giving up any money-market interest that it would earn on that deposit between the time of liquidation and maturity. Instead that interest accrues to Notional and can be thought of as a protocol liquidation fee.
To illustrate how the minimum debt size comes into play during liquidations, let's consider that the account instead held 59,000 vaultShares vs 50,000 USDC debt. In this case, returning the account to a leverage ratio of 0.4 would leave it with a debt of only 18,571 USDC. This amount is below the minimum debt threshold.
In this case, the liquidator would be required to zero out the account's debt completely. So the liquidator would be allowed to purchase 52,500 vault shares for 50,000 USDC, leaving the liquidated account with 6,500 vaultShares and no debt.