Bionic Bunny

Smart Contract Audit Report

Audit Summary

Bionic Bunny is a new ERC-20 token on Ethereum.

For this audit, we reviewed the project team's BionicBunny contract at 0x57eac3f4317c8c4f21246a58db9ff695f54a888b on the Ethereum Mainnet.

Audit Findings

All findings have been resolved, though some centralized aspects are present.
Date: June 16th, 2023.
Updated: June 21st, 2023 to reflect the contract's newly deployed Testnet address that resolves both Findings.
Updated: July 4th, 2023 to reflect the contract's newly deployed Mainnet address.

Finding #1 - BionicBunny - Low (Resolved)

Description: The distributeFeeNow() function is susceptible to front-running.
Risk/Impact: If there is a significant token balance in the contract, a user can perform a front-running attack by calling distributeFeeNow() to temporarily lower the token price via the swap's added supply, then subsequently purchase tokens at the cheaper price. The user can later profit by selling these tokens after the price recovers.
Recommendation: The team should set a limit to the number of tokens that can be swapped per transaction in the distributeFeeNow() function. The team should also ensure the minimumTokensBeforeSwap threshold is not set to more than 0.1% of the total supply. Additionally, the team should restrict the distributeFeeNow() function to only allow it to be called by the owner.
Resolution: The team has restricted the distributeFeeNow() function to only allow it to be called by the Manager. When using this function, the team should ensure that no more than 0.1% of the total supply is being swapped to mitigate any potential front-running impact.

Finding #2 - BionicBunny - Informational (Resolved)

Description: The following calculation performed in both the distributeFee() and distributeFeeNow() functions is redundant as 100% of transferredBalance will always be used since marketingFee and totalSwapFee will always be the same value.
if (marketingswapEnabled)
transferETHToAddress(
      payable(marketingWallet),
      transferredBalance * marketingFee/totalSwapFee
);
Recommendation: The team could modify the above logic in both functions as follows to simply send transferredBalance for additional gas savings on each call:
if (marketingswapEnabled)
transferETHToAddress(
      payable(marketingWallet),
      transferredBalance
);
Resolution: The team has implemented the above recommendation.

Contract Overview

  • The total supply of the token is currently 260 billion $SEXY [260,000,000,000].
  • No mint functions are present in the contract.
  • The owner can burn their own tokens to reduce the total supply at any time.
  • At the time of writing this report, there are 68 total token holders. The token allocation is as follows:

  • There is a 4% Marketing fee on all transfers via Uniswap where neither the sender nor the recipient is excluded from fees.
  • The tokens collected through the Marketing fee are stored in the contract address. The tokens are swapped for ETH and sent to the team's Marketing wallet when the following conditions are met:
    • The threshold number of 1 billion tokens in the contract has been reached.
    • The caller is not initiating a buy transaction via Uniswap.
    • The contract is not currently swapping tokens.
  • As the contract is deployed with Solidity v0.8.20, it is protected from overflows/underflows.
  • The contract complies with the ERC-20 token standard.
Ownership Controls:
  • Ownership has been renounced by the team.
  • The owner was previously able to set the Marketing fee to any percentage at any time.
  • The owner was previously able to exclude and include accounts from the Marketing fee at any time.
  • The owner was previously able to enable/disable the Marketing fee at any time.
  • The owner was previously able to update the threshold number of tokens that triggers the automatic token swapping and sending functionality to any value at any time.
  • The owner was previously able to enable/disable the automatic sending of ETH to the Marketing wallet at any time.
  • The owner was previously able to pause/unpause the contract at any time which disables all trading and ownership-restricted functionality.
  • The owner was previously able to set the Manager address to any address at any time.
  • The Manager address can withdraw any ETH or tokens from the contract at any time.
  • The Manager address can manually trigger the automatic token swapping functionality at any time.

Audit Results

