Omniscia Olive Audit
Staking Code Style Findings
Staking Code Style Findings
STA-01C: Redundant Usage of SafeMath
Type | Severity | Location |
---|---|---|
Gas Optimization | Staking.sol:L23 |
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/staking/Staking.sol
3pragma solidity 0.8.4;4pragma experimental ABIEncoderV2;5
6import "../interfaces/IStaking.sol";7import "../interfaces/IVoteOlive.sol";8import "../interfaces/IManager.sol";9import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";10import {SafeMathUpgradeable as SafeMath} from "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";11import {MathUpgradeable as Math} from "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";12import {IERC20Upgradeable as IERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";13import {SafeERC20Upgradeable as SafeERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";14import {OwnableUpgradeable as Ownable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";15import {EnumerableSetUpgradeable as EnumerableSet} from "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";16import {PausableUpgradeable as Pausable} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";17import {ReentrancyGuardUpgradeable as ReentrancyGuard} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";18import "../interfaces/events/BalanceUpdateEvent.sol";19
20
21contract Staking is IStaking, Initializable, Ownable, Pausable, ReentrancyGuard {22 using SafeMath for uint256;
Recommendation:
We advise the codebase to omit the usage of SafeMath
in favor of reduced gas costs.
Alleviation:
The file is no longer present in the codebase thereby nullifying this exhibit.