Introduction
We express our gratitude to the Moonveil team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
Moonveil is a web3 game studio dedicated to creating innovative gaming experiences that blend casual play with deep, engaging gameplay.
Document | |
|---|---|
| Name | Smart Contract Code Review and Security Analysis Report for Moonveil |
| Audited By | Andy Cho |
| Approved By | Przemyslaw Swiatowiec |
| Website | https://moonveil.gg/→ |
| Changelog | 10/01/2025 - Preliminary Report |
| 14/01/2025 - Final Report | |
| Platform | Polygon |
| Language | Solidity |
| Tags | NFT, ERC20, ERC721 |
| Methodology | https://hackenio.cc/sc_methodology→ |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for Moonveil
- Audited By
- Andy Cho
- Approved By
- Przemyslaw Swiatowiec
- Website
- https://moonveil.gg/→
- Changelog
- 10/01/2025 - Preliminary Report
- 14/01/2025 - Final Report
- Platform
- Polygon
- Language
- Solidity
- Tags
- NFT, ERC20, ERC721
- Methodology
- https://hackenio.cc/sc_methodology→
Review Scope | |
|---|---|
| Repository | https://github.com/MoonveilEntertainment/moonveil-contracts→ |
| Commit | af557ce |
Review Scope
- Commit
- af557ce
Audit Summary
The system users should acknowledge all the risks summed up in the risks section of the report
Documentation quality
Functional requirements are provided.
Technical description is provided.
Code quality
The development environment is configured.
Test coverage
Code coverage of the project is 68.18% (branch coverage).
Deployment and basic user interactions are covered with tests.
Negative cases coverage is missed.
System Overview
MoonveilMuseNodeLicense — serves as the operational credential for the Moonveil L2 Light Client.
Moonveil Token — serves as the native governance token of the Moonveil platform, enabling token holders to participate in and fulfill various platform governance requirements and decision-making processes.
Privileged roles
The owner of the MoonveilMuseNodeLicense contract can batch-mint license NFTs, set the time stamp before which transfers are disallowed, set the base URI, set the transfer allowed list, and pause/unpause the contract.
Potential Risks
Centralized Minting to a Single Address: The project concentrates minting tokens in a single address, raising the risk of fund mismanagement or theft, especially if key storage security is compromised.
Flexibility and Risk in Contract Upgrades: The project's contracts are upgradeable, allowing the administrator to update the contract logic at any time. While this provides flexibility in addressing issues and evolving the project, it also introduces risks if upgrade processes are not properly managed or secured, potentially allowing for unauthorized changes that could compromise the project's integrity and security.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2025-8116 | Missing _disableInitializers() in Upgradable Contract Constructor | accepted | Observation | |
| F-2025-8115 | Floating Pragma | fixed | Observation |
Appendix 1. Definitions
Severities
When auditing smart contracts, Hacken is using a risk-based approach that considers Likelihood, Impact, Exploitability and Complexity metrics to evaluate findings and score severities.
Reference on how risk scoring is done is available through the repository in our Github organization:
Severity | Description |
|---|---|
Critical | Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation. |
High | High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation. |
Medium | Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category. |
Low | Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution. |
Severity
- Critical
Description
- Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation.
Severity
- High
Description
- High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation.
Severity
- Medium
Description
- Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category.
Severity
- Low
Description
- Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution.
Potential Risks
The "Potential Risks" section identifies issues that are not direct security vulnerabilities but could still affect the project’s performance, reliability, or user trust. These risks arise from design choices, architectural decisions, or operational practices that, while not immediately exploitable, may lead to problems under certain conditions. Additionally, potential risks can impact the quality of the audit itself, as they may involve external factors or components beyond the scope of the audit, leading to incomplete assessments or oversight of key areas. This section aims to provide a broader perspective on factors that could affect the project's long-term security, functionality, and the comprehensiveness of the audit findings.
Appendix 2. Scope
The scope of the project includes the following smart contracts from the provided repository:
Scope Details | |
|---|---|
| Repository | https://github.com/MoonveilEntertainment/moonveil-contracts→ |
| Commit | af557ce9073285fce715808c226df6929f814113 |
| Whitepaper | N/A |
| Requirements | README.md |
| Technical Requirements | NatSpec |
Scope Details
- Commit
- af557ce9073285fce715808c226df6929f814113
- Whitepaper
- N/A
- Requirements
- README.md
- Technical Requirements
- NatSpec
Assets in Scope
Appendix 3. Additional Valuables
Verification of System Invariants
During the audit of Moonveil, Hacken followed its methodology by performing fuzz-testing on the project's main functions. Foundry, a tool used for fuzz-testing, was employed to check how the protocol behaves under various inputs. Due to the complex and dynamic interactions within the protocol, unexpected edge cases might arise. Therefore, it was important to use fuzz-testing to ensure that several system invariants hold true in all situations.
Fuzz-testing allows the input of many random data points into the system, helping to identify issues that regular testing might miss. A specific Echidna fuzzing suite was prepared for this task, and throughout the assessment, 3 invariants were tested over 100,000 runs. This thorough testing ensured that the system works correctly even with unexpected or unusual inputs.
Invariant | Test Result | Run Count |
|---|---|---|
| Batch mints should be performed correctly | Passed | 100k+ |
| Setting a user should be performed correctly | Passed | 100k+ |
| Transfers should not be possible before the trasnfer allowed timestamp | Passed | 100k+ |
Invariant
- Batch mints should be performed correctly
Test Result
- Passed
Run Count
- 100k+
Invariant
- Setting a user should be performed correctly
Test Result
- Passed
Run Count
- 100k+
Invariant
- Transfers should not be possible before the trasnfer allowed timestamp
Test Result
- Passed
Run Count
- 100k+
Additional Recommendations
The smart contracts in the scope of this audit could benefit from the introduction of automatic emergency actions for critical activities, such as unauthorized operations like ownership changes or proxy upgrades, as well as unexpected fund manipulations, including large withdrawals or minting events. Adding such mechanisms would enable the protocol to react automatically to unusual activity, ensuring that the contract remains secure and functions as intended.
To improve functionality, these emergency actions could be designed to trigger under specific conditions, such as:
Detecting changes to ownership or critical permissions.
Monitoring large or unexpected transactions and minting events.
Pausing operations when irregularities are identified.
These enhancements would provide an added layer of security, making the contract more robust and better equipped to handle unexpected situations while maintaining smooth operations.