SCA

Smart Contract Audit Report

Audit Summary

SCA Audit Report SCA is a new BEP-20 token on the Binance Smart Chain that is an automatic liquidity providing protocol that pays static rewards to holders.

For this audit, we reviewed the project team's SCA contract at 0x7d33FFaef8e646E7C027804C757C86Df37C43855 on the Binance Smart Chain Mainnet.

Audit Findings

Please ensure trust in the team prior to investing as they have substantial control in the ecosystem.
Date: May 19th, 2022.

Finding #1 - SCA - Medium

Description: The Totalswap denominator is currently inaccurate as it does not equal the sum of the liquidity, marketing, and buyback values.
Ratios public _ratios = Ratios({
	reflection: 800,
	liquidity: 1500,
	marketing: 1100,
	buyback: 200,
	totalSwap: 1300 + 1100 + 200    
	});
Risk/Impact: Miscalculations will occur when distributing the tokens collected through fees as the totalSwap denominator used in these calculations is inaccurate.
Recommendation: The owner should call the setRatios() function which will properly set the totalSwap value as the sum of the liquidty, marketing, and buyback values.

Contract Overview

  • The total supply of the token is set to 50 million $SCA [50,000,000].
  • No mint or burn functions exist, though the circulating supply can be decreased by sending tokens to the 0x..dead address.
  • At the time of writing this report, there are 29 total token holders. The token allocation is as follows:
  • Trading must be enabled by the owner and liquidity must have been added by an authorized account before all trading can take place on the platform. Only authorized accounts can participate in transfers while trading is disabled.
  • Once trading is enabled, it can never be disabled.
  • The contract enforces a maximum transaction amount (determined by the owner) which imposes a limit to the number of tokens that can be transferred in a single transaction via Pancakeswap.
  • 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.
  • The contract interacts with an external Anti-sniper contract on all transfers. The Anti-Sniper contract was out of scope for this audit so we are unable to give an assessment in regards to security.
  • There is a Reflection fee, Liquidity fee, Marketing fee, and Buyback fee on all transfers 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, sell, or peer-to-peer transfer.
  • The tokens collected through the Reflection fee are removed from the circulating supply; This serves as a frictionless fee redistribution that automatically benefits all token holders at the time of each transaction.
  • The team should ensure that the Pair addresses are excluded from reflections to prevent theft-of-liquidity attacks.
  • The tokens collected through the remaining fees are stored in the contract address. The tokens are swapped for BUSD for the purpose of funding Pancakeswap liquidity when the following conditions are met:
    • The automatic liquidity add functionality is enabled by the team.
    • The threshold number of tokens (determined by the owner) in the contract address has been reached.
    • The contract is not currently performing an automatic liquidity add.
    • The caller is initiating a sell transaction via Pancakeswap.
    • Neither the sender nor the recipient is a Presale address set by the team.
  • Liquidity-adds are automatically performed by selling the tokens collected as fees, pairing the received BUSD with the token, and adding it as liquidity to the BUSD pair.
  • The LP tokens received through this process are sent to the 0x..dead address.
  • The tokens collected through the Marketing fee and Buyback fee are swapped for BUSD and sent to the team's Marketing wallet and Buyback wallet respectively.
  • The contract utilizes the SafeMath library to protect against overflows/underflows.
  • The contract complies with the BEP-20 token standard.
Ownership Controls:
  • The owner can set total fees for each fee structure up to 20%. The combined buy fee and sell fee percentage cannot exceed 30%.
  • The owner can set the fee allocation for each fund to any values as long as the total allocation does not exceed the current combined buy fee and sell fee percentage.
  • The owner can exclude and include accounts from transfer fees and reward distribution.
  • The owner can enable/disable the Anti-Sniper blacklist at any time.
  • The owner can remove accounts from the Anti-Sniper blacklist at any time.
  • The owner can set the maximum transaction amount to any value greater than 50,000 at any time.
  • The owner can set the maximum wallet amount to any value greater than 500,000 at any time.
  • The owner can exclude and include accounts from the maximum transaction and maximum wallet limits.
  • The owner can enable/disable automatic liquidity adds at any time.
  • The owner can set the threshold number of tokens and the maximum number of tokens used for automatic liquidity adds to any values as long as the threshold value does not exceed the maximum value.
  • The owner can set the token swapping price impact cap to any value up to 2% at any time.
  • The owner can airdrop tokens to any number of addresses at any time.
  • The owner can transfer ownership to another address at any time. When doing so, the owner's full token balance will be transferred to the new owner.
  • The owner can grant the contract address a maximum approval on behalf of the set Router address at any time.
  • The owner can withdraw any BNB from the contract before liquidity has been added.
  • The owner can update the Marketing wallet and Buyback wallet to any addresses at any time.
  • The owner can update the Pancakeswap Router and Pair addresses at any time.

Audit Results

Vulnerability CategoryNotesResult
Arbitrary Storage WriteN/APASS
Arbitrary JumpN/APASS
Centralization of Control
  • The team can set the dexRouter address to a team wallet in order to withdraw all of the tokens from the contract.
  • The owner can set the maximum transaction amount to any value greater than 50,000.
