Introduction
We express our gratitude to the Cinch Protocol team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
Cinch Protocol is a referral system for blockchain applications aimed at democratizing economic opportunity by providing accessible decentralized financial products through seamless integration with wallets.
| title | content |
|---|---|
| Platform | EVM |
| Language | Solidity |
| Tags | Yield Farming |
| Timeline | 10/04/2023 - 12/05/2023 |
| Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
|---|---|
| Repository | https://github.com/cinchprotocol/contracts→ |
| Commit | ab6639e019f64ca27c22876c9b62a3ca2baedf73 |
Review Scope
- Commit
- ab6639e019f64ca27c22876c9b62a3ca2baedf73
Audit Summary
10/10
100%
10/10
8/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 Cinch Protocol |
| Audited By | Hacken |
| Website | https://www.cinchprotocol.io→ |
| Changelog | 19/04/2023 - Initial Review |
| 09/05/2023 - Second Review | |
| 12/05/2023 - Third Review |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for Cinch Protocol
- Audited By
- Hacken
- Changelog
- 19/04/2023 - Initial Review
- 09/05/2023 - Second Review
- 12/05/2023 - Third Review
System Overview
**Cinch Protocol** is a referral system for blockchain applications aimed at democratizing economic opportunity by providing accessible decentralized financial products through seamless integration with wallets, with the following contracts:
GeneralRevenueShareLogic – an abstract smart contract that implements revenue share business logic with a referral system.
GeneralYieldSourceAdapter - an abstract smart contract that serves as a template for creating yield source adapters that interact with various yield source vaults in a revenue-sharing system. The contract provides a set of functions to interact with yield source vaults, such as depositing assets, redeeming assets based on shares, converting assets to shares, and converting shares to assets.
RevenueShareVault – a smart contract inherited from GeneralRevenueShareLogic and GeneralYieldSourceAdapter enables users to deposit and withdraw assets into a yield source product, with support for referrals. It provides functionalities for managing asset deposits, share minting, asset redemptions, and querying account balances with pausable and access control features.
RevenueShareVaultDHedge – a smart contract that extends RevenueShareVault and specializes in depositing and redeeming assets in dHedge yield source vaults. It provides conversion functions for assets to yield source shares, calculating share price, and querying account balances in the yield source.
RevenueShareVaultRibbonEarn – a smart contract that extends RevenueShareVault and specializes in depositing assets into Ribbon Earn yield source vaults. It provides functions for depositing assets, querying share price and balances, and converting assets to and from yield source shares.
IYieldSourceContract – an interface for a yield source contract that enables depositing and redeeming assets, as well as querying share price, total supply, and individual account balances.
IYieldSourceDHedge – an interface that enables depositing funds, withdrawing funds, querying token price, total supply, and account balances.
IYieldSourceDHedgeSwapper – an interface that enables withdrawing underlying assets while swapping them to a specified asset with slippage protection.
Privileged roles
The owner of the GeneralRevenueShareLogic can manage referrals, adjust share allocations, and modify the Cinch performance fee percentage, allowing them to control revenue share distribution and enable deposits and withdrawals for the revenue shares.
The owner of the GeneralYieldSourceAdapter can update the address of the yield source vault.
Executive Summary
Documentation quality
The total Documentation quality score is 8 out of 10.
NatSpec is detailed.
Run instructions are provided.
Project overview is detailed.
Use cases are described.
The technical documentation for integration implementation is partially provided.
Code quality
The total Code quality score is 10 out of 10.
Development environment is configured.
Code follows best practices.
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.
Security score
Upon auditing, the code was found to contain 0 critical, 4 high, 2 medium, and 15 low severity issues. Out of these, 21 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 9.8. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
Integration with Ribbon Finance is only done in a limited form, allowing users to forward deposits in their name. Withdrawal of funds is left to be managed by users outside of the Cinch Protocol. Integration is centralized and requires maintenance operations from the contract owner.
Cinch protocol integrates external protocols into its system, which can introduce various risks and security concerns. The correctness of the integrations is out of the audit scope.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2023-0090 | Race Condition; Data Consistency | fixed | High | |
| F-2023-0089 | Denial of Service; Ambiguous Third-Party Integration | fixed | High | |
| F-2023-0088 | Data Consistency | fixed | High | |
| F-2023-0087 | Invalid Calculations | fixed | High | |
| F-2023-0092 | Unchecked Approve | fixed | Medium | |
| F-2023-0091 | Gas Limit in Loops | fixed | Medium | |
| F-2023-0107 | Redundant Code | fixed | Low | |
| F-2023-0106 | Redundant Import | fixed | Low | |
| F-2023-0105 | Commented Code | fixed | Low | |
| F-2023-0104 | Redundant Code | 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://github.com/cinchprotocol/contracts→ |
| Commit | ab6639e019f64ca27c22876c9b62a3ca2baedf73 |
| Whitepaper | Not provided |
| Requirements | Provided→ |
| Technical Requirements | Provided→ |