Vidma is pleased to present this audit report outlining our assessment of code, smart contracts, and other important audit insights and suggestions for management, developers, and users.
The security audit of the MetaXSeed smart contract revealed several vulnerabilities, most of which did not significantly impact the contract’s ability to operate. However, prompt action was taken by the client to address these concerns, implementing comprehensive fixes.
After the second review, Vidma audit team confirms that all known issues are resolved and the contract is secure and operational. The changes are reflected in this version of the report accordingly.
During the audit process, the Vidma team found several issues, including those with critical severity. A detailed summary and the current state are displayed in the table below.
After evaluating the findings in this report and the final state after fixes, the Vidma auditors can state that the contracts are fully operational and secure. Under the given circumstances, we set the following risk level:
To set the codebase quality mark, our auditors are evaluating the initial commit given for the scope of the audit and the last commit with the fixes. This approach helps us adequately and sequentially evaluate the quality of the code. Code style, optimization of the contracts, the number of issues, and risk level of the issues are all taken into consideration. The Vidma team has developed a transparent evaluation codebase quality system presented below.
Evaluating the initial commit and the last commit with the fixes, Vidma audit team set the following codebase quality mark.
Score
Based on the overall result of the audit and the state of the final reviewed commit, the Vidma audit team grants the following score:
In addition to manual check and static analysis, the auditing team has conducted a number of integrated autotests to ensure the given codebase has an adequate performance and security level. The test results and coverage can be found in the accompanying section of this audit report.
Please be aware that this audit does not certify the definitive reliability and security level of the contract. This document describes all vulnerabilities, typos, performance issues, and security issues found by the Vidma audit team.
If the code is still under development, we highly recommend running one more audit once the code is finalized.
Gaming L1 with a large library games (Mobile & PC) generating revenue from advertisements and micro transactions. Token utility includes gas fees and NFT purchase currency for all our games. Players can play any game, use the same digital assets in multiple games and be rewarded daily for the activities. Web 2.5 infrastructure to get access to 3 billion players in Google Play & Apple iOS stores.
Within the scope of this audit, two independent auditors thoroughly investigated the given codebase and analyzed the overall security and performance of the smart contracts.
The audit was conducted from May 8th to May 20th. The outcome is disclosed in this document.
The scope of work for the given audit consists of the following contracts:
The source code was taken from the following source:
https://github.com/0xShadowScripter/NFT-MetaXSeed
Initial commit submitted for the audit:
0cebd82da7580d1d3ef3f31679c399e6bec578cc
Last commit reviewed by the auditing team:
Vidma audit team uses the most sophisticated and contemporary methods and well-developed techniques to ensure contracts are free of vulnerabilities and security risks. The overall workflow consists of the following phases:
After the Audit kick-off, our security team conducts research on the contract’s logic and expected behavior of the audited contract.
Vidma auditors do a deep dive into your tech documentation with the aim of discovering all the behavior patterns of your codebase and analyzing the potential audit and testing scenarios.
At this point, the Vidma auditors are ready to kick off the process. We set the auditing strategies and methods and are prepared to conduct the first audit part.
During the manual phase of the audit, the Vidma team manually looks through the code in order to find any security issues, typos, or discrepancies with the logic of the contract. The initial commit as stated in the agreement is taken into consideration.
Static analysis tools are used to find any other vulnerabilities in smart contracts that were missed after a manual check.
An interim report with the list of issues.
Within the testing part, Vidma auditors run integration tests using the Truffle or Hardhat testing framework. The test coverage and the test results are inserted in the accompanying section of this audit report.
Second interim report with the list of new issues found during the testing part of the audit process.
For simplicity in reviewing the findings in this report, Vidma auditors classify the findings in accordance with the severity level of the issues. (from most critical to least critical).
All issues are marked as “Resolved” or “Unresolved”, depending on if they have been fixed by project team or not. The issues with “Not Relevant” status are left on the list of findings but are not eligible for the score points deduction.
The latest commit with the fixes reviewed by the auditors is indicated in the “Scope of Work” section of the report.
The Vidma team always provides a detailed description of the issues and recommendations on how to fix them.
Classification of found issues is graded according to 6 levels of severity described below:
Critical TC – 01 | Resolved
There are requirements _tokenIdCounter.current() <= maxSupply in safeMint(), lazyMint() functions. It makes possible to mint one extra token after reaching max supply.
Steps to reproduce: deploy contract with max supply value = 5, mint 5 tokens with any minting function, mint one extra token with safeMint() or lazyMint().
Change requirements from _tokenIdCounter.current() <= maxSupply to _tokenIdCounter.current() < maxSupply in safeMint() and lazyMint() functions.
There is no need to change requirement in the safeMintBatch() function. It causes a new issue when max supply will not be reached with the safeMintBatch() function. Requirement changes should be reverted into:
Medium TM – 01 | Resolved
If some tokens from range are burned or just do not exist transaction will be failed for all tokens from range. To prevent transaction failure, nonexistent tokens may be skipped.
Consider replace requirement into branching:
into:
The same can be used for the array in the setTokenTransferabilities() function.
Medium TM – 02 | Resolved
There is incorrect checking of expiry parameter in the lazyMint() function. If there is value less than block.timestamp, it will work but it shouldn't.
Expiry date should be bigger than current timestamp: block.timestamp < expiry. Expiry is the date when the signature is considered invalid.
Change requirement:
into:
or:
and remove the WEEK variable.
Medium TM – 03 | Resolved
There is a lazyMint() function that can be called by anyone with a signature but the batchLazyMint() function can be called only by the owner. I suppose it also should be called by anyone, at least it is secured with a signature.
Consider removing the onlyOwner modifier from the batchLazyMint() function.
Low ML – 01 | Resolved
The current version of solc in contract MetaXSeed is ^0.8.2 and it is better to lock the pragma to a specific version.
Contracts should be deployed with the same compiler version and flag that they
have been tested thoroughly. Locking the pragma helps to ensure that contracts
do not accidentally get deployed using, for example, an outdated compiler version that might introduce bugs that affect the contract system negatively.
Consider locking pragma to a specific version.
Low ML – 02 | Resolved
The functions addSigner(), setGlobalTransferability(), safeMint(), safeMintBatch(), batchLazyMint(), burn(), setTokenURI(), setTokenTransferabilityRange(), setTokenTransferabilityRange(), totalSupply(), tokensOfOwner() of MetaXSeed contract can be marked as external, it will save gas during function execution.
The lazyMint() function may also be marked as external but it is called inside another batchLazyMint() function of contract. There could be a good practice to create an internal _lazyMint() function and call it inside external lazyMint() and batchLazyMint() functions with passed parameters from these functions.
Consider changing visibility to external if possible, it will bring saving gas during function execution.
Low ML – 03 | Resolved
MetaXSeed.sol imports ECDSA.sol from the openzeppelin library but it is already imported from another imported file - draft-EIP712.sol.
Consider deleting unused import, it will save gas during deployment.
Low TL – 01 | Resolved
There is unimportant require(signer != address(0), "Invalid signature") in the lazyMint() function. It could be missed because zero signer (address(0)) cannot be added to the contract: there is the same requirement in the addSigner() function.
Consider removing the require(signer != address(0), "Invalid signature").
Informational MI – 01 | Resolved
The layout contract elements in MetaXSeed are not fully logically grouped.
The contract elements should be grouped and ordered in the following way:
Inside each contract, library or interface, use the following order:
Ordering helps readers to navigate the code and find the elements more quickly.
Consider changing the order of layout according to solidity documentation: Order of Layout.
Informational MI – 02 | Resolved
The functions in contract MetaXSeed are not grouped according to their visibility and order.
Functions should be grouped according to their visibility and ordered in the following way:
Ordering helps readers navigate across the code, identify which functions they can call and find the constructor and fallback definitions easier.
Consider changing functions order according to solidity documentation: Order of Functions.
Informational MI – 03 | Resolved
According to the Solidity Style Guide, internal functions and variables should begin from the underscore. In the MetaXSeed contract there are: tokenIdCounter, SIGNATURE_VERSION, SIGNING_DOMAIN, LAZY_MINT_TYPEHASH, WEEK, which didn’t fit the naming convention.
Consider following the Solidity Style Guide, and naming conventions.
Changes were missed for tokenIdCounter.
Informational TI – 01 | Resolved
There are mismatched parameters order in safeMint() and safeMintBatch() functions. It will be more comfortable if functions have logically similar parameters order.
Change safeMint() function parameters order into:
To verify the security of the contract and the performance, a number of integration tests were carried out using the Hardhat testing framework.
In this section, we provide both tests written by MXS Games and tests written by Vidma auditors.
MXS Games Coverage – 91.43%
Vidma Coverage – 100%
Industry Standard – 95%
It is important to note that Vidma auditors do not modify, edit or add tests to the existing tests provided in the MXS Games repository. We write totally separate tests with code coverage of a minimum of 95% to meet the industry standards.
We are delighted to have a chance to work with the MXS Games team and contribute to your company's success by reviewing and certifying the security of your smart contracts.
The statements made in this document should be interpreted neither as investment or legal advice, nor should its authors be held accountable for decisions made based on this document.