Introduction
We express our gratitude to the AlgoBlocks team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
AlgoBlocks is a mixed-purpose system led by a team with an optimal blend of proven expertise in finance, capital markets technology and crypto.
| title | content |
|---|---|
| Platform | EVM |
| Language | Solidity |
| Tags | DEX |
| Timeline | 02/03/2023 - 05/04/2023 |
| Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
|---|---|
| Repository | https://github.com/ALGOBLOCKS/algoblocks-smart-contracts→ |
| Commit | 821b39e |
Review Scope
- Commit
- 821b39e
Audit Summary
10/10
93.8%
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 AlgoBlocks |
| Audited By | Hacken |
| Website | https://www.algoblocks.io/→ |
| Changelog | 07/03/2023 - Initial Review |
| 23/03/2023 - Second Review | |
| 05/04/2023 - Third Review |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for AlgoBlocks
- Audited By
- Hacken
- Website
- https://www.algoblocks.io/→
- Changelog
- 07/03/2023 - Initial Review
- 23/03/2023 - Second Review
- 05/04/2023 - Third Review
System Overview
AlgoBlocks— is a mixed-purpose system with the following contracts:
AlgoblocksRouterUpgradable— an upgradable contract that provides the opportunity to add liquidity on PancakeSwap. It implements a zap feature, which adds a feature that makes it possible to add liquidity without having the necessary tokens.
AlgoblockSafeWithdrawUpgradable — an abstract smart contract that provides the possibility to receive and send natives and ERC20 tokens.
AlgoblocksZapFeaturePancakeUpgradeable— an upgradable smart contract that is used for adding liquidity to PancakeSwap.
AlgoblocksZapFeatureBaseUpgradeable— an abstract smart contract that is basic for AlgoblocksZapFeaturePancakeUpgradeable.
IAlgoblocksZapFeatureUpgradable — an interface that is basic for AlgoblocksZapFeaturePancakeUpgradeable.
TransfersExecutionUtils — a library that provides the possibility to interact with ERC20 and natives.
ERC2771ContextUpgradeable — an abstract smart contract that implements security logic by ERC2771 standard.
IERC20— an interface for the ERC20 standard.
Privileged roles
The owner of the AlgoblocksRouterUpgradable is available to manage state variables, transfer natives and ERC20 tokens, pause and unpause the smart contract and change the trusted forwarder.
Executive Summary
Documentation quality
The total Documentation quality score is 10 out of 10.
Run instructions are provided.
Technical specification is provided.
NatSpec is sufficient.
An overview of the project is presented with examples of use cases and interactions, but no detailed description of the third-party services used.
Code quality
The total Code quality score is 10 out of 10.
Solidity style guides are followed.
Best practice guidelines are followed.
Development environment is configured.
Test coverage
Code coverage of the project is 93.8% (branch coverage).
Deployment and basic user interactions are not fully covered with tests.
Negative cases are covered.
Security score
Upon auditing, the code was found to contain 0 critical, 4 high, 0 medium, and 5 low severity issues. Out of these, 9 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
The system uses the ERC2771 standard that is meant to be used for the support of meta transactions. The secureness of the whole system depends on the secureness of the keys of the trusted forwarder account. This system is out of the audit scope.
The system is a wrapper around DEXes that does not introduce any additional value and charges fees for its usage. The same behavior can be achieved by direct integration with DEXes. The lack of proper documentation may be a sign that the contract does not implement everything that is expected.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2023-0020 | Undocumented Behavior | fixed | High | |
| F-2023-0019 | Frontrunning Attack | fixed | High | |
| F-2023-0018 | Frontrunning Attack | fixed | High | |
| F-2023-0017 | Requirements Compliance | fixed | High | |
| F-2023-0025 | Redundant Variable | fixed | Low | |
| F-2023-0024 | Floating Pragma | fixed | Low | |
| F-2023-0023 | Duplicate Code | fixed | Low | |
| F-2023-0022 | Order of Functions | fixed | Low | |
| F-2023-0021 | Unused Function | 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/ALGOBLOCKS/algoblocks-smart-contracts→ |
| Commit | 821b39e |
| Whitepaper | Provided→ |
| Requirements | Provided→ |
| Technical Requirements | Provided→ |