From 0965a99d883f631e3cebb4fa083beb8facaa98f6 Mon Sep 17 00:00:00 2001 From: emilio Date: Sun, 13 Jun 2021 21:15:06 +0200 Subject: [PATCH] refactor: fixed natspec comments and removed redunant check in refreshDebt() --- .../protocol/libraries/logic/ReserveLogic.sol | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/contracts/protocol/libraries/logic/ReserveLogic.sol b/contracts/protocol/libraries/logic/ReserveLogic.sol index b44c3853..91104182 100644 --- a/contracts/protocol/libraries/logic/ReserveLogic.sol +++ b/contracts/protocol/libraries/logic/ReserveLogic.sol @@ -341,10 +341,10 @@ library ReserveLogic { } /** - * @dev Creates a cache object to avoid repeated storage reads and external contract calls when updating state and interest rates. - * @param reserve The reserve object for which the cache will be filled - * @return The cache object - */ + * @dev Creates a cache object to avoid repeated storage reads and external contract calls when updating state and interest rates. + * @param reserve The reserve object for which the cache will be filled + * @return The cache object + */ function cache(DataTypes.ReserveData storage reserve) internal view @@ -387,14 +387,14 @@ library ReserveLogic { } /** - * @dev Updates the debt data in the cache object. MUST be invoked before updateInterestRates() when a protocol interaction - * causes minting or burning of debt. - * @param cache The cache object - * @param stableDebtMinted The stable debt minted as a consequence of the interaction - * @param stableDebtBurned The stable debt burned as a consequence of the interaction - * @param variableDebtMinted The variable debt minted as a consequence of the interaction - * @param variableDebtBurned The variable debt burned as a consequence of the interaction - */ + * @dev Updates the debt data in the cache object. MUST be invoked before updateInterestRates() when a protocol interaction + * causes minting or burning of debt. + * @param cache The cache object + * @param stableDebtMinted The stable debt minted as a consequence of the interaction + * @param stableDebtBurned The stable debt burned as a consequence of the interaction + * @param variableDebtMinted The variable debt minted as a consequence of the interaction + * @param variableDebtBurned The variable debt burned as a consequence of the interaction + */ function refreshDebt( DataTypes.ReserveCache memory cache, uint256 stableDebtMinted, @@ -408,10 +408,8 @@ library ReserveLogic { .currTotalStableDebt .add(stableDebtMinted) .sub(stableDebtBurned); - if (stableDebtMinted != 0 || stableDebtBurned != 0) { - cache.nextAvgStableBorrowRate = IStableDebtToken(cache.stableDebtTokenAddress) - .getAverageStableRate(); - } + cache.nextAvgStableBorrowRate = IStableDebtToken(cache.stableDebtTokenAddress) + .getAverageStableRate(); } else { cache.nextPrincipalStableDebt = cache.nextTotalStableDebt = cache .nextAvgStableBorrowRate = 0;