Cheers Land Farm - Smart Contract Audit Report

Summary

Cheers Land Farm Audit Report Cheers Land Farm is a new yield farming contract that pays rewards to stakers in designated rewards tokens.

For this audit, we reviewed the CheersLpPool contracts provided to us by the team.

Notes on the CheersLpPool Contract:
  • This contract allows anyone to stake a single asset determined by the project team in exchange for rewards.
  • On initialization, the owner must specify the rewards token, the staking token, and the start of the staking period; rewards will stop being distributed 90 days after the start date.
  • The team must exercise caution when deciding the staking token to avoid fee-on-transfer and ERC777-compliant tokens (this is uncommon).

  • If a threshold value of staking tokens is reached during a deposit, users may be whitelisted in various "association pools".
  • If a user falls below the threshold value of an association pool during a withdrawal, they may be removed from the whitelist for that association pool.
  • The threshold value for each pool is independent and may be different for each pool.
  • The team should exercise caution to not add too many association pools, as this may cause loops in the deposit and withdrawal function to hit the gas block limit.
  • Users will receive a reward amount on each block based on the amount staked; staking rewards can be calculated and transferred to the user at any time.
  • Rewards will not be received unless they are claimed, they are not distributed during regular deposits and withdrawals.
  • A fee will be taken and sent to a fee address if tokens are withdrawn before the cooldown time since the the user's most recent deposit has passed.

  • The owner is able to set the start/end time and stop reward distribution at any time.
  • The owner is able to add and remove association pools at any time.
  • The owner is able to update the fee percentage taken for early withdrawal, the cooldown period after staking, and the address that receives fees at any time.
  • The owner is able to update the rewards rate at any time.
  • The owner is able to update the designated staking token at any time.
  • Utilization of SafeMath to prevent overflows.
Audit Findings Summary
  • No external threats were identified.
  • Ensure trust in the team as they have considerable control within the ecosystem.
  • Date: November 16th, 2021.

Audit Results

Vulnerability CategoryNotesResult
Arbitrary Storage WriteN/APASS
Arbitrary JumpN/APASS
Delegate Call to Untrusted ContractN/APASS
Dependence on Predictable VariablesN/APASS
Deprecated OpcodesN/APASS
Ether ThiefN/APASS
ExceptionsN/APASS
External CallsN/APASS
Flash LoansN/APASS
Integer Over/UnderflowN/APASS
Multiple SendsN/APASS
OraclesN/APASS
SuicideN/APASS
State Change External CallsN/APASS
Unchecked RetvalN/APASS
User Supplied AssertionN/APASS
Critical Solidity CompilerN/APASS
Overall Contract Safety PASS

Cheers Land Farm Graph

Cheers Land Farm


 ($) = payable function
 # = non-constant function

 + [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] Math 
    - [Int] max
    - [Int] min
    - [Int] average
    - [Int] ceilDiv

 + [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

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

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

 +  CheersLpPool (Auth)
    - [Pub] Constructor #
    - [Pub] lastTimeRewardApplicable
    - [Pub] rewardPerToken
    - [Pub] earned
    - [Pub] stake #
       - modifiers: checkStart,updateReward
    - [Pub] withdraw #
       - modifiers: updateReward
    - [Pub] receiveRewards #
       - modifiers: updateReward
    - [Pub] addAssociationPool #
       - modifiers: onlyOperator
    - [Pub] deleteAssociationPool #
       - modifiers: onlyOperator
    - [Pub] updateMortgageLp #
       - modifiers: onlyOperator
    - [Pub] updateFeeAddress #
       - modifiers: onlyOperator
    - [Pub] updateStartTime #
       - modifiers: onlyOperator
    - [Pub] updateEndTime #
       - modifiers: onlyOperator
    - [Pub] updateMiningOutput #
       - modifiers: onlyOperator
    - [Pub] setWithDrawPunishTime #
       - modifiers: onlyOperator
    - [Pub] setFeeRatio #
       - modifiers: onlyOperator
    - [Pub] getMortgageNum
    - [Pub] isMortgage
    - [Pub] isStart
    - [Pub] getDailyReward
    - [Pub] getUserPunishTime
    - [Pub] remainingTime
    - [Pub] balanceOfByUser