Finceptor Staking

Smart Contract Audit Report

Audit Summary

Finceptor Staking Audit Report Finceptor Staking is a new platform where users can stake tokens and earn rewards.

For this audit, we reviewed the project team's LockedStaking contract at commit 1974309ae296b85638406c0ba3911be0d17b5c90 on the team's private GitHub repository.

Audit Findings

All findings have been resolved, though some centralized aspects are present.
Date: January 9th, 2024.
Updated: January 10th, 2024 to reflect updates made to the contract that resolves all Findings.

Finding #1 - LockedStaking - Low (Resolved)

Description: The isActive boolean status assigned to each staking pool is not enforced in the stake() function.
Risk/Impact: Users are permitted to stake tokens into pools that are set as inactive.
Recommendation: The stake() function should be modified to prohibit users from staking into pools that are set as inactive.
Resolution: The team has implemented the above recommendation.

Finding #2 - LockedStaking - Informational (Resolved)

Description: The setFeeDetails() function allows the owner to update the withdrawFee state variable, however this state variable is not used in the contract.
Recommendation: The withdrawFee state variable should either be removed for additional gas savings or utilized in a way that fits the project team's intended functionality.
Resolution: The team has removed the withdrawFee state variable from the contract.

Contract Overview

  • Upon deployment, the deployer will specify the Staking token address, Staking Bank address, and a list of staking pools that will automatically be set as active.
  • The team must exercise caution to avoid assigning a fee-on-transfer token as the contract's Staking token. If a fee-on-transfer token is used, the contract must be exempt from the token's fee mechanism.
  • Any user can initiate a deposit by specifying a number of tokens to stake into a desired Staking pool.
  • The specified number of tokens are transferred from the caller to the contract. The caller must grant the contract a sufficient allowance in order for the transaction to successfully occur.
  • The total number of active stakes per user must not exceed the maximum limit set by the owner.
  • A Staking fee is deducted from the deposit amount and allocated to the Fee Recipient address set by the owner. If the Fee Recipient address is not set, these tokens will remain locked in the contract.
  • An unlock time and reward amount are assigned to each stake based on the duration and APR values of the relevant staking pool.
  • Any user that has staked tokens can initiate a withdrawal after at least 1 of the unlock times assigned to any of their active stakes has been reached.
  • The total number of staked tokens for each unlocked stake is transferred from the contract back to the caller.
  • The total reward amount for each unlocked stake is transferred from the Staking Bank address to the caller. The team must ensure the Staking Bank address has a sufficient token balance to support claiming (and withdrawals) for all users.
  • The owner can initiate an emergency exit at any time by specifying a list of users. The full number of staked tokens for each user is withdrawn and transferred to their wallet address forfeiting any potential rewards.
  • The owner can set the Staking fee to any value up to 100% at any time.
  • The owner can add a new staking pool at any time by specifying the pool's duration, APR value, and allocation boost value.
  • The owner can set any staking pool as active or inactive at any time.
  • The owner can update the APR and Allocation boost values assigned to a staking pool to any values at any time.
  • The owner can pause/unpause the contract at any time. When paused, all staking transactions are prohibited from occurring.
  • The owner can set the maximum limit of active stakes per user to any value at any time.
  • The owner can set the Staking Bank address to any address at any time.
  • The owner can set the Fee Recipient address to any address at any time.
  • The contract utilizes ReentrancyGuard to prevent reentrancy attacks in applicable functions.
  • As the contract is implemented with Solidity v0.8.x, it is safe from any possible overflows/underflows.

Audit Results

