Liquidation
The liquidation module for the IonPool
. Liquidations at Ion operate a little differently than traditional liquidation schemes. Usually, liquidations are a function of the market price of an asset. However, the liquidation module is function of the reserve oracle price which reflects a rate based on beacon-chain balances. There are 3 different types of liquidations that can take place:
Partial Liquidation: The liquidator pays off a portion of the debt and receives a portion of the collateral.
Dust Liquidation: The liquidator pays off all of the debt and receives some or all of the collateral.
Protocol Liquidation: The liquidator transfers the position's debt and collateral onto the protocol's balance sheet. NOTE: Protocol liqudations are unlikely to ever be executed since there is no profit incentive for a liquidator to do so. They exist solely as a fallback if a liquidator were to ever execute a liquidation onto a vault that had fallen into bad debt.
State Variables
TARGET_HEALTH
BASE_DISCOUNT
MAX_DISCOUNT_0
MAX_DISCOUNT_1
MAX_DISCOUNT_2
LIQUIDATION_THRESHOLD_0
LIQUIDATION_THRESHOLD_1
LIQUIDATION_THRESHOLD_2
RESERVE_ORACLE_0
RESERVE_ORACLE_1
RESERVE_ORACLE_2
PROTOCOL
POOL
UNDERLYING
Functions
constructor
Creates a new Liquidation
instance.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the |
|
| The address that will represent the protocol balance sheet (for protocol liquidation purposes). |
|
| List of reserve oracle addresses for each ilk. |
|
| List of liquidation thresholds for each ilk. |
|
| The target health ratio for positions. |
|
| Base discount for collateral. |
|
| List of max discounts for each ilk. |
_getConfigs
Returns the exchange rate, liquidation threshold, and max discount for the given ilk.
Parameters
Name | Type | Description |
---|---|---|
|
| The index of the ilk. |
getRepayAmt
If liquidation is possible, returns the amount of WETH necessary to liquidate a vault.
Parameters
Name | Type | Description |
---|---|---|
|
| The index of the ilk. |
|
| The address of the vault. |
Returns
Name | Type | Description |
---|---|---|
|
| The amount of WETH necessary to liquidate the vault. |
_getRepayAmt
Internal helper function for calculating the repay amount.
Parameters
Name | Type | Description |
---|---|---|
|
| The total debt. [RAD] |
|
| Calculated with collateral * exchangeRate * liquidationThreshold. [RAD] |
|
| Ratio at which liquidation can occur. [RAY] |
|
| The discount from the exchange rate at which the collateral is sold. [RAY] |
Returns
Name | Type | Description |
---|---|---|
|
| The amount of WETH necessary to liquidate the vault. [RAD] |
liquidate
Closes an unhealthy position on IonPool
.
Parameters
Name | Type | Description |
---|---|---|
|
| The index of the collateral. |
|
| The position to be liquidated. |
|
| Receiver of the collateral. |
Returns
Name | Type | Description |
---|---|---|
|
| The amount of WETH paid to close the position. |
|
| The amount of collateral received from the liquidation. |