Q2 2026 Security & Compliance Report67 incidents, $764M in losses, 88% from operational failures.
Get the report →

Audit name:

[SCA] AlgoBlocks | DEX | Mar2023

Date:

Apr 2, 2023

Table of Content

→Introduction
→Audit Summary
→Document Information
→System Overview
→Executive Summary
→Risks
→Findings
→Appendix 1. Severity Definitions
→Appendix 2. Scope
→Disclaimer

Want a comprehensive audit report like this?

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.

titlecontent
PlatformEVM
LanguageSolidity
TagsDEX
Timeline02/03/2023 - 05/04/2023
Methodologyhttps://hackenio.cc/sc_methodology→

    Audit Summary

    Total9.4/10
    Security Score

    10/10

    Test Coverage

    93.8%

    Code Quality Score

    10/10

    Documentation Quality Score

    10/10

    9Total Findings
    9Resolved
    0Accepted
    0Mitigated

    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

    NameSmart Contract Code Review and Security Analysis Report for AlgoBlocks
    Audited ByHacken
    Websitehttps://www.algoblocks.io/→
    Changelog07/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
      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

    F-2023-0020Undocumented Behavior
    Status
    fixed
    Severity

    High
    F-2023-0019Frontrunning Attack
    Status
    fixed
    Severity

    High
    F-2023-0018Frontrunning Attack
    Status
    fixed
    Severity

    High
    F-2023-0017Requirements Compliance
    Status
    fixed
    Severity

    High
    F-2023-0025Redundant Variable
    Status
    fixed
    Severity

    Low
    F-2023-0024Floating Pragma
    Status
    fixed
    Severity

    Low
    F-2023-0023Duplicate Code
    Status
    fixed
    Severity

    Low
    F-2023-0022Order of Functions
    Status
    fixed
    Severity

    Low
    F-2023-0021Unused Function
    Status
    fixed
    Severity

    Low
    Code
    ―
    Title
    Status
    Severity
    F-2023-0020Undocumented Behavior
    fixed

    High
    F-2023-0019Frontrunning Attack
    fixed

    High
    F-2023-0018Frontrunning Attack
    fixed

    High
    F-2023-0017Requirements Compliance
    fixed

    High
    F-2023-0025Redundant Variable
    fixed

    Low
    F-2023-0024Floating Pragma
    fixed

    Low
    F-2023-0023Duplicate Code
    fixed

    Low
    F-2023-0022Order of Functions
    fixed

    Low
    F-2023-0021Unused Function
    fixed

    Low
    1-9 of 9 findings

    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

    Repositoryhttps://github.com/ALGOBLOCKS/algoblocks-smart-contracts→
    Commit821b39e
    WhitepaperProvided→
    RequirementsProvided→
    Technical RequirementsProvided→

    Contracts in Scope

    packages
    common
    contracts
    AlgoblocksRouterUpgradeable.sol - packages › common › contracts › AlgoblocksRouterUpgradeable.sol
    interfaces
    IAlgoblocksRouterUpgradeable.sol - packages › common › contracts › interfaces › IAlgoblocksRouterUpgradeable.sol
    metatx
    ERC2771ContextUpgradeable.sol - packages › common › contracts › metatx › ERC2771ContextUpgradeable.sol
    tokenTransfers
    contracts
    AlgoblocksSafeWithdrawUpgradeable.sol - packages › tokenTransfers › contracts › AlgoblocksSafeWithdrawUpgradeable.sol
    interfaces
    IERC20.sol - packages › tokenTransfers › contracts › interfaces › IERC20.sol
    libraries
    TransfersExecutionUtils.sol - packages › tokenTransfers › contracts › libraries › TransfersExecutionUtils.sol
    zap
    contracts
    AlgoblocksZapFeaturePancakeUpgradeable.sol - packages › zap › contracts › AlgoblocksZapFeaturePancakeUpgradeable.sol
    base
    AlgoblocksZapFeatureBaseUpgradeable.sol - packages › zap › contracts › base › AlgoblocksZapFeatureBaseUpgradeable.sol
    interfaces
    IAlgoblocksZapFeatureUpgradeable.sol - packages › zap › contracts › interfaces › IAlgoblocksZapFeatureUpgradeable.sol

    Disclaimer