WARNING
Compiler IssuesN/APASS
Delegate Call to Untrusted ContractN/APASS
Dependence on Predictable VariablesN/APASS
Ether/Token TheftN/APASS
Flash LoansN/APASS
Front RunningThe automatic token swapping functionality may be susceptible to front-running; The team must monitor and if suspicious activity is detected, the team should lower the swapThreshold value or disable this system altogether.PASS
Improper EventsN/APASS
Improper Authorization SchemeN/APASS
Integer Over/UnderflowN/APASS
Logical IssuesThe Totalswap denominator is currently inaccurate as it does not equal the sum of the liquidity, marketing, and buyback values.WARNING
Oracle IssuesN/APASS
Outdated Compiler VersionN/APASS
Race ConditionsN/APASS
ReentrancyN/APASS
Signature IssuesN/APASS
Unbounded LoopsN/APASS
Unused CodeN/APASS
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] decimals
    - [Ext] symbol
    - [Ext] name
    - [Ext] getOwner
    - [Ext] balanceOf
    - [Ext] transfer #
    - [Ext] allowance
    - [Ext] approve #
    - [Ext] transferFrom #

 + [Int] IFactoryV2 
    - [Ext] getPair
    - [Ext] createPair #

 + [Int] IV2Pair 
    - [Ext] factory
    - [Ext] getReserves
    - [Ext] sync #

 + [Int] IRouter01 
    - [Ext] factory
    - [Ext] WETH
    - [Ext] addLiquidityETH ($)
    - [Ext] addLiquidity #
    - [Ext] swapExactETHForTokens ($)
    - [Ext] getAmountsOut
    - [Ext] getAmountsIn

 + [Int] IRouter02 (IRouter01)
    - [Ext] swapExactTokensForETHSupportingFeeOnTransferTokens #
    - [Ext] swapExactETHForTokensSupportingFeeOnTransferTokens ($)
    - [Ext] swapExactTokensForTokensSupportingFeeOnTransferTokens #
    - [Ext] swapExactTokensForTokens #

 + [Int] AntiSnipe 
    - [Ext] checkUser #
    - [Ext] setLaunch #
    - [Ext] setLpPair #
    - [Ext] setProtections #
    - [Ext] removeSniper #
    - [Ext] removeBlacklisted #
    - [Ext] isBlacklisted
    - [Ext] transfer #
    - [Ext] setBlacklistEnabled #
    - [Ext] setBlacklistEnabledMultiple #
    - [Ext] getInitializers #
    - [Ext] withdraw #

 +  SCA (IERC20)
    - [Pub]  ($)
    - [Ext]  ($)
    - [Ext] transferOwner #
       - modifiers: onlyOwner
    - [Ext] renounceOwnership #
       - modifiers: onlyOwner
    - [Ext] totalSupply
    - [Ext] decimals
    - [Ext] symbol
    - [Ext] name
    - [Ext] getOwner
    - [Ext] allowance
    - [Pub] balanceOf
    - [Pub] transfer #
    - [Pub] approve #
    - [Int] _approve #
    - [Pub] approveContractContingency #
       - modifiers: onlyOwner
    - [Ext] transferFrom #
    - [Pub] setNewRouter #
       - modifiers: onlyOwner
    - [Ext] setLpPair #
       - modifiers: onlyOwner
    - [Ext] setInitializer #
       - modifiers: onlyOwner
    - [Ext] isExcludedFromLimits
    - [Ext] isExcludedFromFees
    - [Ext] isExcludedFromProtection
    - [Ext] setExcludedFromLimits #
       - modifiers: onlyOwner
    - [Pub] setExcludedFromFees #
       - modifiers: onlyOwner
    - [Ext] setExcludedFromProtection #
       - modifiers: onlyOwner
    - [Ext] setBlacklistEnabled #
       - modifiers: onlyOwner
    - [Ext] setBlacklistEnabledMultiple #
       - modifiers: onlyOwner
    - [Ext] removeBlacklisted #
       - modifiers: onlyOwner
    - [Pub] isBlacklisted
    - [Ext] removeSniper #
       - modifiers: onlyOwner
    - [Ext] setProtectionSettings #
       - modifiers: onlyOwner
    - [Ext] setTaxes #
       - modifiers: onlyOwner
    - [Ext] setWallets #
       - modifiers: onlyOwner
    - [Ext] setRatios #
       - modifiers: onlyOwner
    - [Ext] setMaxTxPercent #
       - modifiers: onlyOwner
    - [Ext] setMaxWalletSize #
       - modifiers: onlyOwner
    - [Pub] getMaxTX
    - [Pub] getMaxWallet
    - [Ext] setSwapSettings #
       - modifiers: onlyOwner
    - [Ext] setPriceImpactSwapAmount #
       - modifiers: onlyOwner
    - [Ext] setContractSwapEnabled #
       - modifiers: onlyOwner
    - [Ext] excludePresaleAddresses #
       - modifiers: onlyOwner
    - [Int] _hasLimits
    - [Int] _transfer #
    - [Int] contractSwap #
       - modifiers: lockTheSwap
    - [Int] _checkLiquidityAdd #
    - [Pub] enableTrading #
       - modifiers: onlyOwner
    - [Ext] sweepContingency #
       - modifiers: onlyOwner
    - [Ext] multiSendTokens #
       - modifiers: onlyOwner
    - [Pub] isExcludedFromReward
    - [Pub] setExcludedFromReward #
       - modifiers: onlyOwner
    - [Pub] tokenFromReflection
    - [Int] _finalizeTransfer #
    - [Int] takeTaxes #
    - [Int] _getRate

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.