Liquidating Positions
The protocol supports liquidation of two types of positions - risky positions and bad debt positions.
Risky Positions
Risky positions include positions that have fallen below the protocol risk
threshold but hold enough assets to be liquidated profitably by an external
liquidator. Anyone can call the PositionManager.liquidate()
function to
liquidate a risky position for a small profit.
The process of liquidating a risky position involves paying off the debt for the risky position and receiving it's assets at a discount.
PositionManager.liquidate()
function liquidate(
address position,
DebtData[] calldata debtData,
AssetData[] calldata assetData
) external nonReentrant;
Parameters
Name | Type | Description |
---|---|---|
position | address | Position address |
debtData | DebtData[] | DebtData object for debts to be repaid |
assetData | AssetData[] | AssetData object for assets to be seized |
The liquidate
function accepts two structs to indicate the debt repaid and
assets seized:
// Data struct for collateral assets to be received by the liquidator
struct AssetData {
address asset;
uint256 amt;
}
// Data struct for position debt to be repaid by the liquidator
struct DebtData {
uint256 poolId;
uint256 amt;
}
Bad Debt Positions
Bad debt positions positions include positions that owe more debt to the protocol than the total value of assets in the position. The purpose of liquidating a bad debt position is to ensure the Base Pool is not rendered unusable due to accumulation of bad debt. Accordingly, these positions can only be liquidated by the protocol governance.
The process of liquidating a bad debt position involves socializing the bad debt across all lenders of the Base Pool proportional to their share of deposits. The protocol clears the debt owed by the bad debt position and the loss is realized equitably among all lenders.