Part of CertiK’s retainer series
CertiK reviewed WEMIX (Wemix Retainer 121 wepublicBank) on 2 Aug 2024: 7 findings, 0 critical; 3 marked fixed, 4 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 | 0 |
| Low | 2 | 0 | 3 |
The sequence of checks within the `cancelProject` and `settleProject` function can be optimized to save gas. Specifically, the check for `msg.sender` should be arranged before the signature validation. This is because the `msg.sender` check is simpler and less computationally intensive compared to the signature validation. By performing this check first, unnecessary computationally expensive operations can be avoided if the `msg.sender` check fails. ```solidity=560 require( RbacSignatureValidator.isValidSignature( wepublicPoint, keccak256(packedData), signature, CANCEL_FUNDING_PROJECT_ROLE ), "FundingProjectTreasury: invalid signature" ); require( projectTreasury == address(this), "FundingProjectTreasury: invalid project treasury" ); require( msg.sender == projectOwner, "FundingProjectTreasury: invalid project owner" ); ```
In the function `fund()`, if the current type is `Wemix`, the sender will pay the native token to this contract and then transfer it to the project owner. However, if the current type is `WepublicPoint`, the `wepublicPoint` contract mints tokens to this contract but does not reduce any tokens from the sender. This could potentially allow users to fund projects without actually spending their own tokens, leading to "funding out of thin air." ```solidity=361 if (targetCurrencyType == CurrencyType.Wemix) { require( msg.value == fundAmount, "FundingProjectTreasury: invalid msg.value for Wemix" ); payable(projectOwner).transfer(fundAmount); } else if (targetCurrencyType == CurrencyType.WepublicPoint) { require( msg.value == 0, "FundingProjectTreasury: invalid msg.value for WP" ); IWepublicPointV2(wepublicPoint).mint(fundAmount); ```
In the function `_cancelProject()`, the `fundedAmounts` of the funders and `totalLockedBalance` are updated. However, the `rewardQuantityOfFunder` and `_rewardInfos` are not updated. If the `REWARD_DISTRIBUTOR_ROLE` role mistakenly distributes the removed funders, they can still receive the NFT reward even though their fund amount is 0. ```solidity=929 cancelAmounts[i] = fundedAmount; accumulatedBalance += fundedAmount; _totalLockedBalance -= fundedAmount; fundedAmounts[funder] = 0; //@audit: `rewardQuantityOfFunder` and `_rewardInfos` not updated here ``` Additionally, the function `distributeReward` should decrease the `_rewardInfos[rewardId].totalQuantity`. ```solidity=714 for (uint i = 0; i < infos.length;) { DistributeInfo memory info = infos[i]; --rewardQuantityOfFunder[info.to][rewardId]; //@audit: _rewardInfos[rewardId].totalQuantity not updated here IERC721Upgradeable(_reward.tokenAddress).safeTransferFrom(vault, info.to, info.tokenId); unchecked { ++i; } } ```
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (2)
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