In this audit report we will highlight the following issues:
This audit report has been prepared by Coinsult’s experts at the request of the client. In this audit, the results of the static analysis and the manual code review will be presented. The purpose of the audit is to see if the functions work as intended, and to identify potential security issues within the smart contract.
The information in this report should be used to understand the risks associated with the smart contract. This report can be used as a guide for the development team on how the contract could possibly be improved by remediating the issues that were identified.
Note that we only audited the code available to us on this URL at the time of the audit. If the URL is not from any block explorer (main net), it may be subject to change. Always check the contract address on this audit report and compare it to the token you are doing research for.
Coinsult’s manual smart contract audit is an extensive methodical examination and analysis of the smart contract’s code that is used to interact with the blockchain. This process is conducted to discover errors, issues and security vulnerabilities in the code in order to suggest improvements and ways to fix them.
Coinsult uses software that checks for common vulnerability issues within smart contracts. We use automated tools that scan the contract for security vulnerabilities such as integer-overflow, integer-underflow, out-of-gas-situations, unchecked transfers, etc.
Coinsult’s manual code review involves a human looking at source code, line by line, to find vulnerabilities. Manual code review helps to clarify the context of coding decisions. Automated tools are faster but they cannot take the developer’s intentions and general business logic into consideration.
Coinsult uses certain vulnerability levels, these indicate how bad a certain issue is. The higher the risk, the more strictly it is recommended to correct the error before using the contract.
Coinsult has four statuses that are used for each risk level. Below we explain them briefly.
The Smart Contract Weakness Classification Registry (SWC Registry) is an implementation of the weakness classification scheme proposed in EIP-1470. It is loosely aligned to the terminologies and structure used in the Common Weakness Enumeration (CWE) while overlaying a wide range of weakness variants that are specific to smart contracts.
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Passed
Contract does not use a ReEntrancyGuard
One of the major dangers of calling external contracts is that they can take over the control flow. In the reentrancy attack (a.k.a. recursive call attack), a malicious contract calls back into the calling contract before the first invocation of the function is finished. This may cause the different invocations of the function to interact in undesirable ways.
function _transfer(address sender, address recipient, uint256 amount) private returns (bool) {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(inSwapAndLiquify)
{
return _basicTransfer(sender, recipient, amount);
}
else
{
if(!isTxLimitExempt[sender] && !isTxLimitExempt[recipient]) {
require(amount = _minimumTokensBeforeSwap;
if (overMinimumTokenBalance && !inSwapAndLiquify && !isMarketPair[sender] && swapAndLiquifyEnabled)
{
if(swapAndLiquifyByLimitOnly)
contractTokenBalance = _minimumTokensBeforeSwap;
swapAndLiquify(contractTokenBalance);
}
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
uint256 finalAmount = (isExcludedFromFee[sender] || isExcludedFromFee[recipient]) ?
amount : takeFee(sender, recipient, amount);
if(checkWalletLimit && !isWalletLimitExempt[recipient])
require(balanceOf(recipient).add(finalAmount) <= _walletMax);
_balances[recipient] = _balances[recipient].add(finalAmount);
emit Transfer(sender, recipient, finalAmount);
return true;
}
}
Recommendation
The best practices to avoid Reentrancy weaknesses are: Make sure all internal state changes are performed before the call is executed. This is known as the Checks-Effects-Interactions pattern, or use a reentrancy lock (ie. OpenZeppelin’s ReentrancyGuard.
Avoid relying on block.timestamp
block.timestamp can be manipulated by miners.
function getTime() public view returns (uint256) {
return block.timestamp;
}
Recommendation
Do not use block.timestamp
, now
or blockhash
as a source of randomness
Exploit scenario
contract Game {
uint reward_determining_number;
function guessing() external{
reward_determining_number = uint256(block.blockhash(10000)) % 10;
}
}
Eve is a miner. Eve calls guessing
and re-orders the block containing the transaction. As a result, Eve wins the game.
No zero address validation for some functions
Detect missing zero address validation.
function setMarketingWalletAddress(address newAddress) external onlyOwner() {
marketingWalletAddress = payable(newAddress);
}
Recommendation
Check that the new address is not zero.
Exploit scenario
contract C {
modifier onlyAdmin {
if (msg.sender != owner) throw;
_;
}
function updateOwner(address newOwner) onlyAdmin external {
owner = newOwner;
}
}
Bob calls updateOwner
without specifying the newOwner
, soBob loses ownership of the contract.
Missing events arithmetic
Detect missing events for critical arithmetic parameters.
function setMaxDesAmount(uint256 maxDestroy) public onlyOwner {
_maxDestroyAmount = maxDestroy;
}
Recommendation
Emit an event for critical parameter changes.
Exploit scenario
contract C {
modifier onlyAdmin {
if (msg.sender != owner) throw;
_;
}
function updateOwner(address newOwner) onlyAdmin external {
owner = newOwner;
}
}
updateOwner()
has no event, so it is difficult to track off-chain changes in the buy price.
Conformance to Solidity naming conventions
Allow _ at the beginning of the mixed_case match for private variables and unused parameters.
uint256 public _buyLiquidityFee = 2;
uint256 public _buyMarketingFee = 3;
uint256 public _buyTeamFee = 4;
uint256 public _buyDestroyFee = 0;
Recommendation
Follow the Solidity naming convention.
Rule exceptions
ERC20
)._
at the beginning of the mixed_case
match for private variables and unused parameters.Code With No Effects
Detect the usage of redundant statements that have no effect.
function _msgData() internal view virtual returns (bytes memory) {
this;
// silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
Recommendation
Remove redundant statements if they congest code but offer no value.
Exploit scenario
contract RedundantStatementsContract {
constructor() public {
uint; // Elementary Type Name
bool; // Elementary Type Name
RedundantStatementsContract; // Identifier
}
function test() public returns (uint) {
uint; // Elementary Type Name
assert; // Identifier
test; // Identifier
return 777;
}
}
Each commented line references types/identifiers, but performs no action with them, so no code will be generated for such statements and they can be removed.
Coinsult lists all important contract methods which the owner can interact with.
This is how the constructor of the contract looked at the time of auditing the smart contract.
contract TokenTool is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
string private _name;
string private _symbol;
uint8 private _decimals;
address payable public marketingWalletAddress;
address payable public teamWalletAddress;
address public deadAddress = 0x000000000000000000000000000000000000dEaD;
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public isExcludedFromFee;
mapping (address => bool) public isWalletLimitExempt;
mapping (address => bool) public isTxLimitExempt;
mapping (address => bool) public isMarketPair;
uint256 public _buyLiquidityFee = 2;
uint256 public _buyMarketingFee = 3;
uint256 public _buyTeamFee = 4;
uint256 public _buyDestroyFee = 0;
Coinsult checks the website completely manually and looks for visual, technical and textual errors. We also look at the security, speed and accessibility of the website. In short, a complete check to see if the website meets the current standard of the web development industry.
This audit report has been prepared by Coinsult’s experts at the request of the client. In this audit, the results of the static analysis and the manual code review will be presented. The purpose of the audit is to see if the functions work as intended, and to identify potential security issues within the smart contract.
The information in this report should be used to understand the risks associated with the smart contract. This report can be used as a guide for the development team on how the contract could possibly be improved by remediating the issues that were identified.
Coinsult is not responsible if a project turns out to be a scam, rug-pull or honeypot. We only provide a detailed analysis for your own research.
Coinsult is not responsible for any financial losses. Nothing in this contract audit is financial advice, please do your own research.
The information provided in this audit is for informational purposes only and should not be considered investment advice. Coinsult does not endorse, recommend, support or suggest to invest in any project.
Coinsult can not be held responsible for when a project turns out to be a rug-pull, honeypot or scam.