Tokenik

Smart Contract Audit Report

Audit Summary

Tokenik Audit Report Tokenik is building a new platform where users can claim token airdrops and stake tokens to earn rewards.

For this audit, we reviewed the project team's TokenikV1Rewards contract at 0x086b656140B30f53fE886023E971a4A5Beffe54F and TokenikV1StakingRNIK contract at 0xDFF9fF80Fc9AcAd74b29CdA886889FE0f6cF45cF on the Ethereum Mainnet.

Audit Findings

Medium findings were identified and the team should resolve these issues. In addition, centralized aspects are present.
Date: November 10th, 2022.
updated: November 14th, 2022 to reflect the project's newly deployed Mainnet addresses.

Finding #1 - TokenikV1Rewards - Medium (Acknowledged)

Description: The claimAirdrop() function is susceptible to a Sybil attack.
Risk/Impact: A malicious user can perform a Sybil attack by creating an unlimited number of wallet addresses and subsequently claiming the contract's airdropAmount value in each created address.
Recommendation: The team must implement a method to prevent abuse by malicious actors. This can take the form of a whitelist/Merkle tree that stores addresses that are verified to claim airdrops, or it can be addressed by introducing economic costs such as requiring addresses to lock some sort of value for a period of time.
Update: The team acknowledges that users may claim the airdrop from several wallets, but has opted not to use a whitelist in order to provide an open and fair opportunity for all users.

Contracts Overview

  • As the contracts are deployed with Solidity v0.8.7, they are safe from any possible overflows/underflows.
TokenikV1Rewards Contract:
  • The deployer of the contract is added as an approved caller.
  • Any approved caller can allocate any number of reward tokens to any user when the add-reward functionality is enabled by the team.
  • Any approved caller can add swap-rewards by specifying a token address that has been pre-approved by the owner. 1% of the specified number of tokens is allocated to the user.
  • Any approved caller can add liquidity-rewards by specifying two token addresses and two reward amount values.
  • When the first token is pre-approved by the owner, the full first reward amount value is allocated to the user.
  • When the first token is not pre-approved by the owner but the second token is, the full second reward amount value is allocated to the user.
  • Any approved caller can remove any number of reward tokens from any user's balance when the remove-reward functionality is enabled by the team.
  • Any approved caller can remove any number of swap-reward tokens from any user's balance when the remove-reward functionality is enabled by the team.
  • Any user can claim an Airdrop one time which will allocate 250 reward tokens to their address.
  • Users can elect to include a referral address when claiming. Both the user and referral address will receive an extra 50 reward tokens.
  • The deployer of the contract will be granted the Caller Setter role upon deployment.
  • The Caller Setter can add/remove addresses as an approved caller at any time.
  • The Caller Setter can add/remove addresses as an approved token at any time.
  • The Caller Setter can pause/unpause the adding and removing of rewards at any time.
  • The Caller Setter can set the default airdrop amount and default referral amount to any values at any time.
  • The Caller Setter can enable/disable airdrops at any time.
TokenikV1StakingRNIK Contract:
  • Any user can stake tokens into the contract in order to earn rewards.
  • The number of staked tokens is removed from the user's reward balance in the TokenikV1Rewards contract.
  • Users can begin unstaking and claiming rewards once the minimum stake duration set by the owner has passed since the user's previous stake.
  • The number of rewards due to the user is based on the APY percentage set by the team and the amount of time that has passed since staking tokens.
  • User rewards are added to their reward balance in the TokenikV1Rewards contract.
  • The Caller Setter can update the TokenikV1Rewards address at any time.
  • The Caller Setter can increase the APY percentage at any time.
  • The Caller Setter can set the minimum stake duration to any value at any time.
  • The Caller Setter can pause/unpause staking at any time.
  • The Caller Setter can set the staking close date to any value at any time.

Audit Results

Vulnerability Category Notes Result
Arbitrary Jump/Storage Write N/A PASS
Centralization of Control Any approved caller can remove any number of reward tokens from any user's balance in the TokenikV1Rewards contract. WARNING
Compiler Issues N/A PASS
Delegate Call to Untrusted Contract N/A PASS
Dependence on Predictable Variables N/A PASS
Ether/Token Theft N/A PASS
Flash Loans N/A PASS
Front Running N/A PASS
Improper Events N/A PASS
Improper Authorization Scheme N/A PASS
Integer Over/Underflow N/A PASS
Logical Issues N/A PASS
Oracle Issues N/A PASS
Outdated Compiler Version N/A PASS
Race Conditions N/A PASS
Reentrancy N/A PASS
Signature Issues N/A PASS
Sybil Attack The claimAirdrop() function in the TokenikV1Rewards contract is susceptible to a Sybil attack. WARNING
Unbounded Loops N/A PASS
Unused Code N/A PASS
Overall Contract Safety   PASS

TokenikV1Rewards Contract

Smart Contract Audit - Inheritance

