LaunchBlockPad

Smart Contract Audit Report

Audit Summary

LaunchBlock Audit Report LaunchBlock is building a new tiered investment system allowing users to invest in new projects at an early stage.

For this audit, we reviewed the LockedLBToken and Sale contracts provided to us by the project team.

We previously reviewed the project team's token contract here.

Audit Findings

Informational findings were identified and the team may want to review them. In addition, centralized aspects are present.
Date: January 11th, 2022.

Finding #1 - PoolDepositable - Informational

Description: Expensive looping is used when searching for the index of a pool deposit in the _indexOfPoolDeposit() function within the PoolDepositable contract.
Risk/Impact: Execution costs will increase with the number of unique pools the user has deposited in.
Recommendation: The team should consider using a double mapping instead of an array to track pool deposits as is is a more gas-efficient and less error-prone approach.

Contracts Overview

  • Both contracts are implemented using the Authorizable permission scheme.
  • This allows the contract owner to set various "roles" within the contract with each role having potentially different permissions.
  • The deployer is given the Default Admin role upon deployment.
  • The Default Admin may assign any role to any address at any time.
  • As the contracts are implemented in Solidity version 0.8.X, they are protected from overflows.
LockedLBToken Contract:
  • Any user may use this contract to deposit a specified token into any pool that is currently in "open" status.
  • Users may withdraw from the pool at any time, after the lock duration from the user's most recent deposit has passed.
  • Each user is placed in various "tiers" once they have reached the minimum deposit amount for a tier.
  • The Default Admin may elect to batch deposit in bulk on the behalf of users.
  • The Default Admin may add a pool and update the pool's lock duration and open/closed status at any time.
  • The Default Admin may update the designated token as long as there are currently no tokens deposited.
  • The Default Admin may change the minimum amount required for each tier at any time.
  • The Pauser Role may suspend the contract, disabling all withdrawal and deposit functionality at any time.
Sale Contract:
  • Any user may use this contract to deposit a specified token between the start and end period.
  • A signed message hash from a member of the Authorizer role must accompany any deposit for verification.
  • Each user has a maximum deposit limit based on their assigned tier in the specified token contract.
  • There is an additional maximum deposit limit for the total amount deposited into the contract.
  • The Collector role may withdraw all of the specified token deposited into the contract when the contract end period has passed.
  • The Default Admin may change the start date to any value before the end date at any time.
  • The Default Admin may change the end date to any value before the start date at any time.
  • The Default Admin may change the deposit limit per tier at any time.
  • The Default Admin may update the designated token as long as there are currently no tokens deposited.
  • The Default Admin may update the total deposit limit at any time.
  • The Pauser Role may suspend the contract, disabling all deposit and withdrawal functionality at any time.

Audit Results

Vulnerability Category Notes Result
Arbitrary Jump/Storage Write N/A PASS
Centralization of Control
  • The team retains ownership functionality described above.
  • Generating signed messages requires off-chain logic.
PASS
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
Unbounded Loops N/A PASS
Unused Code N/A PASS
Overall Contract Safety   PASS

LockedLBToken Contract

Smart Contract Audit - Inheritance

