CertiK reviewed The Green World (The Green World - Audit) on 11 Oct 2024: 10 findings, 0 critical; 3 acknowledged, 7 open.
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 | 0 | 3 | 0 |
| Medium | 0 | 0 | 0 |
| Low | 7 | 0 | 0 |
The `TheGreenWorld` introduce the `_isBuyingOnPancakeSwap` validation which intended to block the buy operations from pancake swap. However, beyond the issue we mentioned in TGW-05 and TGW-06, the following concerns were raised along with the mechanism: 1. Potential DoS on removing liquidity: While removing liquidity, the `$TGW` token will be transferred from the pool back to the user and if `_isBuyingOnPancakeSwap` check is valid(after solving TGW-05), the operation will be blocked. 2. Only one pool will be constrained: The contract only has one variable pancakeSwapPair to store a single pool/pair address. If multiple trading pools or pairs were to be created for this token, the constraints would only apply to the one specified pair, potentially limiting the effectiveness of the intended restrictions.
The `transfer` function enforces that if the `msg.sender` is labeled as a `dexAddress`, the `to` address must be the `tokenBuyingContract`. This restriction would mean that any buying operation/liquidity removal from DEXs, including PancakeSwap pairs, would need to have the tokenBuyingContract as the recipient. As a result, only the `tokenBuyingContract` can receive tokens directly from DEX addresses, which would affect buying operations and liquidity removal from users. At the same time, this check is absent in `transferFrom` function, potentially allowing the bypass of intended restrictions.
Several owner-controlled setter functions, such as `updatePancakeSwapRouter`, `addDexAddress`, and `setTokenBuyingContract`, can modify critical state variables like `pancakeSwapPair`, `dexAddresses`, and `tokenBuyingContract`. These variables are used in validation checks within the `transfer` and `transferFrom` functions. If these variables are not initialized promptly after the contract's deployment, users can execute `transfer` and `transferFrom` without restriction. This is because, until set, these variables will default to the zero address, rendering the validation checks ineffective.
The `updatePancakeSwapRouter` function is designed to allow the `owner` role to update the `pancakeSwapPair` variable. However, the accompanying comment states "function to update the pancakeswaprouteraddress," which may cause confusion. The naming of `pancakeSwapPair` suggests that this variable refers to the pair address on the PancakeSwap protocol, whereas the function name and comment imply that the function updates the router address. It is important to note that the router address and pair address are distinct entities within the PancakeSwap protocol. Based on the contract's logic, token transfers are restricted during buy operations on PancakeSwap. These buy and sell operations occur between users and the PancakeSwap pair, not the router address. Setting the state variable incorrectly could affect the normal functionality of the project, preventing it from achieving its intended design.
Addresses are not validated before assignment or external calls, potentially allowing the use of zero addresses and leading to unexpected behavior or vulnerabilities. For example, transferring tokens to a zero address can result in a permanent loss of those tokens. ```solidity=698 tokenBuyingContract = buytokenAddress; ``` - `buytokenAddress` is not zero-checked before being used. ```solidity=678 pancakeSwapPair = _newRouter; ``` - `_newRouter` is not zero-checked before being used.
The return values of the `transfer()` and `transferFrom()` calls in the smart contract are not checked. Some ERC-20 tokens' transfer functions return no values, while others return a bool value, they should be handled with care. If a function returns `false` instead of reverting upon failure, an unchecked failed transfer could be mistakenly considered successful in the contract. Otherwise, if the function returns no values, the transaction will revert due to an incompatible interface. ```solidity=756 token.transfer(recipient, balance); ```
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.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (1)
1,044 projects reviewed · 1,375 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