Smart Contract Audit - Graph


 ($) = payable function
 # = non-constant function
 
 Int = Internal
 Ext = External
 Pub = Public
 
 + [Int] ITokenikV1Rewards 
    - [Ext] addReward #
    - [Ext] addSwapReward #
    - [Ext] removeReward #
    - [Ext] claimAirdrop #
    - [Ext] getRewards
    - [Ext] getClaimedAirdrop
    - [Ext] getApprovedCaller
    - [Ext] setCallerSetter #
    - [Ext] setApprovedCaller #
    - [Ext] setAddRewardPaused #
    - [Ext] setRemoveRewardPaused #
    - [Ext] setAirdropAmounts #
    - [Ext] enableAirdrop #
    - [Ext] addLiquidityReward #
    - [Ext] removeSwapReward #
    - [Ext] getApprovedToken
    - [Ext] getApprovedTokens
    - [Ext] setApprovedTokens #

 +  TokenikV1Rewards (ITokenikV1Rewards)
    - [Pub]  #
    - [Ext] addReward #
       - modifiers: onlyCaller
    - [Ext] addSwapReward #
       - modifiers: onlyCaller
    - [Ext] addLiquidityReward #
       - modifiers: onlyCaller
    - [Ext] removeReward #
       - modifiers: onlyCaller
    - [Ext] removeSwapReward #
       - modifiers: onlyCaller
    - [Ext] claimAirdrop #
    - [Ext] getRewards
    - [Ext] getClaimedAirdrop
    - [Ext] getApprovedCaller
    - [Ext] getApprovedToken
    - [Ext] getApprovedTokens
    - [Ext] setCallerSetter #
       - modifiers: onlySetter
    - [Ext] setApprovedCaller #
       - modifiers: onlySetter
    - [Ext] setApprovedTokens #
       - modifiers: onlySetter
    - [Ext] setAddRewardPaused #
       - modifiers: onlySetter
    - [Ext] setRemoveRewardPaused #
       - modifiers: onlySetter
    - [Ext] setAirdropAmounts #
       - modifiers: onlySetter
    - [Ext] enableAirdrop #
       - modifiers: onlySetter

TokenikV1StakingRNIK Contract

Smart Contract Audit - Inheritance

Smart Contract Audit - Graph


 ($) = payable function
 # = non-constant function
 
 Int = Internal
 Ext = External
 Pub = Public
 
 + [Int] ITokenikV1StakingRNIK 
    - [Ext] rewards
    - [Ext] stakingApy
    - [Ext] apySetter
    - [Ext] minStakeDuration
    - [Ext] stakingOpen
    - [Ext] stakingCloseDate
    - [Ext] totalStaked
    - [Ext] stakeRNIK #
    - [Ext] unstakeRNIK #
    - [Ext] getInterest
    - [Ext] getUserStake
    - [Ext] setRewardsAddress #
    - [Ext] setApySetter #
    - [Ext] setStakingApy #
    - [Ext] setMinStakeDuration #
    - [Ext] setStakingOpen #
    - [Ext] setStakingCloseDate #

 + [Int] ITokenikV1Rewards 
    - [Ext] addReward #
    - [Ext] addSwapReward #
    - [Ext] removeReward #
    - [Ext] claimAirdrop #
    - [Ext] getRewards
    - [Ext] getClaimedAirdrop
    - [Ext] getApprovedCaller
    - [Ext] setCallerSetter #
    - [Ext] setApprovedCaller #
    - [Ext] setAddRewardPaused #
    - [Ext] setRemoveRewardPaused #
    - [Ext] setAirdropAmounts #
    - [Ext] enableAirdrop #
    - [Ext] addLiquidityReward #
    - [Ext] removeSwapReward #
    - [Ext] getApprovedToken
    - [Ext] getApprovedTokens
    - [Ext] setApprovedTokens #

 +  TokenikV1StakingRNIK (ITokenikV1StakingRNIK)
    - [Pub]  #
    - [Ext] stakeRNIK #
    - [Ext] unstakeRNIK #
    - [Int] getInterestInternal
    - [Ext] getInterest
    - [Ext] getUserStake
    - [Ext] setRewardsAddress #
       - modifiers: onlySetter
    - [Ext] setApySetter #
       - modifiers: onlySetter
    - [Ext] setStakingApy #
       - modifiers: onlySetter
    - [Ext] setMinStakeDuration #
       - modifiers: onlySetter
    - [Ext] setStakingOpen #
       - modifiers: onlySetter
    - [Ext] setStakingCloseDate #
       - modifiers: onlySetter

About SourceHat

SourceHat has quickly grown to have one of the most experienced and well-equipped smart contract auditing teams in the industry. Our team has conducted 1300+ 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 SourceHat Audit?

Typically, a smart contract audit is a comprehensive review process designed to discover logical errors, security vulnerabilities, and optimization opportunities within code. A SourceHat 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.