From efdaf634a7809e254ae27c2543f3c64ac875d83e Mon Sep 17 00:00:00 2001 From: eboado Date: Fri, 4 Nov 2022 14:17:14 +0100 Subject: [PATCH] Make more precise comment on _updateIndexes() --- contracts/protocol/libraries/logic/ReserveLogic.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contracts/protocol/libraries/logic/ReserveLogic.sol b/contracts/protocol/libraries/logic/ReserveLogic.sol index 629b0ca5a..8f9664428 100644 --- a/contracts/protocol/libraries/logic/ReserveLogic.sol +++ b/contracts/protocol/libraries/logic/ReserveLogic.sol @@ -300,7 +300,9 @@ library ReserveLogic { reserve.liquidityIndex = reserveCache.nextLiquidityIndex.toUint128(); } - // Variable borrow side only gets updated if there is any accrual of variable debt + // Variable borrow index only gets updated if there is any variable debt. + // We assume that in that case the variable borrow rate is positive, to avoid + // over-optimization if (reserveCache.currScaledVariableDebt != 0) { uint256 cumulatedVariableBorrowInterest = MathUtils.calculateCompoundedInterest( reserveCache.currVariableBorrowRate,