Introduction
We express our gratitude to the DragonX team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
DragonX is a derivative of TitanX adoption, facilitates the creation of maximum-length TitanX stakes through publicly callable functions, utilizing Ethereum rewards to continuously purchase and burn TitanX off the market, while DragonX tokens serve as incentives for users max-staking their TitanX tokens during the launch phase.
| title | content |
|---|---|
| Platform | DragonX |
| Language | Solidity |
| Tags | Staking, ERC20 |
| Timeline | 11/01/2024 - 17/01/2024 |
| Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
|---|---|
| Repository | https://github.com/DragonX2024888/DragonX→ |
| Commit | 95e66c5 |
Review Scope
- Commit
- 95e66c5
Audit Summary
10/10
95.52%
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 DragonX |
| Audited By | Kaan Caglan |
| Approved By | Ataberk Yavuzer |
| Website | https://dragonx.win/→ |
| Changelog | 15/01/2024 - Preliminary Report |
| 17/01/2024 - Final Report |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for DragonX
- Audited By
- Kaan Caglan
- Approved By
- Ataberk Yavuzer
- Website
- https://dragonx.win/→
- Changelog
- 15/01/2024 - Preliminary Report
- 17/01/2024 - Final Report
System Overview
DragonX is a derivative of TitanX adoption, facilitates the creation of maximum-length TitanX stakes through publicly callable functions, utilizing Ethereum rewards to continuously purchase and burn TitanX off the market, while DragonX tokens serve as incentives for users max-staking their TitanX tokens during the launch phase.
DragonBuyAndBurn — a contract that swaps the cumulated ETH in the contract to DragonX and burns them to regulate token value. %3 of the operated amount gets sent to the caller as an incentive.
DragonX — is an ERC20 token contract that allows minting DragonX tokens for users exchanging TitanX tokens. The contract also manages the allocation of rewards, handles the deployment of new DragonStake instances, and enables the contract owner to claim accumulated assets from a Genesis Vault. DragonX token price differs by time and the price ratio once the mint phase is started is as followed:
Week 1 1 TitanX : 1 DragonX
Week 2 1 TitanX : 1 DragonX
Week 3 1 TitanX : 0.95 DragonX
Week 4 1 TitanX : 0.90 DragonX
Week 5 1 TitanX : 0.85 DragonX
Week 6 1 TitanX : 0.80 DragonX
Week 7 1 TitanX : 0.75 DragonX
Week 8 1 TitanX : 0.70 DragonX
Week 9 1 TitanX : 0.65 DragonX
Week 10 1 TitanX : 0.60 DragonX
Week 11 1 TitanX : 0.55 DragonX
Week 12 1 TitanX : 0.50 DragonX
DragonX token has the following attributes:
Name: DragonX
Symbol: DRAGONX
Decimals: 18
Total supply: N/A - no max cap
TitanBuy — a contract that receives ETH rewards based on TitanX stakes from DragonX contract. 44.5% of the earned rewards from staking is sent to TitanBuy contract.
TitanBuy swaps the received Eth for TitanX and sends it to the DragonX's vault. Caller of this swap operation in the TitanBuy contract is eligible to get %3 of the amount as an incentive to cover Gas fees.
DragonStake — a staking management contract that is created by DragonX contract. A new DragonStake instance is deployed whenever the number of open stakes in the current active instance exceeds the maximum allowed per wallet.
OracleLibrary — a library that helps to calculate the time-weighted means of tick and liquidity for a specified Uniswap V3 pool, based on observations made in the past.
PoolAddress — a library that provides functionality to compute the address of a Uniswap V3 pool based on the factory, tokens, and fee.
TickMath — a library that facilitates the precise calculation of square root prices based on tick values, and reciprocally, to determine the corresponding tick values for given square root prices.
Constants — a Solidity file that establishes various constants and parameters for the TitanX protocol and its associated functionalities. It defines numerical values, such as scaling factors and time-related constants, as well as specific parameters related to TitanX staking, bonus structures, and Uniswaprelated addresses and liquidity pools.
Types — A simple enumerator to indicate the initial liquidity for the DragonX / TitanX pool has been minted.
Privileged roles
The owner of the DragonBuyAndBurn contract can:
create the initial liquidity for DragonX/TitanX
set the address of the DragonX contract
set the cap per swap set the slippage percentage
set the buy and burn interval
set the average time to use in TWAP calculations of TitanX and DragonX
The owner of DragonX contract can:
set the DRAGONXBUYAND_BURN address
set the TitanBuy address
withdraws the assets that are collected for the genesis vault
The owner of the TitanBuy contract can:
set the DragonX address
set the cap per swap
set the slippage percentage
set the slippage percentage
set the buy and burn interval
set the average time to use in TWAP calculations of TitanX
Executive Summary
Documentation quality
The total Documentation Quality score is 10 out of 10.
Functional requirements are provided
Technical description is provided.
NatSpec is sufficient.
Code quality
The total Code Quality score is 10 out of 10.
The code follows the Solidity best practices.
Test coverage
Code coverage of the project is 95.52% (branch coverage).
Not all branches are covered with tests.
Security score
Upon auditing, the code was found to contain 0 critical, 0 high, 0 medium, and 0 low severity issues, 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.8. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
The implementation of if (msg.sender != tx.origin) in the buyAndBurnDragonX, claim and buyTitanX functions introduces a significant limitation, preventing these functions from being executed through any multisig wallet. This restriction could lead to reduced flexibility and potential operational inefficiencies for users relying on multisig wallets for enhanced security.
Findings
private Rather Than public For Constantsindexedhardhat importOwnable2Step rather than OwnableCode ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2024-0459 | Use private Rather Than public For Constants | unfixed | Observation | |
| F-2024-0437 | Event is not properly indexed | unfixed | Observation | |
| F-2024-0436 | Style Guide Violation | unfixed | Observation | |
| F-2024-0435 | Remove hardhat import | unfixed | Observation | |
| F-2024-0434 | Public Functions That Should Be External | unfixed | Observation | |
| F-2024-0433 | Owner Can Renounce Ownership | unfixed | Observation | |
| F-2024-0432 | Cache State Variables | unfixed | Observation | |
| F-2024-0431 | Unused Error Definition | fixed | Observation | |
| F-2024-0430 | Custom Errors in Solidity for Gas Efficiency | unfixed | Observation | |
| F-2024-0427 | Use Ownable2Step rather than Ownable | fixed | Observation |
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/DragonX2024888/DragonX→ |
| Commit | 95e66c52a3cac7991f4d4cf51a9897d131eb95bb |
| Whitepaper | Not provided |
| Requirements | Provided |
| Technical Requirements | Provided |
Scope Details
- Commit
- 95e66c52a3cac7991f4d4cf51a9897d131eb95bb
- Whitepaper
- Not provided
- Requirements
- Provided
- Technical Requirements
- Provided