SPAL - Smart Contract Audit Report

Audit Summary

SPAL ($SPAL) is a new BEP-20 token on the Binance Smart Chain that is an automatic liquidity providing protocol that pays out static rewards to holders.

We reviewed the SPAL contract at 0x4AF95fd28E5C9684eE38457166A42e059B5BD190 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 and currently own a large portion of the total supply.
Date: February 24th, 2022.

Finding #1 - SPAL - Low

Description: There are three instances in the swapAndLiquify() function where multiplication is performed on the result of a division.
			
spentAmount = contractTokenBalance.div(totFee).mul(_marketingFee);
spentAmount = contractTokenBalance.div(totFee).mul(_buybackFee);
contractTokenBalance = contractTokenBalance.div(totFee).mul(_liquidityFee);
Risk/Impact: Division can lead to integer truncation, therefore dividing and subsequently multiplying can cause results to lose precision and become less accurate.
Recommendation: We recommend modifying these calculations to perform all multiplication before division.

Finding #2 - SPAL - Informational

Description: In the setAllFeePercent() function, there are four require statements that contain a tautology.
			
require(taxFee >= 0 , "TF error");
require(liquidityFee >= 0 , "LF error");
require(marketingFee >= 0 , "MF error");
require(buybackFee >= 0 , "BBF error");
Recommendation: These require statements can be removed for additional gas savings on each call and to reduce deployment costs.

Finding #3 - SPAL - Informational

Description: Several functions are declared public, but are never called internally.
			
name, symbol, decimals, totalSupply, transfer, allowance, approve, transferFrom, increaseAllowance, decreaseAllowance, isExcludedFromReward, totalFees, deliver, reflectionFromToken, includedFromFee, excludedFromFee, setSwapAndLiquifyEnabled, setNumTokensBuybackMarketing, getNumTokensBuybackMarketing, isIncludedFromFee, setnumTokensSellToAddToLiquidity, recoverToken
Recommendation: We recommend declaring these functions external for additional gas savings on each call.

Finding #4 - SPAL - Informational

Description: The dead and initialVal state variables can never be modified, but are not declared constant.
Recommendation: These state variables can be declared constant for additional gas savings on each reference and to reduce deployment costs.

Finding #5 - SPAL - Informational

Description: Although the SafeMath library is utilized, the contract is deployed with Solidity v0.8.10 which has built-in overflow checks.
Recommendation: SafeMath could be safely removed to reduce contract size and deployment costs.

