Skip to content

Commit

Permalink
Merge pull request #58 from morpho-labs/refactor/healthy-zero
Browse files Browse the repository at this point in the history
Simplify `isHealthy`
  • Loading branch information
QGarchery authored Jul 6, 2023
2 parents 4f4f740 + a1e6fbe commit 79848ae
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 @@ -230,10 +230,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 79848ae

Please sign in to comment.