BetterCallRaul

Smart Contract Audit Report

Audit Summary

BetterCallRaul Audit Report BetterCallRaul is a new ERC-20 token on Ethereum that is an automatic liquidity providing protocol.

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

Audit Findings

An Informational finding was identified and the team may want to review it. In addition, some centralized aspects are present.
Date: April 21st, 2023.
Updated: May 4th, 2023 to reflect the contract's newly deployed Mainnet address.

Finding #1 - BetterCallRaul - Informational

Description: In the handleTax() function, the swapEnabled check in the following if-statement is redundant as this state variable is permanently set to true on deployment.
if(canSwap && swapEnabled && !swapping && isAMMPair[to]) {
    swapping = true;
    swapBack();
    swapping = false;
}
Recommendation: The team should either add a setter function that toggles the swapEnabled state variable or remove it from the contract for additional gas savings on each transfer that triggers the contract's swapping functionality.

Contract Overview

  • The initial supply of the token is set to 100 million [100,000,000] and is minted to the deployer.
  • No mint functions are accessible beyond deployment.
  • Any user can burn their own tokens to reduce the total supply at any time.
  • At the time of writing this report, there are 302 total token holders. The token allocation is as follows:

  • Trading must be enabled by the owner before all transfers can take place on the platform. Only accounts that have been excluded from fees can participate in transfers when trading is disabled. Once trading is enabled it can never be disabled.
  • The contract enforces a transfer delay which prevents a transfer from occurring if the user is attempting to either buy tokens or participate in a peer-to-peer transfer more than once per block.
  • The contract enforces a maximum transaction amount (determined by the owner) which imposes a limit to the number of tokens that can be bought or sold via Uniswap per transaction.
  • The contract enforces a maximum wallet amount that prevents a transfer from occurring if the recipient's token balance will exceed the limit number of tokens (determined by the owner) after the transfer occurs.
  • There is a Liquidity fee, Marketing fee, Dev fee, and Burn fee on all transfers via Uniswap where neither the sender nor the recipient is excluded from fees. A separate fee structure can be set by the team to apply different fee percentages depending on whether the transfer is a buy or a sell.
  • The tokens collected through the Liquidity fee, Marketing fee, and Dev fee are stored in the contract address. The tokens are swapped for WETH for the purpose of funding Uniswap liquidity and team wallets when the following conditions are met:
    • The threshold number of 25,000 tokens in the contract address has been reached.
    • The contract is not currently swapping tokens.
    • The caller is initiating a sell transaction via Uniswap.
  • Liquidity-adds are automatically performed by selling the tokens collected as fees, pairing the received ETH with the token, and adding it as liquidity to the ETH pair.
  • The LP tokens received through this process are sent to the Liquidity address set by the team. We recommend the team lock these newly acquired LP tokens.
  • The tokens collected through the Marketing fee and Dev fee are swapped for WETH and sent to the team's Treasury wallet and Marketing wallet respectively.
  • The tokens collected through the Burn fee are sent to the contract address and subsequently burned.
  • The owner can airdrop any number of tokens to any address at any time.
  • A for loop is used to transfer funds for the airdrop; The team must ensure the maximum number of addresses that can be involved in a single airdrop is no more than 350 to prevent this loop from hitting the block gas limit.
  • As the contract is implemented with Solidity v0.8.x, it is protected from overflows/underflows.
  • The contract complies with the ERC-20 token standard.
Ownership Controls:
  • The owner can set total sell fees and total buy fees up to 10% each at any time.
  • The owner can exclude and include accounts from transfer fees at any time.
  • The owner can set the maximum transaction amount and maximum wallet amount to any values greater than 100,000 tokens at any time.
  • The owner can include and exclude any accounts from the maximum transaction and maximum wallet restrictions at any time.
  • The owner can disable the maximum transaction and maximum wallet restrictions at any time.
  • The owner can disable the transfer delay at any time. Once disabled, it can never be enabled.
  • The owner can withdraw any tokens from the contract at any time.
  • The owner can update the team's Marketing wallet, Dev wallet, and Liquidity wallet at any time.

Audit Results

Vulnerability Category Notes Result
Arbitrary Jump/Storage Write N/A PASS
Centralization of Control The LP tokens generated through automatic liquidity adds are sent to the Liquidity address set by the team. 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

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

 + [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
    - [Ext] renounceOwnership #
       - modifiers: onlyOwner
    - [Pub] transferOwnership #
       - 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

 + [Lib] SafeERC20 
    - [Int] safeTransfer #
    - [Int] safeTransferFrom #
    - [Prv] _callOptionalReturn #
    - [Int] safeApprove #

 +  TokenHandler (Ownable)
    - [Ext] sendTokenToOwner #
       - modifiers: onlyOwner

 + [Int] IERC165 
    - [Ext] supportsInterface

 + [Int] IERC721 (IERC165)
    - [Ext] balanceOf
    - [Ext] ownerOf
    - [Ext] safeTransferFrom #
    - [Ext] safeTransferFrom #
    - [Ext] transferFrom #
    - [Ext] approve #
    - [Ext] setApprovalForAll #
    - [Ext] getApproved
    - [Ext] isApprovedForAll

 + [Int] IWETH 
    - [Ext] deposit ($)

 + [Int] ILpPair 
    - [Ext] sync #

 + [Int] IDexRouter 
    - [Ext] factory
    - [Ext] WETH
    - [Ext] swapExactTokensForETHSupportingFeeOnTransferTokens #
    - [Ext] swapExactETHForTokensSupportingFeeOnTransferTokens ($)
    - [Ext] swapETHForExactTokens ($)
    - [Ext] swapExactTokensForTokensSupportingFeeOnTransferTokens #
    - [Ext] swapTokensForExactTokens #
    - [Ext] addLiquidityETH ($)
    - [Ext] addLiquidity #
    - [Ext] getAmountsOut

 + [Int] IDexFactory 
    - [Ext] createPair #

 +  BetterCallRaul (ERC20, Ownable)
    - [Pub]  #
       - modifiers: ERC20
    - [Int] _transfer #
    - [Int] checkLimits #
    - [Int] handleTax #
    - [Prv] swapTokensForPAIREDTOKEN #
    - [Prv] addLiquidity #
    - [Prv] swapBack #
    - [Ext] setExemptFromFees #
       - modifiers: onlyOwner
    - [Ext] setExemptFromLimits #
       - modifiers: onlyOwner
    - [Ext] updateMaxTransaction #
       - modifiers: onlyOwner
    - [Ext] updateMaxWallet #
       - modifiers: onlyOwner
    - [Ext] updateBuyTax #
       - modifiers: onlyOwner
    - [Ext] updateSellTax #
       - modifiers: onlyOwner
    - [Ext] enableTrading #
       - modifiers: onlyOwner
    - [Ext] removeLimits #
       - modifiers: onlyOwner
    - [Ext] disableTransferDelay #
       - modifiers: onlyOwner
    - [Ext] airdropToWallets #
       - modifiers: onlyOwner
    - [Ext] rescueTokens #
       - modifiers: onlyOwner
    - [Ext] updateMarketingAddress #
       - modifiers: onlyOwner
    - [Ext] updateDevAddress #
       - modifiers: onlyOwner
    - [Ext] updateLiquidityAddress #
       - modifiers: onlyOwner
    - [Ext] burnTokens #

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.