Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accrue interests checks borrow is non zero #91

Merged
merged 4 commits into from
Jul 10, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Blue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ contract Blue {
// Interests management.

function accrueInterests(Market calldata market, Id id) private {
uint marketTotalSupply = totalSupply[id];
uint marketTotalBorrow = totalBorrow[id];

if (marketTotalSupply != 0) {
uint marketTotalBorrow = totalBorrow[id];
if (marketTotalBorrow != 0) {
uint marketTotalSupply = totalSupply[id];
QGarchery marked this conversation as resolved.
Show resolved Hide resolved
uint borrowRate = market.irm.borrowRate(market);
uint accruedInterests = marketTotalBorrow.wMul(borrowRate).wMul(block.timestamp - lastUpdate[id]);
totalSupply[id] = marketTotalSupply + accruedInterests;
QGarchery marked this conversation as resolved.
Show resolved Hide resolved
Expand Down