Skip to content

Commit

Permalink
Add constant for HFT_MINIMUM_BUFFER
Browse files Browse the repository at this point in the history
  • Loading branch information
EridianAlpha committed Jun 25, 2024
1 parent 11b8cb0 commit 7a60550
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/AaveFunctionsModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ contract AaveFunctionsModule is IAaveFunctionsModule {
_;
}

/// @notice The buffer for the Health Factor Target minimum calculation
uint16 public constant HFT_MINIMUM_BUFFER = 1;

// ================================================================
// │ MODULE FUNCTIONS │
// ================================================================
Expand Down Expand Up @@ -178,11 +181,10 @@ contract AaveFunctionsModule is IAaveFunctionsModule {
IAavePM aavePM = IAavePM(address(this));
address aavePoolAddress = aavePM.getContractAddress("aavePool");

// TODO: Improve check.
(totalCollateralBase, totalDebtBase, availableBorrowsBase, currentLiquidationThreshold, ltv, healthFactor) =
IPool(aavePoolAddress).getUserAccountData(address(this));
uint256 healthFactorScaled = healthFactor / 1e16;
if (healthFactorScaled < (aavePM.getHealthFactorTargetMinimum() - 1)) {
if (healthFactorScaled < (aavePM.getHealthFactorTargetMinimum() - HFT_MINIMUM_BUFFER)) {
revert IAavePM.AavePM__HealthFactorBelowMinimum();
}

Expand Down

0 comments on commit 7a60550

Please sign in to comment.