40,000 USDC
View results
Submission Details
Severity: gas

L111 in `Escrow.sol` could be unchecked

Summary

L111 in Escrow.sol could be unchecked since it never overflows for any reasonable ERC20 token.

Vulnerability Details

For any real ERC20 token, L111 could be inside unchecked blocked since i_arbiterFee would be a comparatively small value and
even if the arbiter provides a large buyerAward value, code still would revert to L120 due to not enough token balance:

File: Escrow.sol
File: Escrow.sol
111: uint256 totalFee = buyerAward + i_arbiterFee; // Reverts on overflow
112: if (totalFee > tokenBalance) {
113: revert Escrow__TotalFeeExceedsBalance(tokenBalance, totalFee);
114: }
115:
116: s_state = State.Resolved;
117: emit Resolved(i_buyer, i_seller);
118:
119: if (buyerAward > 0) {
120: i_tokenContract.safeTransfer(i_buyer, buyerAward);
121: }

Impact

unchecked block could save some gas during each dispute resolving.

Tools Used

Manual review

Recommendations

Consider adding unchecked block to line 111.

Support

FAQs

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