Skip to content

Commit

Permalink
Merge pull request #471 from aave/refactor/403-code-style-defaultrese…
Browse files Browse the repository at this point in the history
…rveinterestratestrategy

fix: Handle code style issues
  • Loading branch information
The-3D authored Dec 22, 2021
2 parents d9da820 + af3743b commit 1c60c61
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions contracts/protocol/pool/DefaultReserveInterestRateStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ contract DefaultReserveInterestRateStrategy is IReserveInterestRateStrategy {
? params.totalStableDebt.rayDiv(vars.totalDebt)
: 0;

vars.currentVariableBorrowRate = 0;
vars.currentLiquidityRate = 0;
vars.currentVariableBorrowRate = _baseVariableBorrowRate;
vars.currentStableBorrowRate = getBaseStableBorrowRate();

vars.borrowUtilizationRate = vars.totalDebt == 0
Expand All @@ -168,23 +168,21 @@ contract DefaultReserveInterestRateStrategy is IReserveInterestRateStrategy {
uint256 excessUtilizationRateRatio = (vars.borrowUtilizationRate - OPTIMAL_UTILIZATION_RATE)
.rayDiv(EXCESS_UTILIZATION_RATE);

vars.currentStableBorrowRate =
vars.currentStableBorrowRate +
vars.currentStableBorrowRate +=
_stableRateSlope1 +
_stableRateSlope2.rayMul(excessUtilizationRateRatio);

vars.currentVariableBorrowRate =
_baseVariableBorrowRate +
vars.currentVariableBorrowRate +=
_variableRateSlope1 +
_variableRateSlope2.rayMul(excessUtilizationRateRatio);
} else {
vars.currentStableBorrowRate =
vars.currentStableBorrowRate +
_stableRateSlope1.rayMul(vars.borrowUtilizationRate).rayDiv(OPTIMAL_UTILIZATION_RATE);
vars.currentStableBorrowRate += _stableRateSlope1.rayMul(vars.borrowUtilizationRate).rayDiv(
OPTIMAL_UTILIZATION_RATE
);

vars.currentVariableBorrowRate =
_baseVariableBorrowRate +
_variableRateSlope1.rayMul(vars.borrowUtilizationRate).rayDiv(OPTIMAL_UTILIZATION_RATE);
vars.currentVariableBorrowRate += _variableRateSlope1
.rayMul(vars.borrowUtilizationRate)
.rayDiv(OPTIMAL_UTILIZATION_RATE);
}

if (vars.stableToTotalDebtRatio > OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO) {
Expand Down

0 comments on commit 1c60c61

Please sign in to comment.