Q1 2025 Web3 Security ReportAccess control failures led to $1.63 billion in losses
Discover report insights
  • Hacken
  • Audits
  • dogami
  • [SCA] Dogami / Staking / Jan2024
Dogami logo

Dogami

Audit name:

[SCA] Dogami / Staking / Jan2024

Date:

Feb 27, 2024

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

DOGAMÍ is a staking protocol that allow users to lock an ERC20 Token for either a fixed (limited) or open-ended (unlimited) period and earn rewards in the same ERC20 Token.

titlecontent
PlatformEVM
LanguageSolidity
TagsStaking
Timeline16/01/2024 - 23/01/2024
Methodologyhttps://hackenio.cc/sc_methodology

    Audit Summary

    Total9.9/10
    Security Score

    10/10

    Test Coverage

    97%

    Code Quality Score

    10/10

    Documentation Quality Score

    10/10

    11Total Findings
    11Resolved
    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 Dogami
    Audited ByDavid Camps Novi
    Approved ByPrzemyslaw Swiatowiec
    Websitehttps://dogami.com
    Changelog18/01/2024 - Preliminary Report; 23/01/2024 - Final Report
    • Document

      Name
      Smart Contract Code Review and Security Analysis Report for Dogami
      Audited By
      David Camps Novi
      Approved By
      Przemyslaw Swiatowiec
      Changelog
      18/01/2024 - Preliminary Report; 23/01/2024 - Final Report

    System Overview

    DOGAMÍ is a staking protocol that allow users to lock an ERC20 Token for either a fixed (limited) or open-ended (unlimited) period and earn rewards in the same ERC20 Token.

    • The StakingFlex contract allows for unlimited staking at a fixed rate, which can be later updated by the admin wallet if needed.

    • The StakingLockPeriod contract allows for staking for a pre-defined period at a fixed rate that cannot be later updated by the admin wallet.

    Privileged roles

    Both staking contracts have 2 roles:

    • Admin: Can pause/unpause the contract if needed for both the StakingFlex and StakingLockPeriod contracts. In addition, for the StakingFlex contract, admin can update the time unit over which the reward is calculated. The admin can also modify the reward ratio. Can force a user to un-stake their funds.

    • User: Can stake tokens, collect their rewards, and withdraw parts or the entirety of their stacked tokens.

    Executive Summary

    Documentation quality

    The total Documentation Quality score is 10 out of 10.

    • Functional requirements are provided.

    • Technical description is provided.

    Code quality

    The total Code Quality score is 10 out of 10.

    • Best practices are followed .

    • The development environment is configured.

    Test coverage

    Code coverage of the project is 97% (branch coverage).

    • Main deployment and basic user interactions are covered with tests.

    Security score

    Upon auditing, the code was found to contain 0 critical, 0 high, 0 medium, and 4 low severity issues. All issues were 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 9.9. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.

    Risks

    The reward tokens are sent from the rewardWallet address, but the balance of that address is checked off-chain. It may be the case that a user engages with the system when no rewards are available. Another possibility is that no rewards can be sent out to a user when the rewards are claimed, reverting the call that withdraws the tokens and receives the rewards

    Findings

    Code
    Title
    Status
    Severity
    F-2024-0502Potential misuse of user funds in reward distribution due to incorrect constructor settings
    fixed

    Low
    F-2024-0501Missing the timeUnit variable check can lead to division by zero in reward calculations
    fixed

    Low
    F-2024-0494Missing checks for reward ratio numerator and denominator can lead to incorrect reward values
    fixed

    Low
    F-2024-0493Missing return value check for tokens transfers may lead to unexpected behavior
    fixed

    Low
    F-2024-0506Redundant calculations in _calculateRewards when time passed is zero
    fixed

    Observation
    F-2024-0505Checks-Effects-Interactions pattern violation
    fixed

    Observation
    F-2024-0504Redundant calculations on claiming rewards
    fixed

    Observation
    F-2024-0503Redundant declaration
    fixed

    Observation
    F-2024-0495Missing checks for zero address
    fixed

    Observation
    F-2024-0492State variables only set in the constructor should be declared immutable
    fixed

    Observation
    1-10 of 11 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/dogami-code/Smart-Contracts-EVM
    Commit2276c97
    WhitepaperNot provided
    RequirementsDocumentation
    Technical RequirementsDocumentation

    Contracts in Scope

    src
    StakingFlex.sol - src/StakingFlex.sol
    StakingLockPeriod.sol - src/StakingLockPeriod.sol

    Disclaimer