re-al-Foundation / rwa-contracts

0 stars 0 forks source link

[RDR-03C] Redundant Approval Operation #94

Closed chasebrownn closed 5 months ago

chasebrownn commented 5 months ago

RDR-03C: Redundant Approval Operation

Type Severity Location
Gas Optimization RevenueDistributor.sol:L355

Description:

The referenced SafeERC20::forceApprove operation is redundant as the ensuing SafeERC20::forceApprove to a non-zero value will already zero out the approval if necessary.

Example:

IERC20(_tokenIn).forceApprove(_target, 0);
IERC20(_tokenIn).forceApprove(_target, _amount);

Recommendation:

We advise the SafeERC20::forceApprove operation with a value of 0 to be removed, optimizing the code's gas cost.

chasebrownn commented 5 months ago

Resolved