Skip to content

[I-01] Redundant balance check in claim loop #38

@mikeghen

Description

@mikeghen

Description

In claim(), the balance check inside the claim loop contains a redundant first clause:

uint256 _balance = _token.balanceOf(address(this));
if (_balance == 0 || _balance < _claimRequests[_i].minAmountRequested) {
    revert FeeFlow_InsufficientBalance();
}

The _balance == 0 condition is subsumed by _balance < _claimRequests[_i].minAmountRequested for any minAmountRequested >= 1. The only case where it is load-bearing is when minAmountRequested == 0, where it prevents a zero-amount safeTransfer(). That transfer is harmless (most ERC-20 implementations allow it), so the zero check serves no protective purpose and only adds gas cost and cognitive overhead.

Recommendation

Remove the redundant clause:

- if (_balance == 0 || _balance < _claimRequests[_i].minAmountRequested) {
+ if (_balance < _claimRequests[_i].minAmountRequested) {
      revert FeeFlow_InsufficientBalance();
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions