Stars Staking

Smart Contract Audit Report

Audit Summary

StarsStaking Audit Report Mogul Productions is launching a new staking contract for users to deposit tokens and earn yield.

For this audit, we reviewed the project team's StarsStaking contract at commit 971e5b3b0aee77a5cc565f04b2f4e21e36e5cc31 on the team's private GitHub repository.

Audit Findings

No findings were identified, though some centralized aspects are present.
Date: May 12th, 2022.

Contract Overview

  • This contract allows anyone to deposit team-designated staking tokens in order to earn rewards in the form of a reward token from the Rewarder contract address.
  • The Rewarder contract address is not provided in the scope of this audit, so we are unable to provide an assessment of the contract with regards to security.
  • Users may deposit staking tokens into the corresponding staking pool until the pool's end block is reached.
  • Users' rewards are dependent on their amount staked, time staked, and the pool's reward per share amount.
  • The reward per share amount is calculated using the contract's reward per block rate and the pool's total deposited token amount.
  • The contract's reward per block rate is dependent on the pool's total reward amount and end block.
  • Users can harvest rewards once the pool's minimum lock time has elapsed for the specified deposit entry or if the pool's end block has been reached.
  • Users that withdraw their deposit before the pool's minimum lock time has elapsed for their deposit entry forfeit any potential rewards; in the contract's current state, rewards are forfeited if deposits are withdrawn even after the minimum lock time.
  • The owner can transfer ownership at any time.
  • The owner can change the rewarder address at any time.
  • The owner can add a new staking pool at any time.
  • The owner can set any pool's end block to any block number after the current block and the pool's start block.
  • The owner can add an amount of any value to any pool's total reward amount at any time.
  • The team must exercise caution when setting the staking token and must avoid using any fee-on-transfer or ERC-777 tokens; if a fee-on-transfer token is used as the staking token then this contract should be excluded from the staking token's fee mechanism.
  • As the contract is deployed with Solidity v0.8.x, it is protected from overflow/underflow attacks.

Audit Results

Vulnerability CategoryNotesResult
Arbitrary Jump/Storage WriteN/APASS
Centralization of Control
  • The rewards are held in a separate contract controlled by the team.
  • The owner can change the end block at any time, effectively controlling the reward per block rate.
Compiler IssuesN/APASS
Delegate Call to Untrusted ContractN/APASS
Dependence on Predictable VariablesN/APASS
Ether/Token TheftN/APASS
Flash LoansN/APASS
Front RunningN/APASS
Improper EventsN/APASS
Improper Authorization SchemeN/APASS
Integer Over/UnderflowN/APASS
Logical IssuesN/APASS
Oracle IssuesN/APASS
Outdated Compiler VersionN/APASS
Race ConditionsN/APASS
Signature IssuesN/APASS
Unbounded LoopsN/APASS
Unused CodeN/APASS
Overall Contract Safety PASS

Inheritance Chart

Smart Contract Audit - Inheritance

Function Graph

Smart Contract Audit - Graph

Functions Overview

 ($) = payable function
 # = non-constant function
 Int = Internal
 Ext = External
 Pub = Public

+ [Lib] SafeMath 
    - [Int] tryAdd
    - [Int] trySub
    - [Int] tryMul
    - [Int] tryDiv
    - [Int] tryMod
    - [Int] add
    - [Int] sub
    - [Int] mul
    - [Int] div
    - [Int] mod
    - [Int] sub
    - [Int] div
    - [Int] mod

 + [Lib] SignedSafeMath 
    - [Int] mul
    - [Int] div
    - [Int] sub
    - [Int] add

 + [Int] IERC20 
    - [Ext] totalSupply
    - [Ext] balanceOf
    - [Ext] transfer #
    - [Ext] allowance
    - [Ext] approve #
    - [Ext] transferFrom #

 + [Lib] Address 
    - [Int] isContract
    - [Int] sendValue #
    - [Int] functionCall #
    - [Int] functionCall #
    - [Int] functionCallWithValue #
    - [Int] functionCallWithValue #
    - [Int] functionStaticCall
    - [Int] functionStaticCall
    - [Int] functionDelegateCall #
    - [Int] functionDelegateCall #
    - [Int] verifyCallResult

 + [Lib] SafeERC20 
    - [Int] safeTransfer #
    - [Int] safeTransferFrom #
    - [Int] safeApprove #
    - [Int] safeIncreaseAllowance #
    - [Int] safeDecreaseAllowance #
    - [Prv] _callOptionalReturn #

 +  Context 
    - [Int] _msgSender
    - [Int] _msgData

 +  Ownable (Context)
    - [Pub]  #
    - [Pub] owner
    - [Pub] renounceOwnership #
       - modifiers: onlyOwner
    - [Pub] transferOwnership #
       - modifiers: onlyOwner
    - [Int] _transferOwnership #

 +  StarsStaking (Ownable)
    - [Pub]  #
    - [Pub] poolLength
    - [Pub] depositLength
    - [Pub] getDeposit
    - [Pub] lockupRemaining
    - [Pub] setRewarder #
       - modifiers: onlyOwner
    - [Pub] setPoolEndBlock #
       - modifiers: onlyOwner
    - [Pub] addPrizePool #
       - modifiers: onlyOwner
    - [Pub] addPool #
       - modifiers: onlyOwner
    - [Ext] massUpdatePools #
    - [Pub] updatePool #
    - [Ext] pendingSTARS
    - [Pub] deposit #
    - [Pub] withdraw #
    - [Pub] harvest #
    - [Pub] harvestAll #
    - [Pub] withdrawAndHarvest #
    - [Int] _hasMetMinLockupTime

About Solidity Finance

Solidity Finance was founded in 2020 and quickly grew to have one of the most experienced and well-equipped smart contract auditing teams in the industry. Our team has conducted 1000+ solidity smart contract audits covering all major project types and protocols, securing a total of over $50 billion U.S. dollars in on-chain value across 1500 projects!.
Our firm is well-reputed in the community and is trusted as a top smart contract auditing company for the review of solidity code, no matter how complex. Our team of experienced solidity smart contract auditors performs audits for tokens, NFTs, crowdsales, marketplaces, gambling games, financial protocols, and more!

Contact us today to get a free quote for a smart contract audit of your project!

What is a Solidity Audit?

Typically, a smart contract audit is a comprehensive review process designed to discover logical errors, security vulnerabilities, and optimization opportunities within code. A Solidity Audit takes this a step further by verifying economic logic to ensure the stability of smart contracts and highlighting privileged functionality to create a report that is easy to understand for developers and community members alike.

How Do I Interpret the Findings?

Each of our Findings will be labeled with a Severity level. We always recommend the team resolve High, Medium, and Low severity findings prior to deploying the code to the mainnet. Here is a breakdown on what each Severity level means for the project:

  • High severity indicates that the issue puts a large number of users' funds at risk and has a high probability of exploitation, or the smart contract contains serious logical issues which can prevent the code from operating as intended.
  • Medium severity issues are those which place at least some users' funds at risk and has a medium to high probability of exploitation.
  • Low severity issues have a relatively minor risk association; these issues have a low probability of occurring or may have a minimal impact.
  • Informational issues pose no immediate risk, but inform the project team of opportunities for gas optimizations and following smart contract security best practices.