Wemix Retainer 113 Liquid Staking

CertiKFiles named in the report

Audit

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.

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

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings15

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

SeverityOpenAcknowledgedFixed
Critical000
High200
Medium106
Low204
Medium`pendingMigrationAmount` is not updated to 0Fixed

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."); } ```

MediumFront-running RiskFixed

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.

MediumMissing Value Assignment Sentences In State VariaFixed

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.

MediumPotential Incorrect Staking AddressFixed

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()`.

MediumThe function `initialize()` may revertFixed

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.

MediumThe function `withdraw()` of the `staking` contraFixed

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.

LowMissing Check staking amount of this contractFixed

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.

LowMissing Zero Address ValidationFixed

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.

LowRedundant CodeFixed

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

LowThe `withdraw()` function does not match the oneFixed

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

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)

  • contracts/StWEMIXV6.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