Omniscia Steer Protocol Audit

StakingRewards Static Analysis Findings

StakingRewards Static Analysis Findings

SRS-01S: Illegible Numeric Value Representations

TypeSeverityLocation
Code StyleStakingRewards.sol:L26, L27

Description:

The linked representations of numeric literals are sub-optimally represented decreasing the legibility of the codebase.

Example:

contracts/StakingRewards.sol
26uint256 constant SECONDS_IN_YEAR = 31536000;

Recommendation:

To properly illustrate each value's purpose, we advise the following guidelines to be followed. For values meant to depict fractions with a base of 1e18, we advise fractions to be utilized directly (i.e. 1e17 becomes 0.1e18) as they are supported. For values meant to represent a percentage base, we advise each value to utilize the underscore (_) separator to discern the percentage decimal (i.e. 10000 becomes 100_00, 300 becomes 3_00 and so on). Finally, for large numeric values we simply advise the underscore character to be utilized again to represent them (i.e. 1000000 becomes 1_000_000).

Alleviation (0ed41ccc18a72b7e559b8d79ab7ba6172362ee3b):

Both variables have had the underscore character (_) properly introduced to their declaration, optimizing their legibility significantly.

SRS-02S: Inexistent Visibility Specifiers

TypeSeverityLocation
Code StyleStakingRewards.sol:L25, L26, L27

Description:

The linked variables have no visibility specifier explicitly set.

Example:

contracts/StakingRewards.sol
25uint256 constant PRECISION = 1e18;

Recommendation:

We advise them to be set so to avoid potential compilation discrepancies in the future as the current behaviour is for the compiler to assign one automatically which may deviate between pragma versions.

Alleviation (200f275c40cbd4798f4a416c044ea726755d4741):

A public visibility specifier has been introduced to all three referenced variables as advised.

SRS-03S: Literal Equality of bool Variable

TypeSeverityLocation
Gas OptimizationStakingRewards.sol:L96

Description:

The linked bool comparison is performed between a variable and a bool literal.

Example:

contracts/StakingRewards.sol
96require(isPaused[_poolId] == false, "Staking Paused");

Recommendation:

We advise the bool variable to be utilized directly either in its negated (!) or original form.

Alleviation (0ed41ccc18a72b7e559b8d79ab7ba6172362ee3b):

The false literal boolean equality has been adjusted to a simple negation of the variable as advised, alleviating this exhibit.