Skip to content

Commit

Permalink
refactor: remove marketTotalBorrow variable in _accrueInterests
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-devatom committed Aug 8, 2023
1 parent 9d8e60c commit 485bec0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Blue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 485bec0

Please sign in to comment.