Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ValidationLogic.sol #940

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion contracts/protocol/libraries/logic/ValidationLogic.sol
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,18 @@ library ValidationLogic {
require(vars.userCollateralInBaseCurrency != 0, Errors.COLLATERAL_BALANCE_IS_ZERO);
require(vars.currentLtv != 0, Errors.LTV_VALIDATION_FAILED);

/**
* @notice The decision to use `>` instead of `>=` in this require check is based on the following rationale:
*
* Whenever a user opens a borrow position, the borrow rate will immediately be greater than 0.
* This generally (though not always) causes the health factor (HF) to decrease minimally.
* Consequently, anyone opening a position at 1HF will see their HF drop below 1HF immediately.
* While this scenario can also occur at 1.00000000...1 HF, determining the precise condition
* is debatable and was set during the design stage without compelling reasons for alteration.
*/
require(
vars.healthFactor > HEALTH_FACTOR_LIQUIDATION_THRESHOLD,
Errors.HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD
Errors.HEALTH_FACTOR_TOO_LOW
);

vars.amountInBaseCurrency =
Expand Down