Liquidates a user's position based on the specified lending token amount and update related token's prices.
The function to be called when a user wants to liquidate their position. Support liquidation with hot borrowing or not.
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:
Update price of related tokens.
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
_prjInfo
struct Asset.Info
Information about the project token, including its address and type.
_lendingInfo
struct Asset.Info
Information about the lending token, including its address and type.
_lendingTokenAmount
uint256
The amount of lending tokens to be used for liquidation
priceIds
bytes32[]
An array of bytes32 price identifiers to update.
updateData
bytes[]
An array of bytes update data for the corresponding price identifiers.
buyCalldata
bytes[]
The calldata for buying the lending token from the exchange aggregator. If the calldata is empty, the liquidation will execute liquidation without hot borrowing.
liquidateFromModerator (0xc8359268)
Liquidates a portion of the borrower's debt using the lending token, called by a related contract and update related token's prices.
The function to be called when a user wants to liquidate their position. Support liquidation with hot borrowing or not.
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:
Update price of related tokens.
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
_prjInfo
struct Asset.Info
Information about the project token, including its address and type.
_lendingInfo
struct Asset.Info
Information about the lending token, including its address and type.
_lendingTokenAmount
uint256
The amount of lending tokens to be used for liquidation
liquidator
address
The address of the liquidator
priceIds
bytes32[]
An array of bytes32 price identifiers to update.
updateData
bytes[]
An array of bytes update data for the corresponding price identifiers.
buyCalldata
bytes[]
The calldata for buying the lending token from the exchange aggregator. If the calldata is empty, the liquidation will execute liquidation without hot borrowing.