Q1 2025 Web3 Security ReportAccess control failures led to $1.63 billion in losses
Discover report insights
  • Hacken
  • Audits
  • streampay
  • [SCA] StreamPay / ERC777 + Staking / May2023
StreamPay logo

StreamPay

Audit name:

[SCA] StreamPay / ERC777 + Staking / May2023

Date:

May 30, 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 StreamPay team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.

Streamable Finance offers asset streaming capabilities wrapped in financial and banking infrastructure. First ever Web2 and Web3-combined streaming suite disrupting on-demand-pay, salary, billing, housing and lending industries simultaneously with a 1T+ USD addressable market opportunity.

titlecontent
PlatformEVM
LanguageSolidity
TagsERC777, Staking
Timeline09/05/2023 - 31/05/2023
Methodologyhttps://hackenio.cc/sc_methodology

    Review Scope

    Repositoryhttps://github.com/streamable-finance/streampay-staking
    Commitc5b6f12ede90352047a87d960b0318e0a94d714a

    Audit Summary

    Total9.5/10
    Security Score

    10/10

    Test Coverage

    91.67%

    Code Quality Score

    10/10

    Documentation Quality Score

    8/10

    14Total Findings
    12Resolved
    0Accepted
    1Mitigated

    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 StreamPay
    Audited ByHacken
    Websitehttps://www.streamablefinance.com/
    Changelog16/05/2023 - Initial Review
    29/05/2023 - Second Review
    31/05/2023 - Third Review
    • Document

      Name
      Smart Contract Code Review and Security Analysis Report for StreamPay
      Audited By
      Hacken
      Changelog
      16/05/2023 - Initial Review
      29/05/2023 - Second Review
      31/05/2023 - Third Review

    System Overview

    The audit scope consists of a staking and reward distribution system. Users can deposit ERC20 LP tokens to various LP pools determined by the owner of the system. In return, they can acquire StreamableFinanceToken, which is an ERC777 standard token. The rewards are not directly sent to the user but are locked with a timelock. If the users wish to withdraw rewards before the timelock expires, they can do it with a penalty of 50%.

    StreamPay is a staking protocol with the following contracts:

    • TokenStaker — a contract that allows users to stake their tokens in pools to earn rewards. The rewards are distributed in STRF tokens, which are locked in a separate contract until the staking period is over. The contract also includes a schedule of future reward rates that depend on the elapsed time since the start of staking, as well as a mechanism for distributing the last stage of rewards at the end of the staking period.

    • STRFTokenLocker — an STRF token locking contract that is used by the TokenStaker. Implementation includes timelock mechanism that handles reward distribution and penalties. TokenStaker contract is the LOCKER_ROLE of the STRFTokenLocker contract.

    • ERC777Capped — an ERC-777 contract that is customly modified to cap the total supply. Initially no token is minted. Additional minting is allowed.  It has the following attributes:

      • Name: given as a constructor parameter.

      • Symbol: given as a constructor parameter.

      • Decimals: 18.

      • Total supply: given as a constructor parameter.

    Privileged roles

    • The owner of the TokenStaker contract can:

      • set STRF Locker.

      • add pools.

      • set allocation points of pools.

    • The LOCKER_ROLE of the STRFTokenLocker contract can:

      • call the lock function.

    • The MINTER_ROLE of the ERC777Capped contract can:

      • mint tokens.

    Executive Summary

    Documentation quality

    The total Documentation quality score is 8 out of 10.

    • Functional requirements and technical description were provided.

    • NatSpec format was not followed.

    • The development environment instructions were provided.

    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 91.67% (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 1 critical, 2 high, 3 medium, and 5 low severity issues. Out of these, 10 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.5. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.

    Risks

    All privileged roles can affect the system; there is no documentation regarding how those roles will be protected or if multi-sig wallets will be used.

    Findings

    Code
    Title
    Status
    Severity
    F-2023-0839Invalid Comparison
    fixed

    Critical
    F-2023-0841Data Inconsistency
    fixed

    High
    F-2023-0840 Missing Validation
    fixed

    High
    F-2023-0844Undocumented Functionality
    fixed

    Medium
    F-2023-0843Undocumented Functionality
    fixed

    Medium
    F-2023-0842Inefficient Gas Model
    fixed

    Medium
    F-2023-0849Possible Denial Of Service
    fixed

    Low
    F-2023-0848Missing Events
    fixed

    Low
    F-2023-0847Variable Shadowing
    fixed

    Low
    F-2023-0846Check-Effects-Interaction Violation
    fixed

    Low
    1-10 of 14 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/streamable-finance/streampay-staking
    Commitc5b6f12ede90352047a87d960b0318e0a94d714a
    WhitepaperNot provided
    RequirementsProvided
    Technical RequirementsProvided

    Contracts in Scope

    contracts
    lp-token-staker
    STRFTokenLocker.sol - contracts/lp-token-staker/STRFTokenLocker.sol
    TokenStaker.sol - contracts/lp-token-staker/TokenStaker.sol
    token
    StreamableFinanceToken.sol - contracts/token/StreamableFinanceToken.sol
    extensions
    ERC777Capped.sol - contracts/token/extensions/ERC777Capped.sol

    Disclaimer