Wemix Retainer 117 SupportProjectTreasuryV2

CertiKFiles named in the report

Audit

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.

No open critical findings
Open the reportOpen WEMIX’s security record

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings12

Statuses are the security firm’s own, from its report.

SeverityOpenAcknowledgedFixed
Critical000
High200
Medium002
Low503
MediumIncorrect accounting for `currentSupporterNumber`Fixed

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; } ```

MediumSignatures can be reusedFixed

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.

Low`totalLockedWemix` Not Reset to Zero After ProjecFixed

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.

LowThe signer role for `deactivateProject()` probablFixed

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.

LowUpgradeable Contracts Should Not Inherit Non-UpgrFixed

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.

Contracts in scope

No deployed address is recorded for this audit.

The report names a repository or files. Open the report to see its scope.

Repository and files the report names (1)

  • src/SupportProjectTreasuryV2.sol

Part of WEMIX’s security record

WEMIX
Audits75 audits by 1 firmLast audit Feb 2025, by CertiK.
Critical findingsNo open critical findingsAcross the 75 reports, 17 critical findings were reported. Each is marked fixed by the firm that reported it.
Open WEMIX’s security record

Security firm

CertiK

1,045 projects reviewed · 1,376 reports · latest May 2025

See CertiK’s audits

Something 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