20,000 USDC
View results
Submission Details
Severity: gas
Valid

`>=` costs less gas than `>`.

Summary

>= costs less gas than >.

Vulnerability Details

The compiler uses opcodes GT and ISZERO for solidity code that uses >, but only requires LT for >=, which saves 3 gas

Impact

There are 22 instances of this issue:

File: 2023-07-beedle/src/Lender.sol

85: if (_fee > 5000) revert FeeTooHigh();
93: if (_fee > 500) revert FeeTooHigh();
137: p.auctionLength > MAX_AUCTION_LENGTH ||
138: p.interestRate > MAX_INTEREST_RATE
150: if (p.poolBalance > currentBalance) {
151: // if new balance > current balance then transfer the difference from the lender
223: if (interestRate > MAX_INTEREST_RATE) revert PoolConfig();
243: if (debt > pool.poolBalance) revert LoanTooLarge();
248: if (loanRatio > pool.maxLoanRatio) revert RatioTooHigh();
374: if (pool.interestRate > loan.interestRate) revert RateTooHigh();
386: if (loanRatio > pool.maxLoanRatio) revert RatioTooHigh();
472: if (block.timestamp > loan.auctionStartTimestamp + loan.auctionLength)
479: if (pools[poolId].interestRate > currentAuctionRate) revert RateTooHigh();
620: if (loanRatio > pool.maxLoanRatio) revert RatioTooHigh();
640: if (debtToPay > debt) {
662: if (collateral > loan.collateral) {

File: 2023-07-beedle/src/Staking.sol

63: if (totalSupply > 0) {
65: if (_balance > balance) {
67: if (_diff > 0) {
69: if (_ratio > 0) {
83: if (_supplied > 0) {
87: if (_delta > 0) {

Tools Used

Recommendations

Consider using >= instead if appropriate.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.