SpaceRat - Smart Contract Audit Report

Summary

SpaceRat Audit Report SpaceRat is a new token with frictionless fee redistribution, liquidity adds, MATIC rewards, and a lottery system.

We audited SpaceRat's token contract contract at 0x1132f58810Ee9fF13E97aECCd8DDa688Cc5eb8F4 on the Polygon mainnet.

Overview of the Contract:
  • The total supply of the token is set to one quadrillion.
  • No mint or burn functions are present; though the circulating supply can be reduced by sending tokens to the 0x..dead address, if desired.
  • Currently, 9% of the token's supply is held in the contract.
  • 6.7% of the supply has been burned.
  • 5% of the supply is locked in an unverified contract.
  • The liquidity pool holds ~4% of the token's supply as liquidity.
  • 88% of liquidity has been locked in an unverified contract.

  • Users who hold tokens will automatically receive a portion the fees from a transaction tax on each transfer.
  • A portion of the fee charged on transactions is stored in the contract and, once a threshold value is met, used to fund QuickSwap liqudity.
  • Liquidity-adds are funded by selling half of the tokens collected as fees, pairing the received MATIC with the token, and adding it as liquidity to the MATIC pair.
  • A final portion of the fees charged on transfers is used to fund MATIC rewards, which will be claimable by token holders every 24 hours. This is also used to fund a lottery system, allowing users to claim extra rewards on a psuedo-random basis.

  • The owner of the contract can exclude and include users from transfer fees, set the maximum transfer amount, and update the fee percentages at any time.
  • The randomness function, to an extent, relies on predictable environment variables. This is common, albiet not best practice; but the probability of miners maliciously changing these variables is extremley low.
  • Some functions could have been declared external instead of public to save some gas.
  • MATIC claiming logic is properly structured to prevent reentrancy attacks.
  • The contract utilizes SafeMath libraries to prevent overflows along with following the BEP20 standard.

Audit Findings Summary
  • No security threats were identified.
  • Ensure trust in the team as they have substantial control in the ecosystem.
  • Date: June 7th, 2021

External Threat Results

Vulnerability CategoryNotesResult
Arbitrary Storage WriteN/APASS
Arbitrary JumpN/APASS
Delegate Call to Untrusted ContractN/APASS
Dependence on Predictable VariablesRandomness relies on a series of environmental variables.
Probability of a negative impact is very low.
WARNING
Deprecated OpcodesN/APASS
Ether ThiefN/APASS
ExceptionsN/APASS
External CallsN/APASS
Flash LoansN/APASS
Integer Over/UnderflowN/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

BEP20 Token Graph

Multi-file Token

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

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

 + [Lib] SafeMath 
    - [Int] add
    - [Int] sub
    - [Int] sub
    - [Int] mul
    - [Int] div
    - [Int] div
    - [Int] mod
    - [Int] mod

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

 + [Lib] Address 
    - [Int] isContract
    - [Int] sendValue #
    - [Int] functionCall #
    - [Int] functionCall #
    - [Int] functionCallWithValue #
    - [Int] functionCallWithValue #
    - [Prv] _functionCallWithValue #

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

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

 + [Int] IQuickSwapPair 
    - [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] IQuickSwapRouter01 
    - [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] IQuickSwapRouter02 (IQuickSwapRouter01)
    - [Ext] removeLiquidityETHSupportingFeeOnTransferTokens #
    - [Ext] removeLiquidityETHWithPermitSupportingFeeOnTransferTokens #
    - [Ext] swapExactTokensForTokensSupportingFeeOnTransferTokens #
    - [Ext] swapExactETHForTokensSupportingFeeOnTransferTokens ($)
    - [Ext] swapExactTokensForETHSupportingFeeOnTransferTokens #

 + [Lib] Utils 
    - [Prv] random
    - [Prv] isLotteryWon
    - [Pub] calculateMATICReward
    - [Pub] calculateTopUpClaim
    - [Pub] swapTokensForEth #
    - [Pub] swapETHForTokens #
    - [Pub] addLiquidity #

 +  ReentrancyGuard 
    - [Pub]  #

 +  SpaceRat (Context, IBEP20, Ownable, ReentrancyGuard)
    - [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] totalBurnFees
    - [Pub] totalAidropFees
    - [Pub] totalMarketingFees
    - [Pub] totalDevFees
    - [Pub] deliver #
    - [Pub] reflectionFromToken
    - [Pub] tokenFromReflection
    - [Pub] excludeFromReward #
       - modifiers: onlyOwner
    - [Ext] includeInReward #
       - modifiers: onlyOwner
    - [Prv] _transferBothExcluded #
    - [Pub] excludeFromFee #
       - modifiers: onlyOwner
    - [Pub] includeInFee #
       - modifiers: onlyOwner
    - [Ext] setTaxFeePercent #
       - modifiers: onlyOwner
    - [Ext] setMarketingFeePercent #
       - modifiers: onlyOwner
    - [Ext] setDevFeePercent #
       - modifiers: onlyOwner
    - [Ext] setLiquidityFeePercent #
       - modifiers: onlyOwner
    - [Pub] setAirdropAddress #
       - modifiers: onlyOwner
    - [Pub] setMarketingAddress #
       - modifiers: onlyOwner
    - [Pub] setDevAddress #
       - modifiers: onlyOwner
    - [Pub] setSwapAndLiquifyEnabled #
       - modifiers: onlyOwner
    - [Ext]  ($)
    - [Prv] _reflectFee #
    - [Prv] _getValues
    - [Prv] _getTValues
    - [Prv] _getRValues
    - [Prv] _getRate
    - [Prv] _getCurrentSupply
    - [Prv] _takeLiquidity #
    - [Prv] _Burn #
    - [Prv] _txToAirdropWallet #
    - [Prv] _txToMarketingWallet #
    - [Prv] _txToDevWallet #
    - [Prv] calculateTaxFee
    - [Prv] calculateMarketingFee
    - [Prv] calculateDevFee
    - [Prv] calculateLiquidityFee
    - [Prv] removeAllFee #
    - [Prv] restoreAllFee #
    - [Pub] isExcludedFromFee
    - [Prv] _approve #
    - [Prv] _transfer #
    - [Prv] _tokenTransfer #
    - [Prv] _transferStandard #
    - [Prv] _transferToExcluded #
    - [Prv] _transferFromExcluded #
    - [Pub] setMaxTxPercent #
       - modifiers: onlyOwner
    - [Pub] setExcludeFromMaxTx #
       - modifiers: onlyOwner
    - [Pub] calculateMATICReward
    - [Pub] getRewardCycleBlock
    - [Pub] claimMATICReward #
       - modifiers: isHuman,nonReentrant
    - [Prv] topUpClaimCycleAfterTransfer #
    - [Pub] disruptiveTransfer ($)
    - [Prv] swapAndLiquify #
    - [Pub] activateContract #
       - modifiers: onlyOwner