G2 - Smart Contract Audit Report

Summary

G2 Audit Report G2 ($G2) is a new DeFi token with frictionless fee redistribution and a buyback system for burning supply. The token also offers a continuous lottery in which users can participate.

We reviewed G2's token contract using code provided to us by the project team.

Notes on the Contract:
  • G2's code implements and builds upon the fee-redistribution features pioneered by Reflect Finance.
  • The total supply of the token is initially set to ten billion [10,000,000,000]. Upon deployment, 90% of total supply will be assigned to the owner and 10% will be assigned to the lottery address.
  • No mint or burn functions are present; though the circulating supply can be reduced by sending tokens to the 0x..dead address, if desired.
  • There is a maximum transaction amount that is currently set to the total token supply, however the owner has the ability to modify the maximum transaction amount to any value at any time.
  • This maximum transaction amount does not apply to the owner during transactions where the owner is either the sender or the recipient.
  • There is a 'tax fee', 'burn fee', and 'liquidity fee' on all transactions for any "non-excluded" address that participates in a transfer. The owner has the ability to modify these fees to any percentage at any time.
  • There is also an additional 'speedbrake' fee when selling $G2. This fee is decremented over time, however the owner can manually modify the fee to any percentage at any time.
  • A portion of the tax fee is redistributed to existing token holders instantly and automatically at the time of each transaction.
  • The tokens collected from the 'burn fee' are automatically sent to the lottery address at the time of each transaction.
  • When buyback functionality is enabled, 1% of the remaining ETH balance will be swapped for tokens and then subsequently sent to the lottery address.
  • The lottery address is set upon deployment. This address is used to pay out lottery winners.
  • The funds collected from the liquidity fee on transactions are stored in the contract. Once a threshold value is met, the tokens are swapped for ETH and a portion is sent to the project team's "marketing" wallet. This marketing allocation can be modified to an uncapped percentage determined by the owner, and the address of the marketing wallet can be changed by the owner at any time.

  • The owner of the contract can exclude and include accounts from transfer fees and reward distribution.
  • The owner of the contract can toggle the buyback functionality.
  • The owner of the contract can toggle swap and liquify functionality.
  • The contract features a presale where the transaction tax fees are set to 0 and the maximum transaction amount is set to 10 billion $G2.
  • Users will receive a 'G2 Ticket' if transfering from an owner defined 'deployer' address to themselves during the presale. Only 1 ticket can be earned per address during the presale.
  • The owner has the ability to use the "lock" function in order to temporarily set ownership to address(0). Ownership is restored after the duration of time determined by the owner has passed and they use the 'unlock' function.
  • The owner has the ability to transfer and renounce ownership if desired.

  • This contract also incorporates a lottery. Upon deployment, a separate token is passed in which acts as a 'ticket'. Users can buy or gift tickets by spending $G2. There are no fees taken when purchasing tickets.
  • The owner of the contract can change the price of a ticket at any time.
  • There is a small, medium, and large lottery, each with their own prize amounts. Each lottery has its own timer; once a lottery timer has expired, a winner is chosen and the timer is reset.
  • The speedbrake fee for selling $G2 is decremented by 1% each time the medium lottery timer expires.
  • Lottery timers are checked whenever a standard $G2 transfer is made.
  • The owner of the contract can change each lottery's timer and reward amounts at any time.
  • The owner of the contract can stop or start the lottery at any time.
  • The randomness functionality used to determine the winner utilizes hashing using block attributes and number of players.
  • As the project is deployed with Solidity v0.8.4, it is protected from overflows.
  • The contract utilizes SafeMath libraries along with following the BEP20 standard.
  • Many functions can be declared external and some variables can be declared constant for gas-saving purposes.
Audit Findings Summary
  • No external threats were identified.
  • We strongly recommend that the team renounces ownership without setting a lock.
  • As with any token, please ensure trust in the team prior to investing as they have substantial control in the ecosystem.
  • Date: November 1st, 2021
