code-423n4 / 2022-02-pooltogether-findings

0 stars 0 forks source link

Gas Optimizations #17

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

G01: TWABDelegator: Remove == true comparison in _requireDelegatorOrRepresentative()

Line References

https://github.com/pooltogether/v4-twab-delegator/blob/master/contracts/TWABDelegator.sol#L583

Description

Since the representatives mapping evaluates to a boolean, its comparison against true is redundant.

Recommended Mitigation Steps

require(
  _delegator == msg.sender || representatives[_delegator][msg.sender],
  "TWABDelegator/not-delegator-or-rep"
);
PierrickGT commented 2 years ago

Duplicate of: https://github.com/code-423n4/2022-02-pooltogether-findings/issues/15