Omniscia Alliance Block Audit

LimitedAutoStake Static Analysis Findings

LimitedAutoStake Static Analysis Findings

LAS-01S: State Mutability Optimization

TypeSeverityLocation
Gas OptimizationInformationalLimitedAutoStake.sol:L18

Description:

The linked function can have its state mutability restricted to view.

Example:

contracts/autostake-features/LimitedAutoStake.sol
18function onlyUnderStakeLimit(address staker, uint256 newStake) internal {
19 uint256 currentStake = balanceOf(staker);
20 require(currentStake.add(newStake) <= stakeLimit, "onlyUnderStakeLimit::Stake limit reached");
21}

Recommendation:

We advise it to be done so to optimize the gas cost involved in its execution.

Alleviation:

The state mutability of the function was properly set to view.