Introduction
We express our gratitude to the HyperCycle team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
HyperCycle is the Internet of AI. Their mission is to facilitate direct AI-to-AI communication without the need for intermediaries. Their network constantly increases its overall intelligence and revolutionises global AI consumption.
| title | content |
|---|---|
| Platform | EVM |
| Language | Solidity |
| Tags | ERC721; Staking; Markeplace |
| Timeline | 04/05/2023 - 30/05/2023 |
| Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
|---|---|
| Repository | https://gitlab.com/dliendo05/hypc-polygon/-/tree/develop→ |
| Commit | e60234e9e8558e05f4614ed25a9ba883cec565d9 |
Review Scope
- Commit
- e60234e9e8558e05f4614ed25a9ba883cec565d9
Audit Summary
10/10
100.0%
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 HyperCycle |
| Audited By | Hacken |
| Website | https://www.hypercycle.ai→ |
| Changelog | 11/05/2023 - Initial Review |
| 29/05/2023 - Second Review | |
| 30/05/2023 - Third Review |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for HyperCycle
- Audited By
- Hacken
- Website
- https://www.hypercycle.ai→
- Changelog
- 11/05/2023 - Initial Review
- 29/05/2023 - Second Review
- 30/05/2023 - Third Review
System Overview
Hypercycle is a staking protocol with the following contracts:
CHYPC — an ERC721 NFT collection that includes the functionality to mint, burn, and assign custom data to NFT tokens. The contract interacts with two other contracts, HYPCSwap and HYPC, and supports the management of token ownership and data assignment, while ensuring proper initialization and contract interactions.
CrowdFundPoolHYPC — a crowdfunding pool for Hypercycle (HYPC) tokens, allowing users to create proposals, deposit funds, and earn interest over time. It manages the lifecycle of proposals and the interactions between users, such as depositing, withdrawing, and updating interest earnings, as well as handling token swaps and NFT assignments.
HYPCSwap – a smart contract used to swap HYPC tokens for a CHYPC NFT and vice versa. It manages the token and NFT balances while maintaining an up-to-date record of NFTs available for swapping.
ICHYPC – an interface for the CHYPC smart contract.
IHYPC – an interface for the HYPC ERC20 token smart contract.
IHYPCSwap – an interface for the HYPCSwap smart contract.
Privileged roles
CHYPCNFT.sol :
Contract Owner :
Can init the contract.
Can mint tokens.
Token Owner :
Can burn the token.
Can set an assignment to the token.
HyperCycleSwap.sol :
Token Contract (CHYPCAddress) :
Can add an NFT.
CrowdFundHYPCPool.sol :
Proposal owner :
Can cancel a proposal.
Can finish the proposal.
Can change the assignment.
Executive Summary
Documentation quality
The total Documentation quality score is 10 out of 10.
Functional requirements are present, but only at a high-level.
Functional requirements for how the system should work are provided.
The documentation has a detailed description of the math calculations.
Technical description is provided.
Run instructions are provided.
Technical specification is provided.
NatSpec is sufficient.
Code quality
The total Code quality score is 10 out of 10.
The development environment was configured.
The code is well-designed and follows best practices.
Test coverage
Code coverage of the project is 100.0% (branch coverage).
Deployment and basic user interactions are covered with tests.
Tests are not configured to run in a local environment.
Security score
Upon auditing, the code was found to contain 1 critical, 3 high, 4 medium, and 8 low severity issues. Out of these, 15 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.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2023-0159 | Invalid Validation; Funds Lock; Data Consistency | fixed | Critical | |
| F-2023-0162 | Race Condition; Undocumented Behaviour | fixed | High | |
| F-2023-0161 | Undocumented Behaviour | fixed | High | |
| F-2023-0160 | Requirements Violation | fixed | High | |
| F-2023-0166 | Race Condition; Undocumented Behaviour | fixed | Medium | |
| F-2023-0165 | Inconsistent Data | fixed | Medium | |
| F-2023-0164 | Inefficient Gas Model | fixed | Medium | |
| F-2023-0163 | Unfinalized Code | fixed | Medium | |
| F-2023-0174 | Missing Validation | fixed | Low | |
| F-2023-0173 | Interfaces Mismatch | fixed | Low |
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://gitlab.com/dliendo05/hypc-polygon/-/tree/develop→ |
| Commit | e60234e9e8558e05f4614ed25a9ba883cec565d9 |
| Whitepaper | Provided→ |
| Requirements | Provided→ |
| Technical Requirements | Provided→ |