code-423n4 / 2021-11-nested-findings

1 stars 1 forks source link

index + 1 can be simplified #207

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

pauliax

Vulnerability details

Impact

This can be simplified to reduce gas costs by eliminating math operation:

  // before
  require(_accountIndex + 1 <= shareholders.length, "FeeSplitter: INVALID_ACCOUNT_INDEX");
  // after
  require(_accountIndex < shareholders.length, "FeeSplitter: INVALID_ACCOUNT_INDEX");