Part of CertiK’s retainer series
CertiK reviewed WEMIX (Wemix Retainer 113 Liquid Staking) on 15 Apr 2024: 15 findings, 0 critical; 10 marked fixed, 5 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 | 1 | 0 | 6 |
| Low | 2 | 0 | 4 |
In the functions `wonderUpdate()` and `wonderMigrateFromExitPid()`, the `pendingMigrationAmount` tokens are deposited into the new staking pool, but the `pendingMigrationAmount` itself is not updated to 0. If the owner calls the function `wemixWithdraw()` to withdraw `wemix`, it will revert due to the `pendingMigrationAmount` not being 0. ```solidity function wemixWithdraw() external onlyOwner { require( pendingMigrationAmount == 0, "StWEMIXV2::wemixWithdraw: cannot withdraw in migration period." ); (bool success, ) = _msgSender().call{value: address(this).balance}(""); require(success, "StWEMIXV2::wemixWithdraw."); } ```
The function `initialize()` is used to set the staking address and pid and deposit the contract's balance to the new staking address. This function can only be called once and should be called immediately after deployment by the deployer. However, the chain does not support executing multiple transactions together. Thus, a hacker may front-run the `initialize()` call and set the staking address and withdraw all tokens of this contract.
This function is declared for updating a state variable with passed-in arguments, but no value assignment sentence exists. The function fails to implement its intended function of updating the state variable.
The owner calls the function `wonderMigrate()` to update the pending staking address and pending pid, and to claim rewards from the pid pool followed by a request to withdraw from the pid pool. However, the parameter `wonder` represents the pending staking address. If the `wonder` is not equal to `staking`, the contract cannot claim any rewards from `wonder` and may fail to execute the function `withdrawRequest()`.
The function `initialize()` uses the modifier `reinitializer()` to re-initialize. However, the function `initialize()` calls the function `_phaseShift()`, which requires `phaseTwo` to be `false`. If `phaseTwo` was updated in the previous upgrade, the function `initialize()` will revert and will not be able to update the new staking address and `pid` variable.
In the function `wonderMigrateFromExitPid()`, the contract claims rewards from the pid pool and requests withdrawal from the pid pool. However, the function does not invoke the function `withdraw()` of the staking contract to withdraw its deposited amount. The `pendingMigrationAmount` is the sum of the deposit amount and the rewards. Therefore, the function `deposit()` will revert due to insufficient balance.
In the function `wonderMigrate()`, there is no check to ensure that the staking amount of this contract is greater than 0. If the owner has already invoked the function `wonderMigrate()` to withdraw all deposits but did not execute the function `wonderUpdate()`, then calling the function `wonderMigrate()` again will override the `pendingTokenId`, `pendingStaking`, `pendingPid` and `pendingMigrationAmount` if the `withdrawRequest()` can receive a 0 amount. As a result, the owner will not be able to withdraw the contract's deposits.
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=64 staking = wonder_; ``` - `wonder_` is not zero-checked before being used. --- ```solidity=105 pendingStaking = wonder; ``` - `wonder` is not zero-checked before being used.
The logic from lines 56 to 65 is redundant because it has already been implemented in the function `_phaseShift()`. ```solidity INCPStaking(wonder_).deposit{value: address(this).balance}( wonderPid_, address(this).balance, payable(address(this)), false, false ); staking = wonder_; pid = wonderPid_; ```
The Interface `withdraw` defines four parameters: `pid`, `amount`, `to` and `claimReward`. However, the `withdraw()` function in the `staking` contract only accepts three parameters: `pid`, `tokenId` and `to`. This mismatch in function parameters can lead to invocation failures. ```solidity=79 IStaking(staking).withdraw(pid, 0, payable(address(this)), true); ```
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