Omniscia Congruent Audit
MasterChef Code Style Findings
MasterChef Code Style Findings
MCF-01C: Ineffectual Initialization Assignment
Type | Severity | Location |
---|---|---|
Gas Optimization | ![]() | MasterChef.sol:L50 |
Description:
The linked assignment is ineffectual primarily because it assigns the default value of the storage variable and secondarily because it is performed in a proxy implementation and thus has no impact.
Example:
contracts/MasterChef.sol
50uint256 public totalAllocPoint = 0;
Recommendation:
We advise it to be omitted from the codebase.
Alleviation:
The redundant assignment was removed from the codebase safely.
MCF-02C: Ineffectual Usage of SafeMath
Type | Severity | Location |
---|---|---|
Language Specific | ![]() | MasterChef.sol:L15 |
Description:
The contract system is compiled at version 0.8.X
and above, possessing built-in safe arithmetics enabled by default.
Example:
contracts/MasterChef.sol
3pragma solidity =0.8.12;4
5import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";6import '@openzeppelin/contracts/utils/math/SafeMath.sol';7import '@openzeppelin/contracts/utils/Address.sol';8import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";9import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";10import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";11
12import "./interfaces/IcCRV.sol";13
14contract MasterChef is Initializable, OwnableUpgradeable, UUPSUpgradeable {15 using SafeMath for uint256;
Recommendation:
We advise the SafeMath
utilization to be omitted across the contract to reduce gas costs of all relevant functions.
Alleviation:
All instances of SafeMath
were properly replaced by their raw counterparts alleviating this exhibit.