Omniscia Alliance Block Audit
AutoStake Code Style Findings
AutoStake Code Style Findings
ASE-01C: Redundant Default Value Assignments
| Type | Severity | Location |
|---|---|---|
| Code Style | Informational | AutoStake.sol:L25-L27 |
Description:
The linked variables are assigned with the value literal 0 redundantly as their default value is already equal to that.
Example:
20IRewardsPoolBase public rewardPool;21IERC20Detailed public stakingToken;22address public factory;23uint256 public unit = 1e18;24uint256 public valuePerShare = unit;25uint256 public totalShares = 0;26uint256 public totalValue = 0;27uint256 public exitStake = 0;28mapping(address => uint256) public share;Recommendation:
We advise that the assignments are instead omitted to aid in the legibility of the codebase.
Alleviation:
The zero-value assignments were omitted from the codebase.
ASE-02C: Variable Mutability Specifier
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | Informational | AutoStake.sol:L23 |
Description:
The linked variable is only assigned to once at its declaration.
Example:
20IRewardsPoolBase public rewardPool;21IERC20Detailed public stakingToken;22address public factory;23uint256 public unit = 1e18;24uint256 public valuePerShare = unit;25uint256 public totalShares = 0;26uint256 public totalValue = 0;27uint256 public exitStake = 0;28mapping(address => uint256) public share;Recommendation:
As a result, it can be properly set as a constant variable greatly optimizing the gas cost involved in utilizing it.
Alleviation:
The unit variable was properly set to constant, however, we advise it also be named accordingly in uppercase format as denoted by the official Solidity style guide.
ASE-03C: Variable Mutability Specifier
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | Informational | AutoStake.sol:L21-L22, L33-L34 |
Description:
The linked variables are only assigned to once during the constructor.
Example:
32constructor(address token, uint256 _throttleRoundBlocks, uint256 _throttleRoundCap, uint256 stakeEnd) public {33 factory = msg.sender;34 stakingToken = IERC20Detailed(token);35 setLockEnd(stakeEnd);36 setThrottleParams(_throttleRoundBlocks, _throttleRoundCap, stakeEnd);37}Recommendation:
As a result, they can be properly set to as immutable greatly optimizing the gas cost involved in utilizing them.
Alleviation:
The linked variables were properly set to immutable taking full advantage of the gas optimizations it brings.