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

Constants in comparisons should appear on the left side

Summary

Constants in comparisons should appear on the left side

Vulnerability Details

Doing so will prevent typo bugs

File: src/Lender.sol
85: if (_fee > 5000) revert FeeTooHigh();
93: if (_fee > 500) revert FeeTooHigh();
184: if (amount == 0) revert PoolConfig();
200: if (amount == 0) revert PoolConfig();
212: if (maxLoanRatio == 0) revert PoolConfig();
244: if (collateral == 0) revert ZeroCollateral();

Link to code - https://github.com/Cyfrin/2023-07-beedle/tree/main/src/Lender.sol

File: src/Staking.sol
63: if (totalSupply > 0) {
67: if (_diff > 0) {
68: uint256 _ratio = _diff * 1e18 / totalSupply;
69: if (_ratio > 0) {
83: if (_supplied > 0) {
87: if (_delta > 0) {

Link to code - https://github.com/Cyfrin/2023-07-beedle/tree/main/src/Staking.sol

Tools Used

Manual Code Review by SolSaver

Recommendations

Constants in comparisons should appear on the left side

Support

FAQs

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

Give us feedback!