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

Gas Optimizations

Issue Instances
GAS-1 For Operations that will not overflow, you could use unchecked 37
GAS-2 Functions guaranteed to revert when called by normal users can be marked payable 3
GAS-3 Use != 0 instead of > 0 for unsigned integer comparison 3

[GAS-1] For Operations that will not overflow, you could use unchecked

Instances (37):

File: Escrow.sol
6: import {IEscrow} from "./IEscrow.sol";
7: import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
7: import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
7: import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
7: import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
8: import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
8: import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
8: import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
8: import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
8: import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
9: import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
9: import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
9: import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
111: uint256 totalFee = buyerAward + i_arbiterFee; // Reverts on overflow
111: uint256 totalFee = buyerAward + i_arbiterFee; // Reverts on overflow
111: uint256 totalFee = buyerAward + i_arbiterFee; // Reverts on overflow
File: EscrowFactory.sol
4: import {IEscrowFactory} from "./IEscrowFactory.sol";
5: import {IEscrow} from "./IEscrow.sol";
6: import {Escrow} from "./Escrow.sol";
7: import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
7: import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
7: import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
7: import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
8: import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
8: import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
8: import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
8: import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
8: import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
File: IEscrow.sol
4: import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
4: import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
4: import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
4: import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
File: IEscrowFactory.sol
4: import {IEscrow} from "./IEscrow.sol";
5: import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
5: import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
5: import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
5: import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

[GAS-2] Functions guaranteed to revert when called by normal users can be marked payable

If a function modifier such as onlyOwner is used, the function will revert if a normal user tries to pay the function. Marking the function as payable will lower the gas cost for legitimate callers because the compiler will not include checks for whether a payment was provided.

Instances (3):

File: Escrow.sol
94: function confirmReceipt() external onlyBuyer inState(State.Created) {
102: function initiateDispute() external onlyBuyerOrSeller inState(State.Created) {
109: function resolveDispute(uint256 buyerAward) external onlyArbiter nonReentrant inState(State.Disputed) {

[GAS-3] Use != 0 instead of > 0 for unsigned integer comparison

Instances (3):

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

Support

FAQs

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