Part of CertiK’s retainer series
CertiK reviewed WEMIX (Wemix Retainer 117 SupportProjectTreasuryV2) on 28 May 2024: 12 findings, 0 critical; 5 marked fixed, 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 | 2 | 0 | 0 |
| Medium | 0 | 0 | 2 |
| Low | 5 | 0 | 3 |
The state variable `currentSupporterNumber` is designed to keep track of the total number of supporters. The logic implemented to increment and decrement this variable is flawed, leading to incorrect tracking. The problems are identified in two functions: 1. The `support()` function increments `currentSupporterNumber` each time it is called by a supporter. There is no condition to check if the caller has already been accounted for, which results in multiple increments by the same supporter. 2. The `cancelProject()` function attempts to decrement `currentSupporterNumber` under a condition that cannot be fulfilled as the variables `wemixCancelAmounts[i]` and `wepublicPointCancelAmounts[i]` are never set to zero within the function. This leads to a situation where `currentSupporterNumber` does not decrease as intended. Due to these issues, `currentSupporterNumber` does not reflect the true number of unique supporters, and as a result, the contract's status cannot be set to `Cancelled` when it should be: ```solidity=364 if (currentSupporterNumber == 0) { // <= never happen require( totalLockedWemix == 0 && totalLockedWepublicPoint == 0, "SupportProjectTreasuryV2: invalid total amount for a refund" ); status = SupportProjectStatus.Cancelled; } ```
The contract functions `cancelProject()` and `settleProject()` lack the necessary protection against signature replay. This is due to the absence of the `onlyUnusedSignature` modifier on these functions. Without this modifier, there is no mechanism to prevent the same signature from being used more than once to authorize these actions. As a result, the `projectOwner` has the capability to replay signatures, allowing them to execute the `cancelProject()` function multiple times with the same signature.
In the `settleProject()` function, the project is settled by transferring the `totalLockedWepublicPoint` amount to the project owner and setting its value to zero. However, the state variable `totalLockedWemix` is not reset to zero after the project is settled. This can lead to confusion, as the view function `totalLockedWemix()` still returns the total supported WEMIX amount, even though the project has been settled and all WEMIX coins have already been transferred to the project owner.
There is an inconsistency between the comment and the actual implementation in the `deactivateProject()` function. The comment indicates that the signed account must possess the `DEACTIVATE_SUPPORT_PROJECT` role. However, the implemented code checks for the `CANCEL_SUPPORT_PROJECT_ROLE` instead. This discrepancy can lead to confusion about the required permissions for signing signatures for the `deactivateProject()` function. There is no role defined as `DEACTIVATE_SUPPORT_PROJECT` within the contract.
All upgradeable contracts in an inheritance chain must follow the same rules for writing upgradeable contracts: One should avoid using non-upgradeable contracts as base contracts in an upgradeable contract. However, the current contract inherits a non-upgradeable base contract `ReentrancyGuard`, while an upgradeable equivalent is available in OpenZeppelin's `contracts-upgradeable` repository. Reference: - https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#use-upgradeable-libraries.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (1)
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