DiamondQ Token - Smart Contract Audit Report
Summary
DiamondQ is a new ERC20 token that charges a sell fee based on the length of time tokens have been held.
For this audit, we reviewed the DiamondQ contract at commit 44ee12f8c5a662c22c4ebbae9d80ab85c82c8508 on the team's GitHub.
Notes on the DiamondQ Contract:Audit Findings Summary
- The total supply of 1 billion $DIQ is minted to the owner on deployment.
- No minting or burn functions are present beyond deployment; the circulating supply can be reduced by sending tokens to the 0x..dead address, if desired.
- There are 3 different levels of sell fees depending on how long tokens are held before being sold.
- There is a 25% fee for the first 7 days, 15% from 7 to 14 days, and 5% from 14 to 21 days. After 21 days sell fees are no longer taken.
- When transferring, tokens that have been held longer are used first so that the overall fees taken are lower for the user.
- Additionally, there is a dev fee taken on all transfers regardless of the time tokens are held.
- Addresses on the fees whitelist are excluded from both sell and dev fees.
- The owner, this contract, and the dev wallet address are added to the fees whitelist list upon deployment.
- Tokens collected from the sell fee are sent to the 0x...dead address and tokens collected from the dev fee are stored within this contract.
- During transfers, if the count of tokens collected from the dev fee has reached a threshold, swapping is enabled, and the transaction is not a buy, the DIQ tokens collected as dev fees are swapped to BNB and sent to the dev address.
- Addresses on the transaction whitelist may only send or receive tokens that have been held for 21 days.
- In the event of a PancakeSwap upgrade, the owner may update the router address and create a new liquidity pair.
- The owner may add or remove any address from the fees and transaction whitelists at any time.
- The owner may toggle the swapping functionality and update the threshold for tokens collected from dev fees to be swapped.
- The owner may toggle all fees on and off.
- As the project is deployed with Solidity v0.8.X, it is protected from overflows/underflows.
- No external threats were identified.
- Ensure trust in the team as they have some control within the ecosystem.
- Date: December 2nd, 2021.
Audit Results
Vulnerability Category | Notes | Result |
---|---|---|
Arbitrary Storage Write | N/A | PASS |
Arbitrary Jump | N/A | PASS |
Centralization of Control | The team retains control of ownership functions described above. | PASS |
Delegate Call to Untrusted Contract | N/A | PASS |
Dependence on Predictable Variables | N/A | PASS |
Deprecated Opcodes | N/A | PASS |
Ether Thief | N/A | PASS |
Exceptions | N/A | PASS |
External Calls | N/A | PASS |
Flash Loans | N/A | PASS |
Integer Over/Underflow | N/A | PASS |
Multiple Sends | N/A | PASS |
Oracles | N/A | PASS |
Suicide | N/A | PASS |
State Change External Calls | N/A | PASS |
Unbounded Loops | N/A | PASS |
Unchecked Retval | N/A | PASS |
User Supplied Assertion | N/A | PASS |
Critical Solidity Compiler | N/A | PASS |
Overall Contract Safety | PASS |
DiamondQ Contract
($) = payable function
# = non-constant function
+ [Int] IERC20
- [Ext] totalSupply
- [Ext] balanceOf
- [Ext] transfer #
- [Ext] allowance
- [Ext] approve #
- [Ext] transferFrom #
+ Context
- [Int] _msgSender
- [Int] _msgData
+ Ownable (Context)
- [Pub] Constructor #
- [Pub] owner
- [Pub] renounceOwnership #
- modifiers: onlyOwner
- [Pub] transferOwnership #
- modifiers: onlyOwner
+ [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] mint #
- [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 #
+ DiamondQ (Context, IERC20, Ownable)
- [Pub] Constructor #
- [Pub] name
- [Pub] symbol
- [Pub] decimals
- [Pub] totalSupply
- [Pub] balanceOf
- [Ext] balanceLessThan7Days
- [Ext] balanceBetween7And14Days
- [Ext] balanceBetween14And21Days
- [Pub] balanceOver21Days
- [Pub] transfer #
- [Pub] allowance
- [Pub] approve #
- [Pub] transferFrom #
- [Pub] increaseAllowance #
- [Pub] decreaseAllowance #
- [Prv] _approve #
- [Prv] _transfer #
- [Prv] _reduceSenderBalance #
- [Prv] _increaseTaxBalance #
- [Prv] _increaseRecipientBalance #
- [Prv] _calculateHouseFee
- [Prv] _swapTokensForHouse #
- modifiers: lockTheSwap
- [Ext] Fallback ($)
- [Prv] _swapTokensForEth #
- [Ext] setBurnEnabled #
- modifiers: onlyOwner
- [Ext] setSwapEnabled #
- modifiers: onlyOwner
- [Ext] removeHouseFee #
- modifiers: onlyOwner
- [Ext] reinstateHouseFee #
- modifiers: onlyOwner
- [Ext] removeBurnFees #
- modifiers: onlyOwner
- [Ext] reinstateBurnFees #
- modifiers: onlyOwner
- [Ext] removeAllFees #
- modifiers: onlyOwner
- [Ext] reinstateAllFees #
- modifiers: onlyOwner
- [Ext] updateMinTokensBeforeSwap #
- modifiers: onlyOwner
- [Pub] excludeFromFee #
- modifiers: onlyOwner
- [Pub] includeInFee #
- modifiers: onlyOwner
- [Pub] addToOnlyDiamondHandTxs #
- modifiers: onlyOwner
- [Pub] removeFromOnlyDiamondHandTxs #
- modifiers: onlyOwner
- [Pub] changeRouterVersion #
- modifiers: onlyOwner
- [Prv] _aggregateOldTransactions #
- [Prv] _sliceBlockTimeArray #