WEMIX Swap & DIOS(Dollar in and out Stabilizer)

CertiKFiles named in the report

CertiK reviewed WEMIX (WEMIX Swap & DIOS(Dollar in and out Stabilizer)) on 18 Oct 2022: 24 findings, 0 critical; 15 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.

Findings24

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

SeverityOpenAcknowledgedFixed
Critical000
High401
Medium101
Low4013
HighCentralization Risks in HellowWorld.solFixed

In the contract `HellowWorld` the role `initializer` has authority over the functions shown in the diagram below. Any compromise to the `initializer` account may allow the hacker to take advantage of this authority. ![](https://accelerator-tasks-prod.acc.corp.certik.com/92834db9749b45df8d3b70215b5a74e5/diagrams/centralization_HellowWorld-HellowWorld-initializer.svg)

MediumLogical issue of `onlyWallet`Fixed

The modifier `onlyWallet` has such check: ```solidity require(msg.sender == address(this), "Treasury: Only Wallet can access."); ``` , which means the `msg.sender` should be the contract itself, however, the following related functions: `addOwner()`, `removeOwner()`, `replaceOwner()` and `changeQuorum()` are not externally called in this contract, as a result, these functions could never be called.

LowCode comments in two languagesFixed

Code commented in both Korean and English.

LowDivide Before MultiplyFixed

Performing integer division before multiplication truncates the low bits, losing the precision of calculation. ```solidity=17 uint256 invariant = reserveA * reserveB * truePriceTokenB / truePriceTokenA; ``` ```solidity=19 uint256 leftSide = Babylonian.sqrt(53200 * invariant / 53067 + reserveA * reserveA / 636804); ```

LowMissing Emit EventsFixed

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

LowMissing Error MessagesFixed

The **require** can be used to check for conditions and throw an exception if the condition is not met. It is better to provide a string message containing details about the error that will be passed back to the caller.

LowMissing InheritanceFixed

`WWEMIX` implements the interface `IWWEMIX`, but does not inherit from it. ```solidity=7 contract WWEMIX is ERC20 { ``` ```solidity=6 interface IWWEMIX is IERC20 { ```

LowMissing Zero Address ValidationFixed

Addresses should be checked before assignment or external call to make sure they are not zero addresses. ```solidity=86 WUSDC = _WUSDC; ``` - `_WUSDC` is not zero-checked before being used. --- ```solidity=87 WEMIX$ = _WEMIX$; ``` - `_WEMIX$` is not zero-checked before being used. --- ```solidity=88 weswapFactory = _weswapFactory; ``` - `_weswapFactory` is not zero-checked before being used. --- ```solidity=90 WUSDCTreasury = _WUSDCTreasury; ``` ```solidity=91 feePool = _WUSDCTreasury; ``` - `_WUSDCTreasury` is not zero-checked before being used. --- ```solidity=92 stabilityPool = _stabilityPool; ``` - `_stabilityPool` is not zero-checked before being used. --- ```solidity=52 WUSDC = _WUSDC; ``` - `_WUSDC` is not zero-checked before being used. --- ```solidity=53 WEMIX$ = _WEMIX$; ``` - `_WEMIX$` is not zero-checked before being used. --- ```solidity=54 WUSDCTreasury = _WUSDCTreasury; ``` - `_WUSDCTreasury` is not zero-checked before being used.

LowThe `_FromTokenBContractAddress` checkFixed

Given the `_FromTokenAContractAddress` is checked whether it is one of the paired tokens, we assume a check for `_FromTokenBContractAddress` should also be added to ensure logical completeness.

LowThe existence of `_pairAddress` should be checkeFixed

The existence of `_pairAddress` should be checked to ensure `token0` and `token1` are existing.

Show 5 more
LowThe number of `_quorum` and `_owners.length`Fixed

The `_quorum` should be larger than one to prevent one of the owners confirm and executing its own submitted transactions, besides, the `_owners.length` should be larger than two to guarantee it is a voting system.

LowUnchecked ERC-20 `transfer()`/`transferFrom()` CaFixed

The return value of the transfer()/transferFrom() call is not checked. ```solidity=348 IERC20(WEMIX$).transfer(feePool, _amount); ``` --- ```solidity=356 IERC20(WEMIX$).transfer(stabilityPool, _amount); ``` --- ```solidity=377 IERC20(_path[0]).transfer(weswapStablecoinsPair, _amounts[0]); ``` --- ```solidity=407 IERC20(WUSDC).transferFrom(WUSDCTreasury, address(this), _amounts[0]); ``` --- ```solidity=69 IWUSDC(WUSDC).transferFrom(WUSDCTreasury, msg.sender, _amount); ``` --- ```solidity=75 IWUSDC(WUSDC).transferFrom(msg.sender, WUSDCTreasury, _amount); ```

LowUnlocked Compiler VersionFixed

The contract has unlocked compiler version. An unlocked compiler version in the source code of the contract permits the user to compile it at or above a particular version. This, in turn, leads to differences in the generated bytecode between compilations due to differing compiler version numbers. This can lead to an ambiguity when debugging as compiler specific bugs may occur in the codebase that would be hard to identify over a span of multiple compiler versions rather than a specific one.

LowUnused EventFixed

```solidity=479 event ExecuteArbitrageSwapWithPrice(uint256[] amounts, address[] arbPath, bool checkArbState, uint256 feePoolAmount, uint256 stabilityPoolAmount); ``` - `ExecuteArbitrageSwapWithPrice` is declared in `DollarInAndOutStaking` but never emitted.

LowVariables That Could Be Declared as ImmutableFixed

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

  • contracts/interfaces/IWeswapZapIn.sol
  • contracts/WeswapERC20.sol
  • contracts/interfaces/IWUSDC.sol
  • contracts/WemixDollarExchange.sol
  • contracts/interfaces/IWeswapZapOut.sol
  • contracts/WUSDCTreasury.sol
  • contracts/WeswapRouter.sol
  • contracts/WeswapFactory.sol
  • contracts/interfaces/IWemixDollarExchange.sol
  • contracts/libraries/WeswapV2LiquidityMathLibrary.sol
  • contracts/interfaces/IWWEMIX.sol
  • contracts/extensions/HellowWorld.sol
  • contracts/libraries/WeswapLibrary.sol
  • contracts/interfaces/IWemixDollar.sol
  • contracts/libraries/Math.sol
  • contracts/interfaces/IWeswapCallee.sol
  • contracts/libraries/TransferHelper.sol
  • contracts/DollarInAndOutStaking.sol
  • contracts/interfaces/IDollarInAndOutStaking.sol
  • contracts/tokens/WemixDollar.sol
  • contracts/WeswapZapIn.sol
  • contracts/libraries/UQ112x112.sol
  • contracts/interfaces/IWeswapPair.sol
  • contracts/interfaces/IWUSDCTreasury.sol
  • contracts/interfaces/IWeswapERC20.sol
  • contracts/tokens/WWEMIX.sol
  • contracts/interfaces/IWeswapFactory.sol
  • contracts/interfaces/IERC20.sol
  • contracts/WeswapPair.sol
  • contracts/WeswapZapOut.sol
  • contracts/utils/Utils.sol
  • contracts/ZapBase.sol
  • contracts/libraries/Babylonian.sol
  • contracts/interfaces/IWeswapRouter.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,044 projects reviewed · 1,393 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