Start Vesting

Smart Contract Audit Report

Audit Summary

Starter Labs is building a new ERC-20 token, staking, and token locking platform across chains, including BASE and PulseChain.

For this audit, we reviewed the following contracts:

Audit Findings

Informational findings were identified and the team may want to review them. In addition, some centralized aspects are present.
Date: July 7th, 2023.
Updated: August 14th, 2023 to reflect updates made to the contracts by the project team.

Finding #1 - Locker - High (Resolved)

Description: The lockTokens() function enables users to lock any specified token address; however, it does not include logic to support fee-on-transfer tokens. When locking a fee-on-transfer token, the assigned tokenAmount for the lock will be greater than the actual amount transferred to the contract.
Risk/Impact: When the withdrawal address unlocks these tokens, the function will attempt to transfer a greater number of tokens than what was initially transferred to the contract. As a result, the transaction will either fail if the contract lacks a sufficient token balance or a portion of the withdrawn tokens will be funded by another user's lock.
Recommendation: The team should add fee-on-transfer support logic to the lockTokens() function by setting tokenAmount as the difference between the contract's token balance before and after the token transfer occurs.
Resolution: The team has implemented the above recommendation.

Finding #2 - Locker - Low (Resolved)

Description: The withdrawTokens() function is vulnerable to reentrancy attacks if the tokenAddress assigned to a lock is an ERC-777 compliant token.
Risk/Impact: If the same ERC-777 compliant token is locked by more than one user, a withdrawal address can reenter the withdrawTokens() function by use of the token's fallback function. This would allow the user to withdraw more tokens from the contract than they have locked, resulting in the theft of tokens that were locked by other users.
Recommendation: The logic in the withdrawTokens() function should be modified to follow the Checks-Effects-Interactions pattern by setting withdrawn to true before the transfer occurs as follows:
function withdrawTokens(uint256 _id) public {

...

require(!lockedToken[_id].withdrawn, "Tokens already withdrawn");
lockedToken[_id].withdrawn = true;

require(
    IERC20(lockedToken[_id].tokenAddress).transfer(
        msg.sender,
        lockedToken[_id].tokenAmount
    ),
    "Transfer of tokens failed"
);  
Resolution: The team has implemented the above recommendation.

Finding #3 - LockerStaking - Informational

Description: The !address(msg.sender).isContract() check in the unstake() function can be bypassed by a contract's constructor technically allowing contracts to unstake.
Recommendation: The team could replace the !address(msg.sender).isContract() check in the unstake() function with the following logic to fully prevent contracts from being able to unstake:
require(tx.origin == msg.sender, "Please use your individual account");

Finding #4 - LockerStaking & Locker - Informational

Description: Although the SafeMath library is utilized, the contract is implemented with Solidity v0.8.x which has built-in overflow checks.
Recommendation: SafeMath could be safely removed to reduce contract size and deployment costs, and increase gas savings on all transactions that reference it.

Contracts Overview

StartOnPulse Contract:
  • The total supply of the token is set to 100 million $START [100,000,000].
  • No mint or burn functions are publicly accessible, though the circulating supply can be decreased by sending tokens to the 0x..dead address.
  • The owner can withdraw any tokens erroneously sent to the contract at any time.
  • There are no fees associated with transferring tokens.
  • The contract complies with the ERC-20 token standard.
StartOnBase Contract:
  • The total supply of the token is set to 100 million $BUIDL [100,000,000].
  • No mint or burn functions are publicly accessible, though the circulating supply can be decreased by sending tokens to the 0x..dead address.
  • The owner can withdraw any tokens erroneously sent to the contract at any time.
  • There are no fees associated with transferring tokens.
  • The contract complies with the ERC-20 token standard.
LockerStaking Contract:
  • Any user can specify a number of tokens to deposit into the contract at any time. The caller must grant the contract a sufficient allowance in order for the deposit to successfully occur.
  • Users that have deposited tokens can specify a number of tokens to withdraw at any time. Contracts are intended to be prohibited from withdrawing tokens.
  • A percentage of the withdrawal amount is deducted and sent to the 0x..dead address based on the contract's fee cycle in relation to the caller's last unstake time.
  • The owner can set the Burn fee for any index to any value up to 10% at any time.
  • The owner can set the Burn cycle time for any index to any value at any time.
  • The contract utilizes ReentrancyGuard to prevent reentrancy attacks in applicable functions.
Locker Contract:
  • Any user can initiate a lock by specifying a token address, a number of tokens to lock, an unlock time, and a withdrawal address.
  • 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 lock to successfully occur.
  • If the withdrawal address's current total number of tokens staked in the LockerStaking contract does not exceed the minimum stake amount set by the owner, a lock fee is charged and deducted from the lock amount.
  • The lock fee is stored on behalf of the token address.
  • Any user that has staked tokens in the LockerStaking contract can specify a token address to claim rewards for. The number of tokens sent to the user is based on their total number of staked tokens in the LockerStaking contract, the amount of fees collected for the specified token, and the total number of staked tokens in the LockerStaking contract by all users.
  • Each user is only permitted to successfully initiate claims one time per token address.
  • The withdrawal address assigned to a lock may withdraw the full locked amount after the unlock time associated with the lock has passed.
  • The full number of tokens are transferred from the contract to the withdrawal address.
  • The owner can set the contract's lock fee percentage to any value up to 5% at any time.
  • The owner can set the minimum stake amount to any value at any time.

Audit Results

Vulnerability Category Notes Result
Arbitrary Jump/Storage Write N/A PASS
Centralization of Control N/A 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
Sybil Attack N/A PASS
Unbounded Loops N/A PASS
Unused Code N/A PASS
Overall Contract Safety   PASS

StartOnPulse, Locker, and LockerStaking Contracts

Smart Contract Audit - Inheritance

Smart Contract Audit - Graph


 ($) = payable function
 # = non-constant function
 
 Int = Internal
 Ext = External
 Pub = Public
 
 + [Int] IERC20 
    - [Ext] totalSupply
    - [Ext] balanceOf
    - [Ext] transfer #
    - [Ext] allowance
    - [Ext] approve #
    - [Ext] transferFrom #

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

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

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

 + [Int] IERC20Metadata (IERC20)
    - [Ext] name
    - [Ext] symbol
    - [Ext] decimals

 +  ERC20 (Context, IERC20, IERC20Metadata)
    - [Pub]  #
    - [Pub] name
    - [Pub] symbol
    - [Pub] decimals
    - [Pub] totalSupply
    - [Pub] balanceOf
    - [Pub] transfer #
    - [Pub] allowance
    - [Pub] approve #
    - [Pub] transferFrom #
    - [Pub] increaseAllowance #
    - [Pub] decreaseAllowance #
    - [Int] _transfer #
    - [Int] _mint #
    - [Int] _burn #
    - [Int] _approve #
    - [Int] _spendAllowance #
    - [Int] _beforeTokenTransfer #
    - [Int] _afterTokenTransfer #

 +  StartOnPulse (ERC20, Ownable)
    - [Pub]  #
       - modifiers: ERC20
    - [Pub] recoverERC20 #
       - modifiers: onlyOwner

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

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

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

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

 +  LockerStaking (ReentrancyGuard, Ownable)
    - [Pub]  #
    - [Pub] stake #
       - modifiers: nonReentrant
    - [Ext] unstake #
       - modifiers: nonReentrant
    - [Pub] getBurnFee
    - [Ext] setBurnFee #
       - modifiers: onlyOwner
    - [Ext] setBurnCycle #
       - modifiers: onlyOwner

 +  Locker (Ownable)
    - [Pub]  #
    - [Pub] lockTokens #
    - [Pub] withdrawTokens #
    - [Pub] pendingRewards
    - [Pub] claimFee #
    - [Pub] getTotalTokenBalance
    - [Pub] getTokenBalanceByAddress
    - [Pub] getAllDepositIds
    - [Pub] getDepositDetails
    - [Pub] getDepositsByWithdrawalAddress
    - [Ext] setFeePercentage #
       - modifiers: onlyOwner
    - [Ext] setMinStakeAmount #
       - modifiers: onlyOwner

StartOnBase Contract

Smart Contract Audit - Inheritance

Smart Contract Audit - Graph


 ($) = payable function
 # = non-constant function
 
 Int = Internal
 Ext = External
 Pub = Public
 
 + [Int] IERC20 
    - [Ext] totalSupply
    - [Ext] balanceOf
    - [Ext] transfer #
    - [Ext] allowance
    - [Ext] approve #
    - [Ext] transferFrom #

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

 + [Int] IERC20Metadata (IERC20)
    - [Ext] name
    - [Ext] symbol
    - [Ext] decimals

 +  ERC20 (Context, IERC20, IERC20Metadata)
    - [Pub]  #
    - [Pub] name
    - [Pub] symbol
    - [Pub] decimals
    - [Pub] totalSupply
    - [Pub] balanceOf
    - [Pub] transfer #
    - [Pub] allowance
    - [Pub] approve #
    - [Pub] transferFrom #
    - [Pub] increaseAllowance #
    - [Pub] decreaseAllowance #
    - [Int] _transfer #
    - [Int] _mint #
    - [Int] _burn #
    - [Int] _approve #
    - [Int] _spendAllowance #
    - [Int] _beforeTokenTransfer #
    - [Int] _afterTokenTransfer #

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

 +  StartOnBase (ERC20, Ownable)
    - [Pub]  #
       - modifiers: ERC20
    - [Pub] recoverERC20 #
       - modifiers: onlyOwner

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.