Cyfrin / 2023-07-escrow

16 stars 12 forks source link

Constants in comparisons should appear on the left side #861

Open codehawks-bot opened 1 year ago

codehawks-bot commented 1 year ago

Constants in comparisons should appear on the left side

Severity

Gas Optimization / Informational

Relevant GitHub Links

https://github.com/Cyfrin/2023-07-escrow/tree/main/src/Escrow.sol

Summary

Constants in comparisons should appear on the left side

Vulnerability Details

Doing so will prevent typo bugs

Instances (6):

File: src/Escrow.sol

41:         if (buyer == address(0)) revert Escrow__BuyerZeroAddress();

42:         if (seller == address(0)) revert Escrow__SellerZeroAddress();

106:         if (i_arbiter == address(0)) revert Escrow__DisputeRequiresArbiter();

128:         if (buyerAward > 0) {

131:         if (i_arbiterFee > 0) {

135:         if (tokenBalance > 0) {

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

Tools Used

Manual Code Review

Recommendations

Use constants on the left side