Wemix Retainer 102 DEX NFT Service

CertiKFiles named in the report

Audit

Part of CertiK’s retainer series

CertiK reviewed WEMIX (Wemix Retainer 102 DEX NFT Service) on 19 Mar 2024: 9 findings, 0 critical; 4 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.

Findings9

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

SeverityOpenAcknowledgedFixed
Critical000
High200
Medium101
Low203
Medium`_safeMint()` should be used rather than `_mint()Fixed

The `_executeGacha` function uses `mint` function, which does not check that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. `_mint()` is [discouraged](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/d4d8d2ed9798cc3383912a23b5e8d5cb602f7d4b/contracts/token/ERC721/ERC721.sol#L271)in favor of `_safeMint()` which ensures that the recipient is either an EOA or implements `IERC721Receiver`.

LowIncorrect Naming Convention UtilizationFixed

The `s.balances[_to]-1` equals the index of the new-minted token, not the length of the `_ownedTokens[to]`. Naming this temp variable as `length` is not suitable. ```solidity uint256 length = s.balances[_to] - 1; ```

LowRisks of `abi.encodePacked()` in User-ControlledFixed

Encoding through `abi.encodePacked()` is used with at least two dynamic type inputs controlled by the user. This type of encoding is susceptible to malleability when used with strings, bytes, or other dynamic types. As such, it is not a good choice for signature verification with the input used, since users can change the input and potentially get the same bytes output from `abi.encodePacked`. The susceptible malleable result can impact the global state variable `GachaStorage.seed`. ```solidity struct GachaStorage { uint256 seed; ... } function gachaRecycle(uint256 _gachaID, uint256[] calldata _payment) external { ... _executeGacha(_gs, _cs, _gachaID, _gacha, abi.encodePacked(_gachaID, _payment)); } function newSeed(GachaStorage storage _gs, bytes memory _salt) internal returns (uint256) { uint256 _seed = uint256(keccak256(abi.encodePacked(_gs.seed, _salt, msg.sender, block.timestamp, gasleft()))); _gs.seed = _seed; return _seed; } ```

LowSafeTransfer should be used in place of transferFixed

SafeTransfer should be used in place of Transfer for Solidity contracts to ensure robust security and error handling. Unlike the basic Transfer function, SafeTransfer incorporates safeguards against potential smart contract vulnerabilities, such as unexpected token loss. By automatically validating the recipient's ability to receive tokens and reverting transactions in case of failures. ```solidity if (!IERC20(_gacha.payType).transferFrom(msg.sender, _gs.dev, _price)) revert GachaErrFailToBill(); ``` The standard function `transferFrom` in OZ ERC20 returns true forever, which should not be used as a check for the result of the transferFrom.

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

  • contracts/diamond-3-hardhat/Diamond.sol
  • contracts/diamond-3-hardhat/facets/OwnershipFacet.sol
  • contracts/diamond-3-hardhat/interfaces/IERC165.sol
  • contracts/CharacterFacet.sol
  • contracts/libraries/LibError.sol
  • contracts/diamond-3-hardhat/interfaces/IDiamondLoupe.sol
  • contracts/diamond-3-hardhat/upgradeInitializers/DiamondInit.sol
  • contracts/diamond-3-hardhat/interfaces/IERC173.sol
  • contracts/libraries/LibItemGacha.sol
  • contracts/libraries/CharacterConst.sol
  • contracts/diamond-3-hardhat/facets/DiamondCutFacet.sol
  • contracts/diamond-3-hardhat/interfaces/IDiamondCut.sol
  • contracts/GachaFacet.sol
  • contracts/diamond-3-hardhat/facets/DiamondLoupeFacet.sol
  • contracts/diamond-3-hardhat/libraries/LibDiamond.sol
  • contracts/libraries/LibERC721.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