Introduction
We express our gratitude to the DefiSpot team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
DeFi Spot provides trading solutions for easy access to fragmented liquidity pools.
| title | content |
|---|---|
| Platform | EVM |
| Language | Solidity |
| Tags | ERC20, Vesting |
| Timeline | 11/04/2024 - 22/04/2024 |
| Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
|---|---|
| Repository | https://github.com/DefiSpot/vesting-contract→ |
| Commit | a92b20d581d152e2c340b52d5556b6d3e795dda0 |
Review Scope
- Commit
- a92b20d581d152e2c340b52d5556b6d3e795dda0
Audit Summary
10/10
68%
10/10
6/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 DefiSpot |
| Audited By | Niccolò Pozzolini, Kornel Światłowsk |
| Approved By | Przemyslaw Swiatowiec |
| Website | https://www.defispot.com/→ |
| Changelog | 17/04/2024 - Preliminary Report |
| 22/04/2024 - Second Review |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for DefiSpot
- Audited By
- Niccolò Pozzolini, Kornel Światłowsk
- Approved By
- Przemyslaw Swiatowiec
- Website
- https://www.defispot.com/→
- Changelog
- 17/04/2024 - Preliminary Report
- 22/04/2024 - Second Review
System Overview
DeFi Spot is a vesting of a Spot Token with the following contracts:
DefispotToken — Simple ERC-20 token that mints all initial supply to a deployer. Additional minting is allowed to addresses with MINTER role. It has the following attributes:
Name: Provided during deployment
Symbol: Provided during deployment
Decimals: 18
Total supply: 1000000_000 tokens.
TokenVesting— a contract that allows the contract owner or whitelisted address to create vesting schedules for the ERC20 token defined during contract deployment.
Privileged roles
DefispotToken contract uses the AccessControl library to grant privileged roles. The contract has following roles:
MINTER - Addresses with this role can mint new ERC20 tokens.
MINTER_MAKER - Addresses with this role can grant a given address a MINTER role.
TokenVesting contract uses an Ownable library to grant a privileged role. The contract owner can:
Create a new vesting schedule.
Revoke the vesting schedule for the given identifier.
Withdraw the specified amount of vested tokens if some vesting has been revoked.
Executive Summary
Documentation quality
The total Documentation Quality score is 6 out of 10.
Functional requirements are present, but only at a high-level.
Technical description is present, but only at a high-level.
Code quality
The total Code Quality score is 10 out of 10.
The development environment is configured.
Test coverage
Code coverage of the project is 68% (branch coverage).
Deployment and basic user interactions are covered with tests.
Negative cases coverage is missing.
Security score
Upon auditing, the code was found to contain 0 critical, 0 high, 1 medium, and 2 low severity issues. The medium issue has been fixed, 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 8.4. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
Centralized Control of Minting Process: The token contract’s design allows for centralized control over the minting process, posing a risk of unauthorized token issuance, potentially diluting the token value and undermining trust in the project's economic governance.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2024-2113 | Whitelisted users can manipulate slicePeriodSeconds and revocable parameters | fixed | Medium | |
| F-2024-2142 | Missing two-step ownership transfer process | accepted | Low | |
| F-2024-2138 | Missing validation of input parameters | fixed | Low | |
| F-2024-2145 | Redundant argument in the release function | fixed | Observation | |
| F-2024-2141 | Redundant the getCurrentTime wrapper leads to higher deployment cost | accepted | Observation | |
| F-2024-2140 | Violation of Check-Effects-Interactions (CEI) pattern in the _createVestingSchedule function | fixed | Observation | |
| F-2024-2139 | Commented code parts, TODO comments and developer notes | fixed | Observation | |
| F-2024-2119 | Low readability of long literals in MAX_SUPPLY constant | fixed | Observation | |
| F-2024-2118 | Non-descriptive error message in release function | fixed | Observation | |
| F-2024-2117 | Unnecessary external call in _createVestingSchedule function | fixed | Observation |
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/DefiSpot/vesting-contract→ |
| Commit | a92b20d581d152e2c340b52d5556b6d3e795dda0 |
| Whitepaper | - |
| Requirements | - |
| Technical Requirements | - |
Scope Details
- Commit
- a92b20d581d152e2c340b52d5556b6d3e795dda0
- Whitepaper
- -
- Requirements
- -
- Technical Requirements
- -