Omniscia Beanstalk Audit
ConvertFacet Code Style Findings
ConvertFacet Code Style Findings
CFE-01C: Redundant Usage of SafeMath
Type | Severity | Location |
---|---|---|
Gas Optimization | ConvertFacet.sol:L98, L107, L109 |
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/ConvertFacet/ConvertFacet.sol
106if (amountFromWallet < w.beansTransferred)107 bean().transfer(msg.sender, w.beansTransferred.sub(amountFromWallet).add(allocatedBeans));108else if (w.beansTransferred < amountFromWallet) {109 uint256 transferAmount = amountFromWallet.sub(w.beansTransferred);110 LibMarket.transferAllocatedBeans(allocatedBeans, transferAmount);111}
Recommendation:
We advise them to be performed without the usage of SafeMath
to optimise the code.
Alleviation:
The code was relocated to the ConvertSilo
contract, however, the optimization was applied as advised thereby alleviating this exhibit.