From 485bec0629d8ec396f2b03dc8fa3c436cf196943 Mon Sep 17 00:00:00 2001 From: julien Date: Tue, 8 Aug 2023 14:44:41 +0200 Subject: [PATCH] refactor: remove `marketTotalBorrow` variable in `_accrueInterests` --- src/Blue.sol | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Blue.sol b/src/Blue.sol index 741bf503f..f77d8f019 100644 --- a/src/Blue.sol +++ b/src/Blue.sol @@ -370,14 +370,13 @@ contract Blue is IBlue { if (elapsed == 0) return; - uint256 marketTotalBorrow = totalBorrow[id]; lastUpdate[id] = block.timestamp; - if (marketTotalBorrow == 0) return; + if (totalBorrow[id] == 0) return; uint256 borrowRate = IIrm(market.irm).borrowRate(market); - uint256 accruedInterests = marketTotalBorrow.mulWadDown(borrowRate * elapsed); - totalBorrow[id] = marketTotalBorrow + accruedInterests; + uint256 accruedInterests = totalBorrow[id].mulWadDown(borrowRate * elapsed); + totalBorrow[id] += accruedInterests; totalSupply[id] += accruedInterests; uint256 feeShares;