From 94f08437061b5b8abed5e498b161962196d92153 Mon Sep 17 00:00:00 2001 From: eboado Date: Wed, 9 Nov 2022 12:07:09 +0100 Subject: [PATCH] Improved comment on _updateIndexes() --- contracts/protocol/libraries/logic/ReserveLogic.sol | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contracts/protocol/libraries/logic/ReserveLogic.sol b/contracts/protocol/libraries/logic/ReserveLogic.sol index 8f9664428..3ba3c12f5 100644 --- a/contracts/protocol/libraries/logic/ReserveLogic.sol +++ b/contracts/protocol/libraries/logic/ReserveLogic.sol @@ -301,8 +301,9 @@ library ReserveLogic { } // 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 + // reserveCache.currVariableBorrowRate != 0 is not a correct validation, + // because a positive base variable rate can be stored on + // reserveCache.currVariableBorrowRate, but the index should not increase if (reserveCache.currScaledVariableDebt != 0) { uint256 cumulatedVariableBorrowInterest = MathUtils.calculateCompoundedInterest( reserveCache.currVariableBorrowRate,