Smart Contract Audit - Graph


 ($) = payable function
 # = non-constant function
 
 Int = Internal
 Ext = External
 Pub = Public
 
 + [Lib] AddressUpgradeable 
    - [Int] isContract
    - [Int] sendValue #
    - [Int] functionCall #
    - [Int] functionCall #
    - [Int] functionCallWithValue #
    - [Int] functionCallWithValue #
    - [Int] functionStaticCall
    - [Int] functionStaticCall
    - [Int] verifyCallResult

 +  Initializable 
    - [Prv] _isConstructor

 + [Int] IAccessControlUpgradeable 
    - [Ext] hasRole
    - [Ext] getRoleAdmin
    - [Ext] grantRole #
    - [Ext] revokeRole #
    - [Ext] renounceRole #

 +  ContextUpgradeable (Initializable)
    - [Int] __Context_init #
       - modifiers: onlyInitializing
    - [Int] __Context_init_unchained #
       - modifiers: onlyInitializing
    - [Int] _msgSender
    - [Int] _msgData

 + [Lib] StringsUpgradeable 
    - [Int] toString
    - [Int] toHexString
    - [Int] toHexString

 + [Int] IERC165Upgradeable 
    - [Ext] supportsInterface

 +  ERC165Upgradeable (Initializable, IERC165Upgradeable)
    - [Int] __ERC165_init #
       - modifiers: onlyInitializing
    - [Int] __ERC165_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] supportsInterface

 +  AccessControlUpgradeable (Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable)
    - [Int] __AccessControl_init #
       - modifiers: onlyInitializing
    - [Int] __AccessControl_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] supportsInterface
    - [Pub] hasRole
    - [Int] _checkRole
    - [Pub] getRoleAdmin
    - [Pub] grantRole #
       - modifiers: onlyRole
    - [Pub] revokeRole #
       - modifiers: onlyRole
    - [Pub] renounceRole #
    - [Int] _setupRole #
    - [Int] _setRoleAdmin #
    - [Int] _grantRole #
    - [Int] _revokeRole #

 + [Lib] SafeMathUpgradeable 
    - [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

 +  Poolable (Initializable, AccessControlUpgradeable)
    - [Int] __Poolable_init #
       - modifiers: onlyInitializing
    - [Int] __Poolable_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] getPool
    - [Ext] addPool #
       - modifiers: onlyRole
    - [Ext] updatePool #
       - modifiers: onlyRole

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

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

 +  Depositable (Initializable, AccessControlUpgradeable)
    - [Int] __Depositable_init #
       - modifiers: onlyInitializing
    - [Int] __Depositable_init_unchained #
       - modifiers: onlyInitializing
    - [Int] _deposit #
    - [Int] _withdraw #
    - [Pub] depositOf
    - [Ext] changeDepositToken #
       - modifiers: onlyRole

 +  PoolDepositable (Initializable, AccessControlUpgradeable, Poolable, Depositable)
    - [Int] __PoolDepositable_init #
       - modifiers: onlyInitializing
    - [Int] __PoolDepositable_init_unchained #
       - modifiers: onlyInitializing
    - [Prv] _indexOfPoolDeposit
    - [Pub] poolDepositsOf
    - [Ext] poolDepositOf
    - [Int] _deposit
    - [Int] _withdraw
    - [Int] _deposit #
       - modifiers: whenPoolOpened
    - [Prv] _withdrawPoolDeposit #
       - modifiers: whenUnlocked
    - [Int] _withdraw #
    - [Ext] batchDeposits #
       - modifiers: onlyRole

 + [Int] ITierable 
    - [Ext] tierOf #

 +  Tierable (Initializable, AccessControlUpgradeable, Depositable, ITierable)
    - [Int] __Tierable_init #
       - modifiers: onlyInitializing
    - [Int] __Tierable_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] tierOf
    - [Ext] changeTiersMinAmount #
       - modifiers: onlyRole
    - [Ext] getTiersMinAmount

 +  PausableUpgradeable (Initializable, ContextUpgradeable)
    - [Int] __Pausable_init #
       - modifiers: onlyInitializing
    - [Int] __Pausable_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] paused
    - [Int] _pause #
       - modifiers: whenNotPaused
    - [Int] _unpause #
       - modifiers: whenPaused

 +  Suspendable (Initializable, AccessControlUpgradeable, PausableUpgradeable)
    - [Int] __Suspendable_init #
       - modifiers: onlyInitializing
    - [Int] __Suspendable_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] suspended
    - [Ext] suspend #
       - modifiers: onlyRole
    - [Ext] resume #
       - modifiers: onlyRole

 +  LockedLBToken (Initializable, PoolDepositable, Tierable, Suspendable)
    - [Ext] initialize #
       - modifiers: initializer
    - [Int] __LockedLBToken_init_unchained #
       - modifiers: onlyInitializing
    - [Int] _deposit
    - [Int] _withdraw
    - [Ext] deposit #
       - modifiers: whenNotPaused
    - [Ext] withdraw #
       - modifiers: whenNotPaused

Sale Contract

Smart Contract Audit - Inheritance

