Skip to content

Commit

Permalink
refactor: simplify isHealthy
Browse files Browse the repository at this point in the history
  • Loading branch information
QGarchery committed Jul 5, 2023
1 parent e1290c2 commit a1e6fbe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Blue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,10 @@ contract Blue {

function isHealthy(Market calldata market, Id id, address user) private view returns (bool) {
uint borrowShares = borrowShare[id][user];
if (borrowShares == 0) return true;
// totalBorrowShares[id] > 0 when borrowShares > 0.
uint borrowValue = borrowShares != 0
? borrowShares.wMul(totalBorrow[id]).wDiv(totalBorrowShares[id]).wMul(market.borrowableOracle.price())
: 0;
uint borrowValue =
borrowShares.wMul(totalBorrow[id]).wDiv(totalBorrowShares[id]).wMul(market.borrowableOracle.price());
uint collateralValue = collateral[id][user].wMul(market.collateralOracle.price());
return collateralValue.wMul(market.lLTV) >= borrowValue;
}
Expand Down

0 comments on commit a1e6fbe

Please sign in to comment.