Introduction
We express our gratitude to the Amara team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
Amara is the first perpetual DEX for sustainable assets, helping you invest in a greener future. The scope of this audit is focused on an oracle, composed of a set of contracts that provide several asset prices.
Document | |
|---|---|
| Name | Smart Contract Code Review and Security Analysis Report for Amara |
| Audited By | David Camps Novi, Seher Saylik |
| Approved By | Ivan Bondar, Stepan Chekhovskoi |
| Website | https://amara.exchange→ |
| Changelog | 02/04/2025 - Preliminary Report |
| 17/04/2025 - Final Report | |
| Platform | Odyssey |
| Language | Solidity |
| Tags | Oracle, Upgradeable |
| Methodology | https://hackenio.cc/sc_methodology→ |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for Amara
- Audited By
- David Camps Novi, Seher Saylik
- Approved By
- Ivan Bondar, Stepan Chekhovskoi
- Website
- https://amara.exchange→
- Changelog
- 02/04/2025 - Preliminary Report
- 17/04/2025 - Final Report
- Platform
- Odyssey
- Language
- Solidity
- Tags
- Oracle, Upgradeable
- Methodology
- https://hackenio.cc/sc_methodology→
Review Scope | |
|---|---|
| Repository | https://github.com/DioneProtocol/oracle→ |
| Commit | 76cf526f7719f53cddeadbc1fe6d360749c2471a |
| Retest | 4f230338d493d14fa13c5f66093027aad2be3f7c |
Review Scope
- Repository
- https://github.com/DioneProtocol/oracle→
- Commit
- 76cf526f7719f53cddeadbc1fe6d360749c2471a
- Retest
- 4f230338d493d14fa13c5f66093027aad2be3f7c
Audit Summary
The system users should acknowledge all the risks summed up in the risks section of the report
Documentation quality
Functional requirements are incomplete.
Technical description is limited.
Code quality
The development environment is configured.
The code is not in final state since some features are immature (e.g.
latestRoundData())
Test coverage
Code coverage of the project is 19.21% (branch coverage).
Deployment and basic user interactions are not covered with tests.
Negative cases coverage is missed.
Interactions by several users are not tested thoroughly.
System Overview
Amara is the first perpetual DEX for sustainable assets, helping you invest in a greener future. The scope of this audit is focused on an oracle, composed of a set of contracts that provide several asset prices.
This project is based on the following contracts:
Consumer - data feed consumer that can create requests and receive data.
ConsumerUpgradeable - upgradeable version of the Consumer contract.
DioneOracle - receives data requests, aggregates answers from several oracles and fulfills requests.
PriceFeedV2 - collection of consumer contracts for different assets based on USD.
Privileged roles
DioneOracle::owner - can register/deregister oracles.
DioneOracle::oracle - feeds data back into the system via
fulfillDataRequest().PriceFeedV2::owner - requests a price update to the data feed.
PriceFeedV2::oracle - returns price data by calling
receiveData().
Potential Risks
The project's contracts are upgradable, allowing the administrator to update the contract logic at any time. While this provides flexibility in addressing issues and evolving the project, it also introduces risks if upgrade processes are not properly managed or secured, potentially allowing for unauthorized changes that could compromise the project's integrity and security.
The data feed V2 contracts use 8 decimals as the reference value for decimals returned in the oracles for all contracts. However, the data providers are out of the scope of this audit and the proper usage of decimals cannot be validated.
The system uses external data sources to feed DioneOracle via fulfillDataRequest, which are stored in the state variable oracleNodes. However, such data providers are out of the scope of this audit, resulting in the impossibility to validate the interactions with such external contracts, both in terms of security (e.g. the oracles contained flawed logic or vulnerabilities) and in terms of proper management of those interactions (e.g. unmatched decimals or lack of returned data checks).
A linear scan of the oracleList in deregisterOracle() function risks exceeding block gas limits as the list grows, causing the call to revert, blocking oracle updates, and resulting in a denial‑of‑service.
Both Consumer and Data Feed V2 contracts enforce a strictly increasing reqTimestamp check against a lastHeartbeat stored as a uint256, so if Oracle ever supplies a big value such as the maximum 256‑bit value, no future timestamp can exceed it and every receiveData() call will revert, permanently disabling data ingestion. Because there's no on‑chain reset or overflow protection, a single out‑of‑bounds timestamp effectively "bricks" the consumer. To prevent this, integrators can bound oracle timestamps to the local block.timestamp (or a defined offset).
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2025-9606 | Lack of Zero Value Checks in Returned Oracle Price | fixed | Medium | |
| F-2025-9590 | Unmanaged Payment may Result in Loss of Funds | accepted | Medium | |
| F-2025-9588 | Immutability of requiredResponses may Result in Denial of Service | fixed | Medium | |
| F-2025-9587 | receiveData Does Not Verify Token Pair Match, Request ID and Fails to Update the Price Feed | accepted | Medium | |
| F-2025-9577 | Unrestricted Request Creation Leads to Unbounded Operational Costs and Data Manipulation | accepted | Medium | |
| F-2025-9845 | Missing Non‑Zero Answer Validation in receiveData | accepted | Low | |
| F-2025-9844 | Oracle Deregistration Can Violate Minimum Quorum | accepted | Low | |
| F-2025-9602 | Redundant or Incomplete latestRoundData Method | fixed | Observation | |
| F-2025-9589 | Redundant nonReentrant Modifiers Waste Gas | accepted | Observation | |
| F-2025-9585 | Missing Events for Critical Configuration Updates | accepted | Observation |
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/DioneProtocol/oracle→ |
| Commit | 76cf526f7719f53cddeadbc1fe6d360749c2471a |
| Retest | 4f230338d493d14fa13c5f66093027aad2be3f7c |
| Whitepaper | N/A |
| Requirements | N/A |
| Technical Requirements | N/A |
Scope Details
- Repository
- https://github.com/DioneProtocol/oracle→
- Commit
- 76cf526f7719f53cddeadbc1fe6d360749c2471a
- Retest
- 4f230338d493d14fa13c5f66093027aad2be3f7c
- Whitepaper
- N/A
- Requirements
- N/A
- Technical Requirements
- N/A
Assets in Scope
Appendix 3. Additional Valuables
Verification of System Invariants
During the audit of Amara, Hacken followed its methodology by performing fuzz-testing on the project's main functions. Foundry →, a tool used for fuzz-testing, 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, 5 cases were tested over 10,000 runs. This thorough testing ensured that the system works correctly even with unexpected or unusual inputs.
Invariant | Test Result | Run Count |
|---|---|---|
PriceFeedV2::receiveData() Consumer's aggregated data correctly saved and trade pair check is done | Passed | 10k |
DioneOracle::fulfillDataRequest() An oracle node cannot respond twice to the same request | Passed | 10k |
DioneOracle::fulfillDataRequest() An unregistered oracle cannot fulfill a request | Passed | 10k |
DioneOracle::_aggregateResponses() The aggregated average price is never zero | Failed | 10k |
PriceFeedV2::receiveData() Should not accept any zero price | Failed | 10k |
Invariant
PriceFeedV2::receiveData()Consumer's aggregated data correctly saved and trade pair check is doneTest Result
- Passed
Run Count
- 10k
Invariant
DioneOracle::fulfillDataRequest()An oracle node cannot respond twice to the same requestTest Result
- Passed
Run Count
- 10k
Invariant
DioneOracle::fulfillDataRequest()An unregistered oracle cannot fulfill a requestTest Result
- Passed
Run Count
- 10k
Invariant
DioneOracle::_aggregateResponses()The aggregated average price is never zeroTest Result
- Failed
Run Count
- 10k
Invariant
PriceFeedV2::receiveData()Should not accept any zero priceTest Result
- Failed
Run Count
- 10k
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.