diff --git a/src/Blue.sol b/src/Blue.sol index 50dee219d..fe1b2b1de 100644 --- a/src/Blue.sol +++ b/src/Blue.sol @@ -66,7 +66,7 @@ contract Blue { function supply(Market calldata market, uint amount) external { Id id = Id.wrap(keccak256(abi.encode(market))); require(lastUpdate[id] != 0, "unknown market"); - require(amount > 0, "zero amount"); + require(amount != 0, "zero amount"); accrueInterests(id); @@ -87,7 +87,7 @@ contract Blue { function withdraw(Market calldata market, uint amount) external { Id id = Id.wrap(keccak256(abi.encode(market))); require(lastUpdate[id] != 0, "unknown market"); - require(amount > 0, "zero amount"); + require(amount != 0, "zero amount"); accrueInterests(id); @@ -107,7 +107,7 @@ contract Blue { function borrow(Market calldata market, uint amount) external { Id id = Id.wrap(keccak256(abi.encode(market))); require(lastUpdate[id] != 0, "unknown market"); - require(amount > 0, "zero amount"); + require(amount != 0, "zero amount"); accrueInterests(id); @@ -131,7 +131,7 @@ contract Blue { function repay(Market calldata market, uint amount) external { Id id = Id.wrap(keccak256(abi.encode(market))); require(lastUpdate[id] != 0, "unknown market"); - require(amount > 0, "zero amount"); + require(amount != 0, "zero amount"); accrueInterests(id); @@ -149,7 +149,7 @@ contract Blue { function supplyCollateral(Market calldata market, uint amount) external { Id id = Id.wrap(keccak256(abi.encode(market))); require(lastUpdate[id] != 0, "unknown market"); - require(amount > 0, "zero amount"); + require(amount != 0, "zero amount"); accrueInterests(id); @@ -161,7 +161,7 @@ contract Blue { function withdrawCollateral(Market calldata market, uint amount) external { Id id = Id.wrap(keccak256(abi.encode(market))); require(lastUpdate[id] != 0, "unknown market"); - require(amount > 0, "zero amount"); + require(amount != 0, "zero amount"); accrueInterests(id); @@ -177,7 +177,7 @@ contract Blue { function liquidate(Market calldata market, address borrower, uint seized) external { Id id = Id.wrap(keccak256(abi.encode(market))); require(lastUpdate[id] != 0, "unknown market"); - require(seized > 0, "zero amount"); + require(seized != 0, "zero amount"); accrueInterests(id); @@ -227,7 +227,7 @@ contract Blue { function isHealthy(Market calldata market, Id id, address user) private view returns (bool) { uint borrowShares = borrowShare[id][user]; // totalBorrowShares[id] > 0 when borrowShares > 0. - uint borrowValue = borrowShares > 0 + uint borrowValue = borrowShares != 0 ? borrowShares.wMul(totalBorrow[id]).wDiv(totalBorrowShares[id]).wMul(market.borrowableOracle.price()) : 0; uint collateralValue = collateral[id][user].wMul(market.collateralOracle.price());