Vulnerability Category Notes Result
Arbitrary Jump/Storage Write N/A PASS
Centralization of Control Ownership has been renounced by the team. 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 The automatic token swapping functionality may be susceptible to front-running. The team should monitor, and if any suspicious activity is detected, should lower the minimumTokensBeforeSwap threshold. 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

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

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

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

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

 +  Ownable (Context, Pausable)
    - [Pub]  #
    - [Pub] owner
    - [Pub] renounceOwnership #
       - modifiers: onlyOwner,whenNotPaused
    - [Pub] transferOwnership #
       - modifiers: onlyOwner,whenNotPaused

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

 + [Int] IUniswapV2Factory 
    - [Ext] feeTo
    - [Ext] feeToSetter
    - [Ext] getPair
    - [Ext] allPairs
    - [Ext] allPairsLength
    - [Ext] createPair #
    - [Ext] setFeeTo #
    - [Ext] setFeeToSetter #

 + [Int] IUniswapV2Pair 
    - [Ext] name
    - [Ext] symbol
    - [Ext] decimals
    - [Ext] totalSupply
    - [Ext] balanceOf
    - [Ext] allowance
    - [Ext] approve #
    - [Ext] transfer #
    - [Ext] transferFrom #
    - [Ext] DOMAIN_SEPARATOR
    - [Ext] PERMIT_TYPEHASH
    - [Ext] nonces
    - [Ext] permit #
    - [Ext] MINIMUM_LIQUIDITY
    - [Ext] factory
    - [Ext] token0
    - [Ext] token1
    - [Ext] getReserves
    - [Ext] price0CumulativeLast
    - [Ext] price1CumulativeLast
    - [Ext] kLast
    - [Ext] mint #
    - [Ext] burn #
    - [Ext] swap #
    - [Ext] skim #
    - [Ext] sync #
    - [Ext] initialize #

 + [Int] IUniswapV2Router01 
    - [Ext] factory
    - [Ext] WETH
    - [Ext] addLiquidity #
    - [Ext] addLiquidityETH ($)
    - [Ext] removeLiquidity #
    - [Ext] removeLiquidityETH #
    - [Ext] removeLiquidityWithPermit #
    - [Ext] removeLiquidityETHWithPermit #
    - [Ext] swapExactTokensForTokens #
    - [Ext] swapTokensForExactTokens #
    - [Ext] swapExactETHForTokens ($)
    - [Ext] swapTokensForExactETH #
    - [Ext] swapExactTokensForETH #
    - [Ext] swapETHForExactTokens ($)
    - [Ext] quote
    - [Ext] getAmountOut
    - [Ext] getAmountIn
    - [Ext] getAmountsOut
    - [Ext] getAmountsIn

 + [Int] IUniswapV2Router02 (IUniswapV2Router01)
    - [Ext] removeLiquidityETHSupportingFeeOnTransferTokens #
    - [Ext] removeLiquidityETHWithPermitSupportingFeeOnTransferTokens #
    - [Ext] swapExactTokensForTokensSupportingFeeOnTransferTokens #
    - [Ext] swapExactETHForTokensSupportingFeeOnTransferTokens ($)
    - [Ext] swapExactTokensForETHSupportingFeeOnTransferTokens #

 +  BionicBunny (Context, IERC20, IERC20Metadata, Pausable, Ownable)
    - [Pub]  #
    - [Ext] name
    - [Ext] symbol
    - [Ext] decimals
    - [Ext] totalSupply
    - [Pub] balanceOf
    - [Ext] isExcludedFromDexFee
    - [Ext] transfer #
       - modifiers: whenNotPaused
    - [Ext] allowance
       - modifiers: whenNotPaused
    - [Ext] approve #
       - modifiers: whenNotPaused
    - [Ext] transferFrom #
       - modifiers: whenNotPaused
    - [Ext] increaseAllowance #
       - modifiers: whenNotPaused
    - [Ext] decreaseAllowance #
       - modifiers: whenNotPaused
    - [Ext] setManager #
       - modifiers: onlyOwner
    - [Ext] pauseContract #
       - modifiers: onlyOwner
    - [Ext] unPauseContract #
       - modifiers: onlyOwner
    - [Ext] burn #
       - modifiers: onlyOwner,whenNotPaused
    - [Ext] excludeFromDexFee #
       - modifiers: onlyOwner,whenNotPaused
    - [Ext] includeInDexFee #
       - modifiers: onlyOwner,whenNotPaused
    - [Ext] setMarketingFeePercent #
       - modifiers: onlyOwner,whenNotPaused
    - [Ext] enableswap #
       - modifiers: onlyOwner,whenNotPaused
    - [Ext] setMinimumTokensBeforeSwap #
       - modifiers: onlyOwner,whenNotPaused
    - [Ext] setEnableFee #
       - modifiers: onlyOwner,whenNotPaused
    - [Ext] withdrawToken #
       - modifiers: onlyManager,whenNotPaused
    - [Ext] withdrawETH ($)
       - modifiers: onlyManager
    - [Ext]  ($)
    - [Int] _approve #
    - [Int] _transfer #
    - [Int] _burn #
    - [Int] _tokenTransfer #
    - [Int] _transfermain #
    - [Int] getTValues
    - [Int] calculateSwapFee
    - [Int] takeSwapFee #
    - [Int] removeAllFee #
    - [Int] restoreAllFee #
    - [Int] distributeFee #
    - [Ext] distributeFeeNow #
       - modifiers: onlyManager
    - [Int] transferETHToAddress #
    - [Int] swapTokensForEth #

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.