Introduction
We express our gratitude to the Genie Swap team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
The Genie Swap Launchpad ensures trustless token launches on Ethereum and BNB Chain, featuring an optional, fully decentralized multi-level referral system for network growth.
title | content |
---|---|
Platform | EVM |
Language | Solidity |
Tags | Launchpad; ERC20 |
Timeline | 01/09/2023 - 29/09/2023 |
Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
---|---|
Repository | https://github.com/PROJECT-ONRAMP/launchpad-contracts→ |
Commit | 090f9f4496364eb95c3c415892b5e0e78b3db7d9 |
Review Scope
- Commit
- 090f9f4496364eb95c3c415892b5e0e78b3db7d9
Audit Summary
10/10
100%
10/10
10/10
The system users should acknowledge all the risks summed up in the risks section of the report
Document Information
This report may contain confidential information about IT systems and the intellectual property of the Customer, as well as information about potential vulnerabilities and methods of their exploitation.
The report can be disclosed publicly after prior consent by another Party. Any subsequent publication of this report shall be without mandatory consent.
Document | |
---|---|
Name | Smart Contract Code Review and Security Analysis Report for Genie Swap |
Audited By | Hacken |
Website | https://genieswap.com/→ |
Changelog | 06/09/2023 - Initial Review |
29/09/2023 - Second Review |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for Genie Swap
- Audited By
- Hacken
- Website
- https://genieswap.com/→
- Changelog
- 06/09/2023 - Initial Review
- 29/09/2023 - Second Review
System Overview
The Genie Swap audited project comprises Launchpad contracts, which offer a foundation for token launches, enhanced by multi-level-marketing (MLM) features. This MLM functionality enables the allocation of commissions to individuals involved in promotional efforts, including special addresses like launchpad partners and designated addresses.
The MLM system organizes users into a tree structure. Every user has a referrer, except the topmost user. The tree helps in determining commission distributions.
Hierarchy: As you traverse up the tree (from user to referrer), rewards are computed based on MLM levels (ranging from Level 1 to Level n).
Designated Address Rewards: Once all MLM levels are exhausted, if a referrer is a designated address, it earns a designated address share.
Partner Benefits: If a referrer is a partner, they receive both the MLM level share (if they are within the MLM levels) and the partner share.
Single Reward for Designated Addresses: Only the first designated address identified during the upward traversal gets a reward.
Double Incentive for Partners: Partners always receive their partner-share, irrespective of their tree position. Moreover, they can also earn MLM rewards based on the outlined rules.
The files in the scope:
MyLaunchpadToken.sol - The ERC20 token that is used in the Launchpad.
LaunchpadToken.sol - Interface for MyLaunchpadToken.sol.
Escrow.sol - Responsible for holding and releasing assets for beneficiaries, which also ensures certain conditions are met.
Launchpad.sol - Facilitates token launches and sales on a launchpad. It enables users to mint Launchpad tokens in exchange for payment tokens. The contract is the central component of the system.
Manager.sol - Responsible for the management of various aspects of the system, from token exchange rates to partners and designated addresses.
MLM.sol - Handles the multi-level marketing (MLM) functionality of the system. This contract is responsible for onboarding users, calculating and distributing rewards based on referrals, and keeping track of the MLM structure.
Types.sol - The library that defines various data structures (structs) used across the project.
Utility.sol - The library that provides utility functions to be used across other contracts in the project.
Error.sol - The function that stores various error definitions to be used in reverted calls.
LaunchpadFactory.sol - The factory contract for deploying and managing Launchpad contract instances.
Privileged roles
Owner of the MLM/Manager contract: Can pause minting of tokens in Launchpad instances, set the commission mode for MLM, set the token exchange rate, set the start time of the Launchpad if its not started yet, set the end time of the Launchpad if it is not ended yet, remove partners and designated addresses, manage designated addresses, manage partner addresses, and set MLM levels.
Deployer of LaunchpadToken: Can use the LaunchpadFactory to deploy Launchpad instances. Can also be an Ownable ERC20 tokens owner.
Executive Summary
Documentation quality
The total Documentation quality score is 10 out of 10.
Functional requirements are provided.
Technical description is provided.
Description of the development environment is present.
Code quality
The total Code quality score is 10 out of 10.
NatSpec is consistent.
Style Guide is followed.
The development environment is configured.
Test coverage
Code coverage of the project is 100% (branch coverage).
Deployment and basic user interactions are covered with tests.
Negative cases coverage is present.
Interactions by several users are tested thoroughly.
Security score
Upon auditing, the code was found to contain 0 critical, 0 high, 4 medium, and 3 low severity issues. Out of these, 7 issues have been addressed and resolved, leading to a Security score of 10 out of 10.
All identified issues are detailed in the “Findings” section of this report.
Summary
The comprehensive audit of the customer's smart contract yields an overall score of 10. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
The Launchpad contract relies on external contracts (third party tokens) and their integrity cannot be certified. Admin and users should make sure the tokens used in the Launchpad are safe and cannot bring issues to investors’ funds.
Findings
Code ― | Title | Status | Severity | |
---|---|---|---|---|
F-2023-0661 | Requirements Violation: Insufficient Balance | fixed | Medium | |
F-2023-0660 | Requirements Violation: Incomplete Pause Mechanism Implementation | fixed | Medium | |
F-2023-0659 | Requirements Violation: Contradicting NatSpec | fixed | Medium | |
F-2023-0658 | Checks-Effects-Interactions Pattern Violation | fixed | Medium | |
F-2023-0664 | Ambiguous Error Message | fixed | Low | |
F-2023-0663 | Redundant Check | fixed | Low | |
F-2023-0662 | Inefficient Gas Model | fixed | Low | |
I-2023-0146 | Redundant Variable Assignment | fixed | Observation | |
I-2023-0145 | Missing Events for Critical Value Updates | fixed | Observation | |
I-2023-0144 | Contracts That Should Be Interface | fixed | Observation |
Identify vulnerabilities in your smart contracts.
Appendix 1. Severity Definitions
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, do not affect security score but can affect code quality score. |
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, do not affect security score but can affect code quality score.
Appendix 2. Scope
The scope of the project includes the following smart contracts from the provided repository:
Scope Details | |
---|---|
Repository | https://github.com/PROJECT-ONRAMP/launchpad-contracts→ |
Commit | 090f9f4496364eb95c3c415892b5e0e78b3db7d9 |
Whitepaper | Provided→ |
Requirements | Provided→ |
Technical Requirements | Provided→ |
Contracts in Scope
contracts/LaunchpadFactory.sol
contracts/examples/MyLaunchpadToken.sol
contracts/interfaces/ILaunchpadToken.sol
contracts/lib/Error.sol
contracts/lib/Escrow.sol
contracts/lib/Launchpad.sol
contracts/lib/Manager.sol
contracts/lib/MLM.sol
contracts/lib/Utility.sol
contracts/lib/Types.sol