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

Use != 0 instead of > 0 for Unsigned Integer Comparison

Summary

Changing > 0 to !=0 to save gas.

Vulnerability Details

Issue Information: G003

c4escrow/Escrow.sol::119 => if (buyerAward > 0) {
c4escrow/Escrow.sol::122 => if (i_arbiterFee > 0) {
c4escrow/Escrow.sol::126 => if (tokenBalance > 0) {

Impact

Changing > 0 to !=0 will save you about 10 gas each time.

c4escrow/Escrow.sol::119 => if (buyerAward > 0) {
c4escrow/Escrow.sol::122 => if (i_arbiterFee > 0) {
c4escrow/Escrow.sol::126 => if (tokenBalance > 0) {

Tools Used

Manual review

Recommendations

Change

c4escrow/Escrow.sol::119 => if (buyerAward > 0) {
c4escrow/Escrow.sol::122 => if (i_arbiterFee > 0) {
c4escrow/Escrow.sol::126 => if (tokenBalance > 0) {

to

c4escrow/Escrow.sol::119 => if (buyerAward != 0) {
c4escrow/Escrow.sol::122 => if (i_arbiterFee != 0) {
c4escrow/Escrow.sol::126 => if (tokenBalance != 0) {

Support

FAQs

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