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.
title | content |
---|---|
Platform | EVM |
Language | Solidity |
Tags | Staking |
Timeline | 16/01/2024 - 23/01/2024 |
Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
---|---|
Repository | https://github.com/dogami-code/Smart-Contracts-EVM→ |
Commit | 2276c97 |
Review Scope
- Commit
- 2276c97
Audit Summary
10/10
97%
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 Dogami |
Audited By | David Camps Novi |
Approved By | Przemyslaw Swiatowiec |
Website | https://dogami.com→ |
Changelog | 18/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
- Website
- https://dogami.com→
- 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 theStakingFlex
andStakingLockPeriod
contracts. In addition, for theStakingFlex
contract,admin
can update the time unit over which the reward is calculated. Theadmin
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-0502 | Potential misuse of user funds in reward distribution due to incorrect constructor settings | fixed | Low | |
F-2024-0501 | Missing the timeUnit variable check can lead to division by zero in reward calculations | fixed | Low | |
F-2024-0494 | Missing checks for reward ratio numerator and denominator can lead to incorrect reward values | fixed | Low | |
F-2024-0493 | Missing return value check for tokens transfers may lead to unexpected behavior | fixed | Low | |
F-2024-0506 | Redundant calculations in _calculateRewards when time passed is zero | fixed | Observation | |
F-2024-0505 | Checks-Effects-Interactions pattern violation | fixed | Observation | |
F-2024-0504 | Redundant calculations on claiming rewards | fixed | Observation | |
F-2024-0503 | Redundant declaration | fixed | Observation | |
F-2024-0495 | Missing checks for zero address | fixed | Observation | |
F-2024-0492 | State variables only set in the constructor should be declared immutable | fixed | Observation |
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 | |
---|---|
Repository | https://github.com/dogami-code/Smart-Contracts-EVM→ |
Commit | 2276c97 |
Whitepaper | Not provided |
Requirements | Documentation→ |
Technical Requirements | Documentation→ |
Scope Details
- Commit
- 2276c97
- Whitepaper
- Not provided
- Requirements
- Documentation→
- Technical Requirements
- Documentation→