Wemix FT Staking Pool - Retainer#15

CertiKFiles named in the report

Audit

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.

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

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings13

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

SeverityOpenAcknowledgedFixed
Critical000
High000
Medium203
Low701
MediumInsufficient `rt` Balance Could Block Users FromOpen

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.

MediumPotential Vault Migration RiskOpen

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.

LowIncompatibility with Deflationary TokensOpen

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.

LowMissing Emit EventsOpen

There should always be events emitted in the sensitive functions that are controlled by centralization roles.

LowNo Cap on FeesOpen

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.

LowPotential Inconsistencies Amongst the Various LimOpen

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

LowThird Party DependencyOpen

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

LowUsers' Staked Tokens Might Be Paid Out to Other UOpen

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.

LowVariables That Could Be Declared as ImmutableOpen

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.

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 (20)

  • Common/Staking/v2/interface/ISPMineSchedule.sol
  • Common/Staking/v2/option/SPLockUp.sol
  • Common/Staking/v2/base/calculator/SPFeeCalculator.sol
  • SampleContract/StakingPoolV2/SampleSPSchedule.sol
  • Standard/StakingPool/SPRevenue.sol
  • Common/Staking/v2/interface/ISPMultiPoint.sol
  • SampleContract/StakingPoolV2/SampleSPRevenue.sol
  • Common/Staking/v2/interface/ISPMineRevenue.sol
  • Common/Staking/v2/core/SPMineRevenue.sol
  • Common/Staking/v2/core/SPMineSchedule.sol
  • Common/Staking/v2/base/calculator/SPKCalculator.sol
  • Common/Staking/v2/interface/ISPLockUp.sol
  • Common/Staking/v2/interface/ISPLimit.sol
  • Common/Staking/v2/interface/ISPCoolTime.sol
  • Common/Staking/v2/option/SPMultiPoint.sol
  • Common/Staking/v2/interface/ISPBase.sol
  • Common/Staking/v2/option/SPLimit.sol
  • Common/Staking/v2/option/SPCoolTime.sol
  • Common/Staking/v2/base/SPBase.sol
  • Standard/StakingPool/SPSchedule.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