FundraiserFacet Code Style Findings

FundraiserFacet Code Style Findings

FFE-01C: Redundant Usage of SafeMath

Type Severity Location
Gas Optimization FundraiserFacet.sol:L34

Description:

The linked SafeMath operations are guaranteed to be performed safely by their surrounding if clauses and general logical constraints.

Example:

protocol/contracts/farm/facets/FundraiserFacet.sol
32require(remaining >= amount, "Fundraiser: amount exceeds remaining.");
33IERC20(s.fundraisers[id].token).transferFrom(msg.sender, address(this), amount);
34s.fundraisers[id].remaining = remaining.sub(amount);

Recommendation:

We advise them to be performed without the usage of SafeMath to optimise the code.

Alleviation:

The calculation was correctly updated to a raw subtraction (-) optimizing the codebase.

View Fix on GitHub
Navigated to FundraiserFacet Code Style Findings