VNetwork
Smart Contract Audit Report
Audit Summary
Vanity is building a new ERC-20 token.
For this audit, we reviewed the VNetwork contract provided to us by the project team.
Audit Findings
All findings have been resolved, though some centralized aspects are present.
Date: April 7th, 2023.
Updated: April 24th, 2023 to reflect updates made to the contract that resolves all Findings.Finding #1 - VNetwork - Informational (Resolved)
Description: The enableTrading() function takes in ablocksForPenalty
parameter, but the parameter is not used to update any state variables in the contract.
Recommendation: Thefunction enableTrading(uint256 blocksForPenalty) external onlyOwner { require(!tradingActive, "Cannot reenable trading"); require(blocksForPenalty <= 10, "Cannot make penalty blocks more than 10"); tradingActive = true; swapEnabled = true; tradingActiveBlock = block.number; emit EnabledTrading(); }
blocksForPenalty
parameter should either be removed or utilized in a way that fits the project team's intended functionality.
Resolution: The team has removed theblocksForPenalty
parameter from the enableTrading() function.
Finding #2 - VNetwork - Informational (Resolved)
Description: The removeLimits() function sets the maximum transaction amount to the total supply twice.
Recommendation: The maximum transaction amount can be set to the total supply once for additional gas savings on each call.function removeLimits() external onlyOwner { limitsInEffect = false; transferDelayEnabled = false; maxTransaction = totalSupply(); maxTransaction = totalSupply(); }
Resolution: The team has implemented the above recommendation.
Contract Overview
Ownership Controls:
- The total supply of the token is set to 1 billion $VNW [1,000,000,000].
- No mint or burn functions are accessible, though the circulating supply can be decreased by sending tokens to the 0x..dead address.
- There was no token allocation for our team to analyze as the contract has yet to be deployed to the mainnet.
- Trading must be enabled by the owner before all transfers can take place on the platform. Only accounts that have been excluded from fees can participate in transfers when trading is disabled. Once trading is enabled it can never be disabled.
- The contract enforces a transfer delay which prevents a transfer from occurring if the user is attempting to either buy tokens or participate in a peer-to-peer transfer more than one time per two blocks.
- The contract enforces a maximum transaction amount (determined by the owner) which imposes a limit to the number of tokens that can be bought or sold via Uniswap per transaction.
- There is a Liquidity fee, Treasury fee, and Project fee on all transfers via Uniswap 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 or a sell.
- The tokens collected through the Treasury fee and Project fee are stored in the contract address. The tokens are swapped for ETH and sent to the team's Treasury wallet and Project wallet 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 swapping tokens.
- The caller is not initiating a buy transaction via Uniswap.
- Neither the sender nor the recipient is excluded from fees.
- The tokens collected through the Liquidity fee are sent from the contract to the Pair address.
- The team can upgrade the contract at any time.
- As the contract is implemented with Solidity v0.8.x, it is protected from overflows/underflows.
- The contract complies with the ERC-20 token standard.
- The owner can set total sell fees and total buy fees up to 15% each at any time.
- The owner can exclude and include accounts from transfer fees at any time.
- The owner can set the maximum transaction amount to any value greater than 1 million tokens at any time.
- The owner can include and exclude any accounts from the maximum transaction restriction at any time.
- The owner can disable the maximum transaction restriction at any time.
- The owner can update the threshold number of tokens needed to trigger an automatic liquidity add to any value between 10,000 and 1 million tokens at any time.
- The owner can airdrop any number of tokens to up to 300 addresses per transaction at any time.
- The owner can disable the transfer delay at any time. Once disabled, it can never be enabled.
- The owner can manually trigger the automatic token swapping functionality at any time if the threshold number of tokens in the contract address has been reached.
- The owner can add/remove addresses from the Automated Market Maker Pair list at any time.
- The owner can withdraw any ETH from the contract at any time.
- The owner can withdraw any tokens from the contract besides $VNW after trading has been enabled.
- The owner can update the team's Treasury wallet and Project wallet at any time.
Audit Results
Vulnerability Category | Notes | Result |
---|---|---|
Arbitrary Jump/Storage Write | N/A | PASS |
Centralization of Control | The team can upgrade the contract at any time. | WARNING |
Compiler Issues | N/A | PASS |
Delegate Call to Untrusted Contract | N/A | PASS |
Dependence on Predictable Variables | N/A | PASS |
Ether/Token Theft | N/A | PASS |
Flash Loans | N/A | PASS |
Front Running | N/A | PASS |
Improper Events | N/A | PASS |
Improper Authorization Scheme | N/A | PASS |
Integer Over/Underflow | N/A | PASS |
Logical Issues | N/A | PASS |
Oracle Issues | N/A | PASS |
Outdated Compiler Version | N/A | PASS |
Race Conditions | N/A | PASS |
Reentrancy | N/A | PASS |
Signature Issues | N/A | PASS |
Sybil Attack | N/A | PASS |
Unbounded Loops | N/A | PASS |
Unused Code | N/A | PASS |
Overall Contract Safety | PASS |
Inheritance Chart
Function Graph
Functions Overview
($) = payable function
# = non-constant function
Int = Internal
Ext = External
Pub = Public
+ [Int] IERC20Upgradeable
- [Ext] totalSupply
- [Ext] balanceOf
- [Ext] transfer #
- [Ext] allowance
- [Ext] approve #
- [Ext] transferFrom #
+ [Int] IERC20MetadataUpgradeable (IERC20Upgradeable)
- [Ext] name
- [Ext] symbol
- [Ext] decimals
+ [Lib] AddressUpgradeable
- [Int] isContract
- [Int] sendValue #
- [Int] functionCall #
- [Int] functionCall #
- [Int] functionCallWithValue #
- [Int] functionCallWithValue #
- [Int] functionStaticCall
- [Int] functionStaticCall
- [Int] verifyCallResult
+ Initializable
- [Int] _disableInitializers #
+ ContextUpgradeable (Initializable)
- [Int] __Context_init #
- modifiers: onlyInitializing
- [Int] __Context_init_unchained #
- modifiers: onlyInitializing
- [Int] _msgSender
- [Int] _msgData
+ ERC20Upgradeable (Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable)
- [Int] __ERC20_init #
- modifiers: onlyInitializing
- [Int] __ERC20_init_unchained #
- modifiers: onlyInitializing
- [Pub] name
- [Pub] symbol
- [Pub] decimals
- [Pub] totalSupply
- [Pub] balanceOf
- [Pub] transfer #
- [Pub] allowance
- [Pub] approve #
- [Pub] transferFrom #
- [Pub] increaseAllowance #
- [Pub] decreaseAllowance #
- [Int] _transfer #
- [Int] _mint #
- [Int] _burn #
- [Int] _approve #
- [Int] _spendAllowance #
- [Int] _beforeTokenTransfer #
- [Int] _afterTokenTransfer #
+ OwnableUpgradeable (Initializable, ContextUpgradeable)
- [Int] __Ownable_init #
- modifiers: onlyInitializing
- [Int] __Ownable_init_unchained #
- modifiers: onlyInitializing
- [Pub] owner
- [Int] _checkOwner
- [Pub] renounceOwnership #
- modifiers: onlyOwner
- [Pub] transferOwnership #
- modifiers: onlyOwner
- [Int] _transferOwnership #
+ [Int] IERC20
- [Ext] balanceOf
- [Ext] transfer #
+ [Int] IDexRouter
- [Ext] factory
- [Ext] WETH
- [Ext] swapExactTokensForETHSupportingFeeOnTransferTokens #
- [Ext] swapExactETHForTokensSupportingFeeOnTransferTokens ($)
- [Ext] swapExactTokensForTokensSupportingFeeOnTransferTokens #
- [Ext] addLiquidityETH ($)
- [Ext] addLiquidity #
- [Ext] getAmountsOut
+ [Int] IDexFactory
- [Ext] createPair #
+ VNetwork (Initializable, ERC20Upgradeable, OwnableUpgradeable)
- [Pub] initialize #
- modifiers: initializer
- [Ext] ($)
- [Ext] enableTrading #
- modifiers: onlyOwner
- [Ext] removeLimits #
- modifiers: onlyOwner
- [Ext] disableTransferDelay #
- modifiers: onlyOwner
- [Ext] updateMaxTransaction #
- modifiers: onlyOwner
- [Ext] updateSwapTokensAtAmount #
- modifiers: onlyOwner
- [Prv] _excludeFromMaxTransaction #
- [Ext] airdropToWallets #
- modifiers: onlyOwner
- [Ext] excludeFromMaxTransaction #
- modifiers: onlyOwner
- [Ext] setAutomatedMarketMakerPair #
- modifiers: onlyOwner
- [Prv] _setAutomatedMarketMakerPair #
- [Ext] updateBuyFees #
- modifiers: onlyOwner
- [Ext] updateSellFees #
- modifiers: onlyOwner
- [Ext] massExcludeFromFees #
- modifiers: onlyOwner
- [Pub] excludeFromFees #
- modifiers: onlyOwner
- [Int] _transfer #
- [Prv] swapTokensForEth #
- [Prv] swapBack #
- [Ext] transferForeignToken #
- modifiers: onlyOwner
- [Ext] withdrawStuckETH #
- modifiers: onlyOwner
- [Ext] setTreasuryAddress #
- modifiers: onlyOwner
- [Ext] setProjectAddress #
- modifiers: onlyOwner
- [Ext] forceSwapBack #
- modifiers: onlyOwner
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 1300+ 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 across 1500 projects!. 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.