Introduction
We express our gratitude to the DOP (Data Ownership Protocol) team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
xData Ownership Protocol Token (DOP) is the secodn iteration of the existing DOP token. This Burnable ERC20 implementation introduces an upgraded token distribution mechanism based on Time-Weighted Average Price (TWAP)
Document | |
|---|---|
| Name | Smart Contract Code Review and Security Analysis Report for DOP (Data Ownership Protocol) |
| Audited By | Turgay Arda Usman, Khrystyna Tkachuk |
| Approved By | Ivan Bondar |
| Website | https://dop.org/→ |
| Changelog | 26/06/2025 - Preliminary Report |
| 23/07/2025 - Final Report | |
| Platform | Ethereum |
| Language | Solidity |
| Tags | ERC20, Vesting |
| Methodology | https://hackenio.cc/sc_methodology→ |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for DOP (Data Ownership Protocol)
- Audited By
- Turgay Arda Usman, Khrystyna Tkachuk
- Approved By
- Ivan Bondar
- Website
- https://dop.org/→
- Changelog
- 26/06/2025 - Preliminary Report
- 23/07/2025 - Final Report
- Platform
- Ethereum
- Language
- Solidity
- Tags
- ERC20, Vesting
- Methodology
- https://hackenio.cc/sc_methodology→
Review Scope | |
|---|---|
| Repository | https://github.com/dop-labs/dop-token→ |
| Initial Commit | 86b165d |
| Final Commit | 5c89912 |
Review Scope
- Repository
- https://github.com/dop-labs/dop-token→
- Initial Commit
- 86b165d
- Final Commit
- 5c89912
Audit Summary
The system users should acknowledge all the risks summed up in the risks section of the report
Documentation quality
Functional requirements are provided.
Technical description is provided.
Code quality
The code mostly follows the best practices and style guides.
See informational findings for more information.
The development environment is configured.
Test coverage
Code coverage of the project is 23.53% (branch coverage).
Deployment and basic user interactions are covered with tests.
Negative cases coverage is missed.
Interactions by several users are not tested thoroughly.
Vesting distribution case from start to finale cycle is missing.
System Overview
Data Ownership Protocol Token (DOP) is the second iteration of the existing DOP token. This Burnable ERC20 implementation introduces an upgraded token distribution mechanism based on Time-Weighted Average Price (TWAP). It has the following contracts:
Vesting — Contains logic for migrating from DOP token to DOPv2 tokens and vesting of DOPv2 tokens.
Globals — Holds global events and error codes
Accumulator — Contains TWAP logic and oracle interaction.
FullMath — Contains 512-bit math functions.
TickMath —Math library for computing sqrt prices from ticks and vice versa.
Privileged roles
Vesting.sol contract:
dedicatedCaller- responsible for initiating a new vesting cycle by calling therelease()function. This action updatesunlockPerBlock, which determines the number of tokens unlocked per block during the current cycle.holder- the address that holds the initial DOP token allocation designated for vesting. This address must callapprove()on theDOPtoken contract to allow theVestingcontract to transfer tokens to beneficiaries.signer- the address authorized to sign messages formigrate()andunlock()operations. These signatures are used to verify user eligibility for vesting-related actions.owner- the contract owner with authority to update thededicatedCaller,holder,signer, andaccumulatoraddresses.
Potential Risks
The project is fully or partially centralized, introducing single points of failure and control. This centralization can lead to vulnerabilities in decision-making and operational processes, making the system more susceptible to targeted attacks or manipulation.
The protocol utilizes centralized oracles for external data inputs. Dependence on a singular or limited set of data sources can introduce accuracy and manipulation risks, potentially affecting the DApp's operations and decision-making processes.
The token ecosystem grants a single entity the authority to implement upgrades or changes. This centralization of power risks unilateral decisions that may not align with the community or stakeholders' interests, undermining trust and security.
The implemented Accumulator logic highly depends on external contracts not covered by the audit. This reliance introduces risks if these external contracts are compromised or contain vulnerabilities, affecting the audited project's integrity.
Dependence on external DeFi protocols inherits their risks and vulnerabilities. This might lead to direct financial losses if these protocols are exploited, indirectly affecting the audited project.
The functioning of the system significantly relies on specific external contracts. Any flaws or vulnerabilities in these contracts adversely affect the audited project, potentially leading to security breaches or loss of funds.
Once the vesting begins at START_BLOCK_NUMBER, migration is permanently disabled. Users who fail to migrate within the allowed window will lose access to their legitimate right to receive new tokens, which may result in irreversible loss and user dissatisfaction.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2025-1116 | TWAP Calculation can be Manipulated via End-of-Cycle Spot Price Skewing | fixed | High | |
| F-2025-1112 | Incorrect Handling of Final Vesting Cycle Causes Underflow and DoS in release() Function | fixed | High | |
| F-2025-1179 | Late Migrating Users Receive Disproportionate Instant Unlock | fixed | Medium | |
| F-2025-1120 | Tokens Keep Streaming When Unlock % Should Be 0 % | fixed | Medium | |
| F-2025-1120 | Claimable Amount Calculation Can Be Manipulated Due to Late release() Call | fixed | Medium | |
| F-2025-1113 | Inflation and Price Accumulation Cycles Can Desynchronize | fixed | Medium | |
| F-2025-1179 | Possible Underflow if block.number is Less Than Migration Start Block Number | fixed | Low | |
| F-2025-1120 | Potential Signature Replay | fixed | Low | |
| F-2025-1120 | Requirement Violation - Migration Period Mismatch | fixed | Low | |
| F-2025-1119 | Migration Allowed on STARTBLOCKNUMBER Violates Vesting Start Requirement | fixed | Low |
Appendix 1. Definitions
Severities
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. |
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.
Potential Risks
The "Potential Risks" section identifies issues that are not direct security vulnerabilities but could still affect the project’s performance, reliability, or user trust. These risks arise from design choices, architectural decisions, or operational practices that, while not immediately exploitable, may lead to problems under certain conditions. Additionally, potential risks can impact the quality of the audit itself, as they may involve external factors or components beyond the scope of the audit, leading to incomplete assessments or oversight of key areas. This section aims to provide a broader perspective on factors that could affect the project's long-term security, functionality, and the comprehensiveness of the audit findings.
Appendix 2. Scope
The scope of the project includes the following smart contracts from the provided repository:
Scope Details | |
|---|---|
| Repository | https://github.com/dop-labs/dop-token→ |
| Initial Commit | 86b165d |
| Final Commit | 5c89912 |
| Whitepaper | n/a |
| Requirements | https://github.com/hknio/dop-labs___dop-token/blob/release/v2.0.0/README.md→ |
| Technical Requirements | Provided Files |
Scope Details
- Repository
- https://github.com/dop-labs/dop-token→
- Initial Commit
- 86b165d
- Final Commit
- 5c89912
- Whitepaper
- n/a
- Technical Requirements
- Provided Files
Assets in Scope
Appendix 3. Additional Valuables
Verification of System Invariants
During the audit of DOP, Hacken followed its methodology by performing fuzz-testing on the project's main functions. Foundry, a smart contrat development tool chain was employed to check how the protocol behaves under various inputs. Due to the complex and dynamic interactions within the protocol, unexpected edge cases might arise. Therefore, it was important to use fuzz-testing to ensure that several system invariants hold true in all situations.
Fuzz-testing allows the input of many random data points into the system, helping to identify issues that regular testing might miss. A specific Foundry fuzzing suite was prepared for this task, and throughout the assessment, 10 invariants were tested over 10,000,000 runs. This thorough testing ensured that the system works correctly even with unexpected or unusual inputs.
Invariant | Test Result | Run Count |
|---|---|---|
| mulDiv should match standard division when the product fits in 256 bits. | Passed | 1M+ |
| mulDiv result should satisfy the mathematical floor-division property for all inputs. | Failed | 1M+ |
| mulDivRoundingUp should match standard ceiling division when the product fits in 256 bits. | Passed | 1M+ |
| mulDiv should revert when the denominator is zero. | Passed | 1M+ |
| mulDiv should revert when the final result would overflow a 256-bit integer. | Passed | 1M+ |
| Tick should round-trip through its sqrt ratio back to the same tick. | Passed | 1M+ |
| Sqrt ratio should strictly increase (and decrease) as the tick increases (or decreases). | Passed | 1M+ |
| Derived tick should strictly increase (and decrease) as the sqrt ratio increases (or decreases). | Passed | 1M+ |
| getSqrtRatioAtTick should revert when the tick lies outside the allowed range. | Passed | 1M+ |
| getTickAtSqrtRatio should revert when the sqrt ratio lies outside the allowed range. | Passed | 1M+ |
Invariant
- mulDiv should match standard division when the product fits in 256 bits.
Test Result
- Passed
Run Count
- 1M+
Invariant
- mulDiv result should satisfy the mathematical floor-division property for all inputs.
Test Result
- Failed
Run Count
- 1M+
Invariant
- mulDivRoundingUp should match standard ceiling division when the product fits in 256 bits.
Test Result
- Passed
Run Count
- 1M+
Invariant
- mulDiv should revert when the denominator is zero.
Test Result
- Passed
Run Count
- 1M+
Invariant
- mulDiv should revert when the final result would overflow a 256-bit integer.
Test Result
- Passed
Run Count
- 1M+
Invariant
- Tick should round-trip through its sqrt ratio back to the same tick.
Test Result
- Passed
Run Count
- 1M+
Invariant
- Sqrt ratio should strictly increase (and decrease) as the tick increases (or decreases).
Test Result
- Passed
Run Count
- 1M+
Invariant
- Derived tick should strictly increase (and decrease) as the sqrt ratio increases (or decreases).
Test Result
- Passed
Run Count
- 1M+
Invariant
- getSqrtRatioAtTick should revert when the tick lies outside the allowed range.
Test Result
- Passed
Run Count
- 1M+
Invariant
- getTickAtSqrtRatio should revert when the sqrt ratio lies outside the allowed range.
Test Result
- Passed
Run Count
- 1M+
Additional Recommendations
The smart contracts in the scope of this audit could benefit from the introduction of automatic emergency actions for critical activities, such as unauthorized operations like ownership changes or proxy upgrades, as well as unexpected fund manipulations, including large withdrawals or minting events. Adding such mechanisms would enable the protocol to react automatically to unusual activity, ensuring that the contract remains secure and functions as intended.
To improve functionality, these emergency actions could be designed to trigger under specific conditions, such as:
Detecting changes to ownership or critical permissions.
Monitoring large or unexpected transactions and minting events.
Pausing operations when irregularities are identified.
These enhancements would provide an added layer of security, making the contract more robust and better equipped to handle unexpected situations while maintaining smooth operations.