Omniscia GoGo Audit

StakingRewardsLP Code Style Findings

StakingRewardsLP Code Style Findings

SRL-01C: Potentially Redundant Function

TypeSeverityLocation
Code StyleInformationalStakingRewardsLP.sol:L102-L112

Description:

The rewardsClaimableWithoutLoss function simply yields the value of earned only if the user's lock period has passed and yields 0 otherwise.

Example:

contracts/staking/StakingRewardsLP.sol
102function rewardsClaimableWithoutLoss(address account)
103 public
104 view
105 returns (uint256)
106{
107 if (lastStakedTime[account].add(lockPeriod) < block.timestamp) {
108 return earned(account);
109 } else {
110 return 0;
111 }
112}

Recommendation:

We advise the function to be adjusted to instead showcase the actual redeemable amount of a user which will be halved in case the lock time has passed.

Alleviation:

The GoGo team considered this exhibit but opted not to apply a remediation for it in the current iteration of the codebase.

SRL-02C: Usage of SafeMath

TypeSeverityLocation
Language SpecificInformationalStakingRewardsLP.sol:L6, L22

Description:

The usage of SafeMath is redundant for any pragma version that is above 0.8.X given that safe arithmetics are toggled on by default.

Example:

contracts/staking/StakingRewardsLP.sol
80function rewardPerToken() public view returns (uint256) {
81 if (_totalSupply == 0) {
82 return rewardPerTokenStored;
83 }
84 return
85 rewardPerTokenStored.add(
86 lastTimeRewardApplicable()
87 .sub(lastUpdateTime)
88 .mul(rewardRate)
89 .mul(1e18)
90 .div(_totalSupply)
91 );
92}

Recommendation:

We advise the import and corresponding usage to be omitted from the codebase in favor of reduced gas costs.

Alleviation:

The GoGo team considered this exhibit but opted not to apply a remediation for it in the current iteration of the codebase.