Radium Farm - Smart Contract Audit Report

Summary

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

For this audit, we reviewed the Radium and MasterChef contracts at 0x7951644233760AAD81C8bc37078493a7dC1AA016 on the Binance Smart Chain.

Notes on the Contracts:
Radium Contract:
  • The contract is BEP20 compliant; all standard functionality is present.
  • There is minting functionality present. Although there is no burning functionality, the circulating supply can be reduced by sending tokens to the 0x..dead address, if desired.
  • The Radium token is designed to be a governance token where 1 token = 1 vote.
  • Another contract will be needed to collect votes and execute transactions on behalf of the governance token holders.
  • At the time of writing this report, 60% of the total Radium tokens are stored in a preRadiumDream contract.
  • The remaining 40% is held in a wallet.

  • There is a transaction limit intended to limit the ability of large token holders to unfairly influence the economy. However, the transaction limit is the total supply of the token so this will have no effect in limiting large transactions.
  • Addresses on the whitelist will be excluded from this transaction limit. The owner, the 0 address, and this contract are added to the whitelist on deployment.
  • Token holders can delegate their voting rights to any address. To save gas, users can also do so using an EIP-712 signature. They may also move delegated votes to another address at any time.
  • When delegating, all votes are delegated at once. Users may not partially delegate votes.
  • Users may also delegate through the use of a signed message.
  • Once tokens have been delegated, users may remove delegation to other addresses by setting themselves as their delegate.
  • A user's voting rights, including delegated votes, are not removed when tokens are transferred. This means that the user who is minted the tokens will retain voting rights from those tokens, even if the tokens are subsequently transferred to another user effectively duplicating the amount of votes in circulation.

  • The team has set the operator address to the 0x..dead address so any operator only functionality is no longer accessible.
  • The owner, intended to be the MasterChef contract, may mint any amount of tokens at any time.
MasterChef Contract:
  • This contract allows users to stake LP tokens in exchange for rewards in Radium tokens.
  • A maximum of 160,000 Radium will be minted as rewards.
  • On initialization, the owner must specify the rewards rate, and the starting block for rewards; rewards will not be earned until the starting block has passed.

  • Users may supply a referral address when depositing their tokens to be staked; the referrer will earn additional rewards as a percentage of the referred user's rewards when the referred users rewards are collected. This in addition to the user's rewards and is not taken as a fee.
  • A fee is taken on deposits and transferred to the fee address controlled by the project team; this is a percentage set individually for each pool and may vary between pools.
  • Users will receive a reward amount on each block based on the amount staked and the percentage of total points allocated to the pool.
  • Users are eligible to collect staking rewards if the cooldown time has passed since tokens were first staked, or rewards were last collected.
  • Reward collection cooldowns are set individually for each rewards pool and may vary between pools.
  • On deposits and withdrawals, pending rewards are calculated and transferred to the user, if eligible.
  • The user can also trigger an emergency withdraw, which will transfer all the user's deposited tokens to their wallet address, without calculating rewards.
  • When pools are updated, 6.6% of the accumulated rewards are minted to the dev address controlled by the team as a dev reward fee; this is in addition to the total rewards calculated and are not taken from the total as fees.

  • The owner may update the referral bonus, up to 5%, at any time.
  • The owner may update the rewards emission rate, up to 1 token per block, at any time.
  • The fee address may update the address that receives fees at any time.
  • The dev address may update the address that receives the dev reward fees at any time.
  • The owner may update the deposit fee, up to 5%, and the rewards collection cooldown, up to 1 day, at any time.
  • The owner may update the allocated points for each pool at any time.
  • Utilization of SafeMath to prevent overflow.
  • Utilization of Reentrancy Guard to prevent reentrancy where appropriate.
Audit Findings Summary
  • No external threats were identified.
  • Ensure trust in the team as they have considerable control within the ecosystem.
  • Due to the fact that votes are not transferred during a token transfer, users are able to generate extra votes used in voting.
  • 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

Radium Farm Graph

Radium Farm


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

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

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

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

 +  ERC20 (Context, IERC20, Ownable)
    - [Pub] Constructor #
    - [Pub] name
    - [Pub] symbol
    - [Pub] decimals
    - [Pub] totalSupply
    - [Pub] balanceOf
    - [Pub] transfer #
    - [Pub] allowance
    - [Pub] approve #
    - [Pub] transferFrom #
    - [Pub] increaseAllowance #
    - [Pub] decreaseAllowance #
    - [Pub] mint #
       - modifiers: onlyOwner
    - [Int] _transfer #
    - [Int] _mint #
    - [Int] _burn #
    - [Int] _approve #
    - [Int] _burnFrom #

 +  Radium (ERC20)
    - [Pub] mint #
       - modifiers: onlyOwner
    - [Pub] Constructor #
       - modifiers: ERC20
    - [Pub] maxTransferAmount
    - [Pub] updateMaxTransferAmountRate #
       - modifiers: onlyOperator
    - [Pub] isExcludedFromAntiWhale
    - [Pub] setExcludedFromAntiWhale #
       - modifiers: onlyOperator
    - [Int] _transfer #
       - modifiers: antiWhale
    - [Pub] transferOperator #
       - modifiers: onlyOperator
    - [Ext] delegates
    - [Ext] delegate #
    - [Ext] delegateBySig #
    - [Ext] getCurrentVotes
    - [Ext] getPriorVotes
    - [Int] _delegate #
    - [Int] _moveDelegates #
    - [Int] _writeCheckpoint #
    - [Int] safe32
    - [Int] getChainId

 +  ReentrancyGuard 
    - [Int] Constructor #

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

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

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

 +  MasterChef (Ownable, ReentrancyGuard)
    - [Pub] Constructor #
    - [Ext] poolLength
    - [Ext] getPoolIdForLpToken
    - [Pub] add #
       - modifiers: onlyOwner,nonDuplicated
    - [Pub] set #
       - modifiers: onlyOwner
    - [Pub] getMultiplier
    - [Ext] pendingRadium
    - [Pub] canHarvest
    - [Pub] getHarvestUntil
    - [Pub] massUpdatePools #
    - [Pub] updatePool #
    - [Pub] deposit #
       - modifiers: nonReentrant
    - [Pub] deposit #
       - modifiers: nonReentrant
    - [Pub] withdraw #
       - modifiers: nonReentrant
    - [Int] payOrLockupPendingRadium #
    - [Pub] emergencyWithdraw #
       - modifiers: nonReentrant
    - [Int] safeRadiumTransfer #
    - [Pub] setDevAddress #
    - [Pub] setFeeAddress #
    - [Pub] updateEmissionRate #
       - modifiers: onlyOwner
    - [Int] setReferral #
    - [Pub] getReferral
    - [Int] payReferralCommission #
    - [Pub] updateReferralBonusBp #
       - modifiers: onlyOwner