Omniscia Olive Audit
RewardsHash Code Style Findings
RewardsHash Code Style Findings
RHH-01C: Ineffectual constructor
Implementation
Type | Severity | Location |
---|---|---|
Gas Optimization | RewardsHash.sol:L16-L18 |
Description:
The linked constructor
is redundant as the default value of latestCycleIndex
is 0
.
Example:
contracts/rewards/RewardsHash.sol
16constructor() { 17 latestCycleIndex = 0;18}
Recommendation:
We advise it to be safely omitted.
Alleviation:
The redundant assignment has been safely omitted from the codebase.
RHH-02C: Redundant Usage of SafeMath
Type | Severity | Location |
---|---|---|
Gas Optimization | RewardsHash.sol:L11 |
Description:
The project's code is compiled with a compiler version beyond 0.8.X
which has built-in safe arithmetics toggled on by default.
Example:
contracts/rewards/RewardsHash.sol
3pragma solidity 0.8.4;4pragma experimental ABIEncoderV2;5
6import "@openzeppelin/contracts/access/Ownable.sol";7import "../interfaces/IRewardHash.sol";8import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol";9
10contract RewardHash is IRewardHash, Ownable {11 using SafeMath for uint256;
Recommendation:
We advise the codebase to omit the usage of SafeMath
in favor of reduced gas costs.
Alleviation:
The redundant usage of SafeMath
has been safely omitted from the codebase.