Resolved Issues
  • The team addressed an issue with the ownership functionality which previously enabled ownership to be reclaimed after being renounced.
  • The team addressed an issue with the randomness functionality.

Audit Results

Vulnerability CategoryNotesResult
Arbitrary Storage WriteN/APASS
Arbitrary JumpN/APASS
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
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

Smart Contract Graph


Inheritence Chart

Inhertiance


Functions Overview


 ($) = payable function
 # = non-constant function
 
  +  Context 
    - [Int] _msgSender
    - [Int] _msgData

 + [Int] IERC20 
    - [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

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

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

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

 +  G2 (Context, IERC20, Ownable)
    - [Pub]  #
    - [Pub] name
    - [Pub] symbol
    - [Pub] decimals
    - [Pub] totalSupply
    - [Pub] balanceOf
    - [Pub] balanceOf777
    - [Pub] transfer #
    - [Pub] allowance
    - [Pub] approve #
    - [Pub] transferFrom #
    - [Pub] increaseAllowance #
    - [Pub] decreaseAllowance #
    - [Pub] deliver #
    - [Pub] reflectionFromToken
    - [Pub] tokenFromReflection
    - [Pub] excludeFromReward #
       - modifiers: onlyOwner
    - [Ext] includeInReward #
       - modifiers: onlyOwner
    - [Pub] total_speedbrake_sell_fee
    - [Pub] _blocktime
    - [Prv] _approve #
    - [Prv] _transfer #
    - [Prv] swapTokens #
       - modifiers: lockTheSwap
    - [Prv] buyBackTokens #
       - modifiers: lockTheSwap
    - [Prv] swapTokensForEth #
    - [Prv] swapETHForTokens #
    - [Prv] addLiquidity #
    - [Prv] _tokenTransfer #
    - [Prv] _transferStandard #
    - [Prv] _transferToExcluded #
    - [Prv] _transferFromExcluded #
    - [Prv] _transferBothExcluded #
    - [Prv] _reflectFee #
    - [Ext] _reflectFeefromstaking #
    - [Prv] _getValues
    - [Prv] _getTValues
    - [Prv] _getRValues
    - [Prv] _getRate
    - [Prv] _getCurrentSupply
    - [Prv] _takeLiquidity #
    - [Prv] calculateTaxFee
    - [Prv] calculateLiquidityFee
    - [Prv] removeAllFee #
    - [Prv] restoreAllFee #
    - [Pub] isExcludedFromFee
    - [Int] lottery #
    - [Int] movepointer #
    - [Int] random
    - [Int] _pickWinner
    - [Ext] buy_ticket #
    - [Ext] gift_ticket #
    - [Int] _newEntity #
    - [Int] getwinner
    - [Pub] getEntityCount
    - [Pub] getArr
    - [Pub] isEntity
    - [Ext] pauselottery #
       - modifiers: onlyOwner
    - [Ext] set_min_token #
       - modifiers: onlyOwner
    - [Pub] excludeFromFee #
       - modifiers: onlyOwner
    - [Pub] includeInFee #
       - modifiers: onlyOwner
    - [Pub] setdeployer #
       - modifiers: onlyOwner
    - [Ext] setFees #
       - modifiers: onlyOwner
    - [Ext] overridelotteryblock #
       - modifiers: onlyOwner
    - [Ext] overridelotterysize #
       - modifiers: onlyOwner
    - [Ext] setMaxTxAmount #
       - modifiers: onlyOwner
    - [Ext] setNumTokensSellToAddToLiquidity #
       - modifiers: onlyOwner
    - [Ext] setBuybackUpperLimit #
       - modifiers: onlyOwner
    - [Ext] setMarketingAddress #
       - modifiers: onlyOwner
    - [Pub] setSwapAndLiquifyEnabled #
       - modifiers: onlyOwner
    - [Pub] setBuyBackEnabled #
       - modifiers: onlyOwner
    - [Ext] prepareForPreSale #
       - modifiers: onlyOwner
    - [Ext] afterPreSale #
       - modifiers: onlyOwner
    - [Prv] transferToAddressETH #
    - [Ext]  ($)