PrimaryLendingPlatformLiquidation
Overview
License: MIT
The PrimaryLendingPlatformLiquidation contract is the contract that allows users to liquidate positions.
Contract that allows users to liquidate positions. Inherit from PrimaryLendingPlatformLiquidationCore.
Functions info
liquidate (0xaab3f868)
Liquidates a user's position based on the specified lending token amount.
The function to be called when a user wants to liquidate their position.
Requirements:
The project token is listed on the platform.
The lending token is listed on the platform.
The lending token amount must be greater than 0.
The user must have a position for the given project token and lending token.
The health factor must be less than 1.
_lendingTokenAmount
must be within the permissible range of liquidation amount.
Effects:
Calculates the health factor of the position using
getCurrentHealthFactor
function.Validates the health factor and ensures it's less than 1.
Calculates the permissible liquidation range using
getLiquidationAmount
function.Validates
lendingTokenAmount
against the permissible range.Determines the amount of project token to send to the liquidator.
Distributes rewards to the liquidator.
Parameters:
Name | Type | Description |
---|---|---|
_account | address | The address of the borrower |
_projectToken | address | The address of the project token |
_lendingToken | address | The address of the lending token |
_lendingTokenAmount | uint256 | The amount of lending tokens to be used for liquidation |
liquidateFromModerator (0xfc879bcb)
Liquidates a user's position based on the specified lending token amount, called by a related contract.
Requirements:
The project token is listed on the platform.
The lending token is listed on the platform.
Called by a related contract.
The lending token amount must be greater than 0.
The user must have a position for the given project token and lending token.
The health factor must be less than 1.
_lendingTokenAmount
must be within the permissible range of liquidation amount.
Effects:
Calculates the health factor of the position using
getCurrentHealthFactor
function.Validates the health factor and ensures it's less than 1.
Calculates the permissible liquidation range using
getLiquidationAmount
function.Validates
lendingTokenAmount
against the permissible range.Determines the amount of project token to send to the liquidator.
Distributes rewards to the liquidator.
Parameters:
Name | Type | Description |
---|---|---|
_account | address | The address of the borrower |
_projectToken | address | The address of the project token |
_lendingToken | address | The address of the lending token |
_lendingTokenAmount | uint256 | The amount of lending tokens to be used for liquidation |
liquidator | address | The address of the liquidator |
Return values:
Name | Type | Description |
---|---|---|
[0] | uint256 | The amount of project tokens received by the liquidator |
Last updated