Contract Overview

  • The total supply of the token is set to 500 million $SPAL [500,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 11 total token holders. The token allocation is as follows:
    • 50% of the total supply has been sent to the 0x..dead address.
    • 36% of the total supply belongs to the owner.
    • The next three wallet addresses own a cumulative 12% of the total supply.

  • There is a Tax fee, Liquidity fee, and Marketing fee, and Buyback fee on all transfers where either the sender or the recipient is included in fees.
  • The tokens collected through the Tax fee are removed from the circulating supply; This serves as a frictionless fee redistribution which automatically benefits all token holders at the time of each transaction.
  • The tokens collected from the remaining fees are stored in the contract address. The tokens are swapped for BNB 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 in the contract address (determined by the owner) has been reached.
    • The contract is not currently performing an automatic liquidity add.
    • The transfer is a selling transaction via Pancakeswap.
  • Liquidity-adds are automatically performed by selling the tokens collected as fees, pairing the received BNB with the token, and adding it as liquidity to the pair.
  • The LP tokens received through this process are sent to the 0x..dead address.
  • The tokens collected from the Marketing fee are swapped for BNB and sent to the team's Marketing wallet.
  • The tokens collected from the Buyback fee are swapped for BNB and sent to the team's Buyback wallet.
  • As the contract is deployed with Solidity v0.8.10, it is protected from overflows/underflows.
  • The contract complies with the BEP-20 token standard.
Ownership Controls:
  • The owner can modify the Tax fee, Liquidity fee, and Marketing fee, and Buyback fee to any percentages at any time.
  • The owner can exclude and include accounts from transfer fees and reward distribution.
  • The owner can enable/disable automatic liquidity adds at any time.
  • The owner can update the threshold number of tokens needed to trigger an automatic liquidity add to any value at any time.
  • The owner can enable/disable the automatic funding of the Marketing wallet and Buyback wallet at any time.
  • The owner can withdraw any tokens (besides $SPAL) from the contract at any time.
  • The owner can update the team's Marketing wallet and Buyback wallet to any addresses at any time.

External Threat Results

Vulnerability CategoryNotesResult
Arbitrary Storage WriteN/APASS
Arbitrary JumpN/APASS
Centralization of ControlThe owner can set each fee percentage up to 100%.WARNING
Delegate Call to Untrusted ContractN/APASS
Dependence on Predictable VariablesN/APASS
Deprecated OpcodesN/APASS
Ether ThiefN/APASS
ExceptionsN/APASS
External CallsN/APASS
Flash LoansN/APASS
Integer Over/UnderflowN/APASS
Logical IssuesN/APASS
Multiple SendsN/APASS
OraclesN/APASS
SuicideN/APASS
State Change External CallsN/APASS
Unchecked RetvalN/APASS
User Supplied AssertionN/APASS
Critical Solidity CompilerN/APASS
Overall Contract Safety PASS

Function Graph

BEP20 Token Graph

Inheritance Chart

Multi-file Token

Functions Overview

												
($) = payable function
 # = non-constant function

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

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

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

 + [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] IERC20 
    - [Ext] name
    - [Ext] symbol
    - [Ext] decimals
    - [Ext] totalSupply
    - [Ext] balanceOf
    - [Ext] allowance
    - [Ext] approve #
    - [Ext] transfer #
    - [Ext] transferFrom #

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

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

 +  SPAL (IERC20, Ownable)
    - [Pub]  #
    - [Pub] name
    - [Pub] symbol
    - [Pub] decimals
    - [Pub] totalSupply
    - [Pub] balanceOf
    - [Pub] transfer #
    - [Pub] allowance
    - [Pub] approve #
    - [Pub] transferFrom #
    - [Pub] increaseAllowance #
    - [Pub] decreaseAllowance #
    - [Pub] isExcludedFromReward
    - [Pub] totalFees
    - [Pub] deliver #
    - [Pub] reflectionFromToken
    - [Pub] tokenFromReflection
    - [Pub] excludeFromReward #
       - modifiers: onlyOwner
    - [Ext] includeInReward #
       - modifiers: onlyOwner
    - [Pub] includedFromFee #
       - modifiers: onlyOwner
    - [Pub] excludedFromFee #
       - modifiers: onlyOwner
    - [Ext] setAllFeePercent #
       - modifiers: onlyOwner
    - [Pub] setSwapAndLiquifyEnabled #
       - modifiers: onlyOwner
    - [Ext] setFeeWallet #
       - modifiers: onlyOwner
    - [Pub] setNumTokensBuybackMarketing #
       - modifiers: onlyOwner
    - [Pub] getNumTokensBuybackMarketing
    - [Ext]  ($)
    - [Prv] _reflectFee #
    - [Prv] _getValues
    - [Prv] _getTValues
    - [Prv] _getRValues
    - [Prv] _getRate
    - [Prv] _getCurrentSupply
    - [Prv] _takeLiquidity #
    - [Prv] calculateTaxFee
    - [Prv] calculateLiquidityFee
    - [Prv] removeAllFee #
    - [Prv] restoreAllFee #
    - [Pub] isIncludedFromFee
    - [Prv] _approve #
    - [Prv] _transfer #
    - [Pub] setnumTokensSellToAddToLiquidity #
       - modifiers: onlyOwner
    - [Prv] swapAndLiquify #
       - modifiers: lockTheSwap
    - [Prv] swapBNBForTokens #
    - [Prv] swapTokensForBNB #
    - [Prv] addLiquidity #
    - [Prv] _tokenTransfer #
    - [Prv] _transferStandard #
    - [Prv] _transferToExcluded #
    - [Prv] _transferFromExcluded #
    - [Prv] _transferBothExcluded #
    - [Prv] _tokenTransferNoFee #
    - [Pub] recoverToken #
       - modifiers: onlyOwner