Part of CertiK’s retainer series
CertiK reviewed WEMIX (Wemix FT Staking Pool - Retainer#15) on 4 Apr 2023: 13 findings, 0 critical; 4 marked fixed, 9 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 | 0 | 0 |
| Medium | 2 | 0 | 3 |
| Low | 7 | 0 | 1 |
In the external `unstake()` function, the `_claim()` function is called. In order for the `_claim()` function to execute successfully, there needs to be sufficient `rt` token balance in the `rtVault` contract or `address(this)`, depending on the setup of the contract. There is no guarantee that there is always sufficient `rt` token balance, in which case users would be unable to withdraw their staked token balance.
The constructor of the `SPBase` contract sets the `rtVault` and `stVault` to `address(this)`, but the owner can migrate vaults and transfer all user funds to the new vaults through the `setVault()` function. The new vaults can be compromised / might not have all the users' staking and reward details, and this may lead to lost or stolen assets. Any compromise to the owner's account may allow a hacker to take advantage of this authority.
When transferring deflationary ERC20 tokens, the input amount may not be equal to the received amount due to the charged transaction fee. For example, if a user sends 100 deflationary tokens (with a 10% transaction fee), only 90 tokens actually arrived to the contract. However, a failure to discount such fees may allow the same user to withdraw 100 tokens from the contract, which causes the contract to lose 10 tokens in such a transaction.
There should always be events emitted in the sensitive functions that are controlled by centralization roles.
The `setBaseFeePercent()` and `_setFeePercent()` functions only require each fee to be no greater than 100%. In the extreme case, the unstake fee could be as high as 100%, in which case users wouldn't be able to receive any tokens back when they unstake.
The `SPLimit` contract allows the owner to set various interconnected limits independently. The setter functions do not check whether the limit being set is consistent with the other existing limits. For example, nothing enforces that the `stakeMaxLimit` is greater than the `stakeMinLimit`, and nothing enforces that the `stakeUnit` modulo `unStakeUnit` equals 0 (if not, users won't be able to completely unstake their entire balance). The `SPCoolTime` contract allows the owner to set `stakeCoolTime`, `unstakeCoolTime`, and `claimCoolTime` independently. However, the `_claim()` function is always triggered in the external `stake()` and `unstake()` functions, and thus if `claimCoolTime` is greater than either `stakeCoolTime` or `unstakeCoolTime`, the latter would have no effect. Similarly, the `SPLockUp` contract contains no enforcement that `globalLu` is no smaller than the `userLu`.
The contract is serving as the underlying entity to interact with one or more third party protocols / addresses, such as `rt`, `st`, `rtVault`, `stVault`. The scope of the audit treats third party entities as black boxes and assume their functional correctness. However, in the real world, third parties can be compromised and this may lead to lost or stolen assets. In addition, upgrades of third parties can possibly create severe impacts, such as increasing fees of third parties etc. ```solidity=36 address public override rt; // reward token ``` - The contract `SPBase` interacts with third party contract with `IERC20` interface via `rt`. --- ```solidity=37 address public override st; // staking token ``` - The contract `SPBase` interacts with third party contract with `IERC20` interface via `st`. --- ```solidity=20 function _addIncome(Recipient storage r, bytes32 service, address token, bytes32 column, uint amount) internal { ``` - The function `RecipientLibV6._addIncome` interacts with third party contract with `IRecipientRoleV6` interface via `r`. --- ```solidity=28 function _addMintIncome(Recipient storage r, address token, uint amount) internal { ``` - The function `RecipientLibV6._addMintIncome` interacts with third party contract with `IRecipientRoleV6` interface via `r`.
The `SPBase` contract contains no restriction on the `rt` and `st` token addresses. If they are the same address, and the `rtVault` and `stVault` are also the same address as is the default in the constructor, then user A's staked token might be paid out as reward to user B when user B claims reward. This is possible because the contract does not guarantee that there's always sufficient `rt` token balance for reward payout, and there's no clear separation of funds.
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 (20)
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