CertiK reviewed BlocX (blocxchain.org) on 21 Aug 2023: 19 findings, 0 critical; none marked fixed.
Report hosted on skynet.certik.com.
Trustblock does not review code.
Statuses are the security firm’s own, from its report.
| Severity | Open | Acknowledged | Fixed |
|---|---|---|---|
| Critical | 0 | 0 | 0 |
| High | 2 | 0 | 0 |
| Medium | 3 | 0 | 0 |
| Low | 14 | 0 | 0 |
In the contract `BlocX` the role `_owner` has authority over the functions shown in the diagram below. Any compromise to the `_owner` account may allow the hacker to take advantage of this authority and exclude its EoAs from the fees and include all of the other addresses in the fees.  In the contract `Ownable` the role `_owner` has authority over the functions shown in the diagram below. Any compromise to the `_owner` account may allow the hacker to take advantage of this authority and transfer the ownership to any of its EoAs gaining exclusive control of the contract. 
All of the `BLX` tokens are sent to the contract deployer or one or several externally-owned account (EOA) addresses. This is a centralization risk because the deployer or the owner(s) of the EOAs can distribute tokens without obtaining the consensus of the community. Any compromise to these addresses may allow a hacker to steal and sell tokens on the market, resulting in severe damage to the project.
The `BlocX` contract has a whitelist used for excluding some addresses from the fees mechanism. For example, ```solidity=707 _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_marketingWallet] = true; ``` However, the address of the **Liquidity Pool Pair** is not whitelisted from the fees. Therefore, it might lead to an **unbalanced** liquidity pool.
The funciton `sendValue` of the contract `Address` has been modified to change the `recipient` address to the `0xdEaD` address. In this way, any call to `sendValue` will result in a burn operation.
The function `_tranfer` is designed to limit the amount of tokens transferred in a single transaction or the total owned by an account. However, the owner account is exempted from this limit.
The transaction may be charged fees, so the max holding of the receiver should be the sum of the held tokens and the amount received from the transfer. The fees should not be included in the max holding. ```solidity=808 require(balanceOf(to) + amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount."); ``` - Max holding is checked. ```solidity=829 transferAmount = _getValues(amount, from); ``` - Receiving amount is adjusted. ```solidity=832 _tOwned[to] += transferAmount; ``` - Balance is increased by the adjusted amount.
In the function `_transfer`, the variable `_maxTxAmount` name is misleading, since the only way it is used is to check wether `balanceOf(to) + amount < _maxTxAmount`. Therefore, this variable is expressing the maximum amount of tokens an account can hold, not the maximum transaction amount.
The function should revert before calling `_transfer()` if the transaction amount is greater than the amount which `caller(msg.sender)` is still allowed to withdraw from `sender`. ```solidity=697 function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "BEP20: transfer amount exceeds allowance")); return true; } ```
There should be a check to ensure `recipient != msg.sender` to avoid users' transferring to themselves.
Based on the current contract code logic, in general, the following two addresses on the `BSC` chain are not valid holding account addresses. Therefore, the Dead address check logic should be added to the zero address check wherever it is performed. 1. Dead: 0x000000000000000000000000000000000000dEaD 2. Zero address: 0x0
The function `swapTokensForEth()` doesn't check if the `tokenAmount` variable is above zero before executing. This could cause gas costs for each function call.
The `SafeMath` library version used in the contract seems to be made for solidity versions anterior to 0.8.0. With compiler versions 0.8.0 or newer, arithmetic operations will automatically revert in case of integer overflow or underflow. Therefore, this library functions are performing redundant checks.
The change of `_owner` by function `transferOwnership()` overrides the previously set `_owner` with the new one without guaranteeing the new `_owner` is able to actuate transactions on-chain.
The linked statements do not affect the functionality of the codebase and appear to be either leftovers from test code or older functionality.
The variable `_buyCooldown` is initialized to `0 minutes`. Since it remains unmodified and is only utilized in the `_transfer()` function for an addition operation, its zero value renders it redundant.
State variables that never change should be declared as `constant` to save gas. ```solidity=678 uint256 private _tTotal = 1_000_000_000 * 10**9; ``` - `_tTotal` should be declared `constant`. --- ```solidity=679 uint256 public _maxTxAmount = 20_000_000 * 10**9; // ``` - `_maxTxAmount` should be declared `constant`. --- ```solidity=685 uint256 public _marketingFee = 8; ``` - `_marketingFee` should be declared `constant`. --- ```solidity=686 uint256 public _liquidityFee = 2; ``` - `_liquidityFee` should be declared `constant`. --- ```solidity=687 address public _marketingWallet = 0x0B67f86128A538639f575F9bee1cDB43675eF6ab; ``` - `_marketingWallet` should be declared `constant`. --- ```solidity=689 uint256 public _buyCooldown = 0 minutes; ``` - `_buyCooldown` should be declared `constant`.
The smart contract contains one or more values that are not used, which can lead to unnecessary complexity and reduced maintainability. ```solidity=852 liquidityTokens = 0; ``` - The variable `liquidityTokens` is never used after this assignment.
It is not recommended to use Solidity's `transfer()` and `send()` functions for transferring native tokens, since some contracts may not be able to receive the funds. Those functions forward only a fixed amount of gas (2300 specifically) and the receiving contracts may run out of gas before finishing the transfer. Also, EVM instructions' gas costs may increase in the future. Thus, some contracts that can receive now may stop working in the future due to the gas limitation. ```solidity=841 payable(_marketingWallet).transfer(ethToSend); ``` - `BlocX.swapAndSendToFee` uses `transfer()`.
The linked variables assigned in the constructor can be declared as `immutable`. Immutable state variables can be assigned during contract creation but will remain constant throughout the lifetime of a deployed contract. A big advantage of immutable variables is that reading them is significantly cheaper than reading from regular state variables since they will not be stored in storage.
| Address | Chain | Source code |
|---|---|---|
| 0x2f5f…6c300x2f5fb3d3ab21bde07c5aa389e92366651b406c30 | Chain: BNB Chain | Source code: Verified source |
1,045 projects reviewed · 1,376 reports · latest May 2025
See CertiK’s auditsSomething wrong on this page? A missing report, a wrong date, a finding that was fixed since. Tell us and we check it against its source.
Tell us