Vulnerability Category Notes Result
Arbitrary Jump/Storage Write N/A PASS
Centralization of Control
  • The owner can set the Staking fee to any value up to 100% at any time.
  • The team must ensure the Staking Bank address has a sufficient token balance to support claiming (and withdrawals) for all users.
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 N/A PASS
Unbounded Loops N/A PASS
Unused Code N/A PASS
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

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

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

 +  Pausable (Context)
    - [Pub]  #
    - [Pub] paused
    - [Int] _requireNotPaused
    - [Int] _requirePaused
    - [Int] _pause #
       - modifiers: whenNotPaused
    - [Int] _unpause #
       - modifiers: whenPaused

 +  ReentrancyGuard 
    - [Pub]  #
    - [Prv] _nonReentrantBefore #
    - [Prv] _nonReentrantAfter #
    - [Int] _reentrancyGuardEntered

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

 + [Int] IERC20Permit 
    - [Ext] permit #
    - [Ext] nonces
    - [Ext] DOMAIN_SEPARATOR

 + [Lib] Address 
    - [Int] sendValue #
    - [Int] functionCall #
    - [Int] functionCall #
    - [Int] functionCallWithValue #
    - [Int] functionCallWithValue #
    - [Int] functionStaticCall
    - [Int] functionStaticCall
    - [Int] functionDelegateCall #
    - [Int] functionDelegateCall #
    - [Int] verifyCallResultFromTarget
    - [Int] verifyCallResult
    - [Int] verifyCallResult
    - [Int] defaultRevert
    - [Prv] _revert

 + [Lib] SafeERC20 
    - [Int] safeTransfer #
    - [Int] safeTransferFrom #
    - [Int] safeIncreaseAllowance #
    - [Int] safeDecreaseAllowance #
    - [Int] forceApprove #
    - [Int] safePermit #
    - [Prv] _callOptionalReturn #
    - [Prv] _callOptionalReturnBool #

 + [Lib] EnumerableSet 
    - [Prv] _add #
    - [Prv] _remove #
    - [Prv] _contains
    - [Prv] _length
    - [Prv] _at
    - [Prv] _values
    - [Int] add #
    - [Int] remove #
    - [Int] contains
    - [Int] length
    - [Int] at
    - [Int] values
    - [Int] add #
    - [Int] remove #
    - [Int] contains
    - [Int] length
    - [Int] at
    - [Int] values
    - [Int] add #
    - [Int] remove #
    - [Int] contains
    - [Int] length
    - [Int] at
    - [Int] values

 + [Lib] EnumerableMap 
    - [Int] set #
    - [Int] remove #
    - [Int] contains
    - [Int] length
    - [Int] at
    - [Int] tryGet
    - [Int] get
    - [Int] keys
    - [Int] set #
    - [Int] remove #
    - [Int] contains
    - [Int] length
    - [Int] at
    - [Int] tryGet
    - [Int] get
    - [Int] keys
    - [Int] set #
    - [Int] remove #
    - [Int] contains
    - [Int] length
    - [Int] at
    - [Int] tryGet
    - [Int] get
    - [Int] keys
    - [Int] set #
    - [Int] remove #
    - [Int] contains
    - [Int] length
    - [Int] at
    - [Int] tryGet
    - [Int] get
    - [Int] keys
    - [Int] set #
    - [Int] remove #
    - [Int] contains
    - [Int] length
    - [Int] at
    - [Int] tryGet
    - [Int] get
    - [Int] keys

 + [Int] ILockedStaking 
    - [Ext] stake #
    - [Ext] withdraw #
    - [Ext] pools
    - [Ext] poolAt
    - [Ext] stakedOf
    - [Ext] stakeInstancesOf
    - [Ext] rewardOf
    - [Ext] claimableOf
    - [Ext] totalBoostedStakeOf
    - [Ext] totalStaked
    - [Ext] participantCount
    - [Ext] addresses

 +  LockedStaking (ILockedStaking, Ownable, Pausable, ReentrancyGuard)
    - [Pub]  #
    - [Ext] emergencyExit #
       - modifiers: nonReentrant,onlyOwner
    - [Ext] disablePool #
       - modifiers: onlyOwner
    - [Ext] enablePool #
       - modifiers: onlyOwner
    - [Ext] addPool #
       - modifiers: onlyOwner
    - [Ext] updateMaxStakeInstanceCount #
       - modifiers: onlyOwner
    - [Ext] pause #
       - modifiers: onlyOwner
    - [Ext] unpause #
       - modifiers: onlyOwner
    - [Ext] updateStakingBank #
       - modifiers: onlyOwner
    - [Ext] setFeeDetails #
       - modifiers: onlyOwner
    - [Ext] updateAprs #
       - modifiers: onlyOwner
    - [Ext] updateBoosts #
       - modifiers: onlyOwner
    - [Ext] stake #
       - modifiers: nonReentrant,whenNotPaused
    - [Pub] withdraw #
       - modifiers: nonReentrant
    - [Ext] poolAt
    - [Ext] pools
    - [Ext] participantCount
    - [Ext] addresses
    - [Ext] stakedOf
    - [Ext] stakeInstancesOf
    - [Ext] rewardOf
    - [Ext] claimableOf
    - [Ext] totalBoostedStakeOf
    - [Ext] totalStaked

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 1800+ 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!
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.