Smart Contract Audit - Graph


 ($) = payable function
 # = non-constant function
 
 Int = Internal
 Ext = External
 Pub = Public
 
 + [Lib] AddressUpgradeable 
    - [Int] isContract
    - [Int] sendValue #
    - [Int] functionCall #
    - [Int] functionCall #
    - [Int] functionCallWithValue #
    - [Int] functionCallWithValue #
    - [Int] functionStaticCall
    - [Int] functionStaticCall
    - [Int] verifyCallResult

 +  Initializable 
    - [Prv] _isConstructor

 + [Int] IAccessControlUpgradeable 
    - [Ext] hasRole
    - [Ext] getRoleAdmin
    - [Ext] grantRole #
    - [Ext] revokeRole #
    - [Ext] renounceRole #

 +  ContextUpgradeable (Initializable)
    - [Int] __Context_init #
       - modifiers: onlyInitializing
    - [Int] __Context_init_unchained #
       - modifiers: onlyInitializing
    - [Int] _msgSender
    - [Int] _msgData

 + [Int] IERC165Upgradeable 
    - [Ext] supportsInterface

 +  ERC165Upgradeable (Initializable, IERC165Upgradeable)
    - [Int] __ERC165_init #
       - modifiers: onlyInitializing
    - [Int] __ERC165_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] supportsInterface

 +  AccessControlUpgradeable (Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable)
    - [Int] __AccessControl_init #
       - modifiers: onlyInitializing
    - [Int] __AccessControl_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] supportsInterface
    - [Pub] hasRole
    - [Int] _checkRole
    - [Pub] getRoleAdmin
    - [Pub] grantRole #
       - modifiers: onlyRole
    - [Pub] revokeRole #
       - modifiers: onlyRole
    - [Pub] renounceRole #
    - [Int] _setupRole #
    - [Int] _setRoleAdmin #
    - [Int] _grantRole #
    - [Int] _revokeRole #

 + [Int] ITierable 
    - [Ext] tierOf #

 + [Lib] StringsUpgradeable 
    - [Int] toString
    - [Int] toHexString
    - [Int] toHexString

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

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

 + [Lib] SafeMathUpgradeable 
    - [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

 +  Depositable (Initializable, AccessControlUpgradeable)
    - [Int] __Depositable_init #
       - modifiers: onlyInitializing
    - [Int] __Depositable_init_unchained #
       - modifiers: onlyInitializing
    - [Int] _deposit #
    - [Int] _withdraw #
    - [Pub] depositOf
    - [Ext] changeDepositToken #
       - modifiers: onlyRole

 +  MaxDepositable (Initializable, AccessControlUpgradeable, Depositable)
    - [Int] __MaxDepositable_init #
       - modifiers: onlyInitializing
    - [Int] __MaxDepositable_init_unchained #
       - modifiers: onlyInitializing
    - [Int] _deposit #
       - modifiers: whenMaxDepositNotReached
    - [Ext] changeMaxTotalDeposited #
       - modifiers: onlyRole

 +  MaxTierDepositable (Initializable, AccessControlUpgradeable, Depositable)
    - [Int] __MaxTierDepositable_init #
       - modifiers: onlyInitializing
    - [Int] __MaxTierDepositable_init_unchained #
       - modifiers: onlyInitializing
    - [Int] _deposit #
       - modifiers: whenLessThanMaxTierDeposit
    - [Ext] changeTiersMaxDepositAmount #
       - modifiers: onlyRole
    - [Ext] getTiersMaxDepositAmount

 +  Schedulable (Initializable, AccessControlUpgradeable)
    - [Int] __Schedulable_init #
       - modifiers: onlyInitializing
    - [Int] __Schedulable_init_unchained #
       - modifiers: onlyInitializing
    - [Ext] changeStartDate #
       - modifiers: onlyRole
    - [Ext] changeEndDate #
       - modifiers: onlyRole

 +  PausableUpgradeable (Initializable, ContextUpgradeable)
    - [Int] __Pausable_init #
       - modifiers: onlyInitializing
    - [Int] __Pausable_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] paused
    - [Int] _pause #
       - modifiers: whenNotPaused
    - [Int] _unpause #
       - modifiers: whenPaused

 +  Suspendable (Initializable, AccessControlUpgradeable, PausableUpgradeable)
    - [Int] __Suspendable_init #
       - modifiers: onlyInitializing
    - [Int] __Suspendable_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] suspended
    - [Ext] suspend #
       - modifiers: onlyRole
    - [Ext] resume #
       - modifiers: onlyRole

 +  Collectable (Initializable, AccessControlUpgradeable, Depositable)
    - [Int] __Collectable_init #
       - modifiers: onlyInitializing
    - [Int] __Collectable_init_unchained #
       - modifiers: onlyInitializing
    - [Int] _collect #
       - modifiers: onlyRole

 + [Lib] ECDSAUpgradeable 
    - [Prv] _throwError
    - [Int] tryRecover
    - [Int] recover
    - [Int] tryRecover
    - [Int] recover
    - [Int] tryRecover
    - [Int] recover
    - [Int] toEthSignedMessageHash
    - [Int] toEthSignedMessageHash
    - [Int] toTypedDataHash

 +  EIP712Upgradeable (Initializable)
    - [Int] __EIP712_init #
       - modifiers: onlyInitializing
    - [Int] __EIP712_init_unchained #
       - modifiers: onlyInitializing
    - [Int] _domainSeparatorV4
    - [Prv] _buildDomainSeparator
    - [Int] _hashTypedDataV4
    - [Int] _EIP712NameHash
    - [Int] _EIP712VersionHash

 + [Int] IERC1271Upgradeable 
    - [Ext] isValidSignature

 + [Lib] SignatureCheckerUpgradeable 
    - [Int] isValidSignatureNow

 +  Authorizable (Initializable, AccessControlUpgradeable, EIP712Upgradeable)
    - [Int] __Authorizable_init #
       - modifiers: onlyInitializing
    - [Int] __Authorizable_init_unchained #
       - modifiers: onlyInitializing
    - [Int] isAuthorized
    - [Int] hashDepositPayload

 +  Sale (Initializable, AccessControlUpgradeable, Depositable, MaxDepositable, MaxTierDepositable, Schedulable, Suspendable, Collectable, Authorizable)
    - [Ext] initialize #
       - modifiers: initializer
    - [Int] __Sale_init_unchained #
       - modifiers: onlyInitializing
    - [Int] _deposit #
       - modifiers: whenMaxDepositNotReached
    - [Ext] deposit #
       - modifiers: whenOpened,whenNotPaused,whenAuthorized
    - [Ext] collect #
       - modifiers: whenClosed,whenNotPaused

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.