PrimaryLendingPlatformLiquidationCore
Overview
License: MIT
Core contract for liquidating loans on the PrimaryLendingPlatform.
Abstract contract that allows users to liquidate loans.
Structs info
Ratio
MaxLAParams
Events info
Liquidate
Emitted when a liquidation occurs.
Parameters:
SetPrimaryLendingPlatform
Emitted when the primary lending platform address is set.
Parameters:
SetMinPartialLiquidationAmount
Emitted when the minimum amount for partial liquidation is set.
Parameters:
SetMaxLRF
Emitted when the maximum Liquidation Reserve Factor (LRF) is set.
Parameters:
SetLiquidatorRewardCalculationFactor
Emitted when the liquidator reward calculation factor is set.
Parameters:
SetTargetHealthFactor
Emitted when the target health factor is set.
Parameters:
Constants info
MODERATOR_ROLE (0x797669c9)
LIQUIDATOR_REWARD_FACTOR_DECIMAL (0x150f2191)
State variables info
minPartialLiquidationAmount (0x802937ac)
targetHealthFactor (0x254cf439)
liquidatorRewardCalcFactor (0xc9fd7f25)
maxLRF (0x83958352)
primaryLendingPlatform (0x92641a7c)
Modifiers info
onlyAdmin
Modifier that only allows access to accounts with the DEFAULT_ADMIN_ROLE.
onlyModerator
Modifier that only allows access to accounts with the MODERATOR_ROLE.
isProjectTokenListed
Modifier that only allows access to project tokens that are listed on the PrimaryLendingPlatform.
Parameters:
isLendingTokenListed
Modifier that only allows access to lending tokens that are listed on the PrimaryLendingPlatform.
Parameters:
onlyRelatedContracts
Modifier that only allows access to related contracts of the PrimaryLendingPlatform.
Functions info
initialize (0xc4d66de8)
Initializes the contract with the provided PIT address.
Sets up initial roles, initializes AccessControl, and sets the provided PIT address.
Parameters:
setMinPartialLiquidationAmount (0x35f67981)
Sets the minimum partial liquidation amount. Can only be called by accounts with the MODERATOR_ROLE.
Parameters:
setMaxLRF (0x1ed95f01)
Sets the maximum Liquidation Reserve Factor (LRF) that can be used for liquidation.
Requirements:
The denominator must not be zero.
Only the moderator can call this function.
Parameters:
setLiquidatorRewardCalculationFactor (0x3495b179)
Sets the liquidator reward calculation factor.
Requirements:
The caller must have the
MODERATOR_ROLE
role.The denominatorLRF cannot be zero.
Parameters:
setPrimaryLendingPlatformAddress (0xcec5a0b0)
Sets the address of the primary lending platform contract.
Requirements:
Only the moderator can call this function.
The new primary lending platform address must not be the zero address.
Parameters:
setTargetHealthFactor (0xffac9b50)
Sets the target health factor.
Requirements:
Only the moderator can call this function.
The denominatorHF cannot be zero.
Parameters:
getCurrentHealthFactor (0xb398f0e7)
Gets the current health factor of a specific account's position.
Parameters:
Return values:
getTokenPrice (0xc9f7153c)
Gets the price of a token in USD.
Parameters:
Return values:
liquidatorRewardFactor (0x894c4d5b)
Calculates the liquidator reward factor (LRF) for a given position.
Formula: LRF = (1 + (1 - HF) * k)
Parameters:
Return values:
getMaxLiquidationAmount (0x7da157b9)
Calculates the maximum liquidation amount (MaxLA) for a given position.
Formula: MaxLA = (LVR * CVc - THF * LVc) / (LRF * LVR - THF)
Parameters:
Return values:
getLiquidationAmount (0x90edd058)
Returns the minimum and maximum liquidation amount for a given account, project token, and lending token.
Formula:
MinLA = min(MaxLA, MPA)
MaxLA = (LVR * CVc - THF * LVc) / (LRF * LVR - THF)
Parameters:
Return values:
Last updated