TRUST Summit | Nov 3, 2025 | NYCWhere decision-makers define the next chapter of secure blockchain adoption.
Learn more

Audit name:

[SCA] Covalent | Migration-Contracts | Jun2024

Date:

Jul 4, 2024

Table of Content

Introduction
Audit Summary
System Overview
Risks
Findings
Appendix 1. Severity Definitions
Appendix 2. Scope
Disclaimer

Want a comprehensive audit report like this?

Introduction

We express our gratitude to the Covalent team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.

Document

NameSmart Contract Code Review and Security Analysis Report for Covalent
Audited By, Viktor Raboshchuk
Approved ByPrzemyslaw Swiatowiec
Websitehttps://www.covalenthq.com/
Changelog27/06/2024 - Preliminary Report, 04/07/2024 - Final Report
PlatformEVM
LanguageSolidity
TagsERC20
Methodologyhttps://hackenio.cc/sc_methodology

Review Scope

Repositoryhttps://github.com/covalenthq/covalent-x-token
Commit3c3db2841fcd77415c42413feabe483f9b8a8881

Audit Summary

4Total Findings
4Resolved
0Accepted
0Mitigated

The system users should acknowledge all the risks summed up in the risks section of the report

Documentation quality

  • Functional requirements are mostly missed.

  • The technical description is not provided.

  • NatSpec is sufficient.

Code quality

  • No code quality issues were found.

Test coverage

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

  • Deployment and basic user interactions are covered with tests.

System Overview

CovalentMigration - is a smart contract that is designed for the initial migration of Covalent Network Tokens. It has a setToken function to set a new token, and batchDistribute function to distribute tokens to multiple recipients in one transaction.

CovalentXToken - is a ERC20 token with additional functionalities. It inherits from ERC20Permit and AccessControlEnumerable, and implements ICovalentXToken. The mint function allows token minting within a capped rate, updateMintCap changes the minting cap, updatePermit2Allowance manages permit2's allowance. The token has the following attributes:

  • Name: Covalent X Token

  • Symbol: CXT

  • Decimals: 18

DefaultEmissionManager - is a contract designed for managing the emissions of the Covalent ERC20 token on Ethereum L1. It uses Ownable2StepUpgradeable for ownership management and SafeERC20 for safe token operations. The mint function calculates the new supply based on the elapsed time and mints the required amount to maintain the target inflation rate, transferring minted tokens to the treasury. The inflatedSupplyAfter function calculates the expected supply after a given time period using the PowUtil library.

Privileged roles

  • The owner of the CovalentMigration contract can set new tokens, and distribute the tokens to the users.

  • The DEFAULTADMINROLE of the CovalentXToken contract can grant and revoke any roles.

  • The EMISSION_ROLE of the CovalentXToken contract can mint new tokens using the mint function, within the constraints of the minting cap.

  • The CAPMANAGERROLE of the CovalentXToken contract can update the minting cap using the updateMintCap function.

  • The PERMIT2REVOKERROLE of the CovalentXToken contract can update the allowance for the PERMIT2 address using the updatePermit2Allowance function.

  • The deployer (set during the contract deployment) of the DefaultEmissionManager.sol contract is the only entity allowed to initialize the contract

Risks

The project utilizes Solidity version 0.8.20 or higher, which includes the introduction of the PUSH0 (0x5f) opcode. This opcode is currently supported on the Ethereum mainnet but may not be universally supported across other blockchain networks. Consequently, deploying the contract on chains other than the Ethereum mainnet, such as certain Layer 2 (L2) chains or alternative networks, might lead to compatibility issues or execution errors due to the lack of support for the PUSH0 opcode. In scenarios where deployment on various chains is anticipated, selecting an appropriate Ethereum Virtual Machine (EVM) version that is widely supported across these networks is crucial to avoid potential operational disruptions or deployment failures.

The project has minimal documentation. This lack of comprehensive comments and explanations can lead to misunderstandings about the contract's functionality and intended behavior. It also makes the contract harder to maintain and audit, as future developers or auditors may not fully understand the contract's logic or the implications of its functions. This could potentially lead to overlooked bugs or security vulnerabilities. Furthermore, it may not meet the functional requirements if they are not clearly documented and understood.

In the DefaultEmissionManager.sol contract, the exp2 function from the PowUtil library is called with a potentially large argument. The exp2 function expects an unsigned 192.64-bit fixed-point number, and returns a 60.18 unsigned fixed-point number. If the argument passed to exp2 exceeds the precision of a 192.64-bit fixed-point number, it could result in precision loss and inaccurate calculations.

The DefaultEmissionManager.sol contract uses the safeApprove function from the OpenZeppelin library, which has been deprecated due to potential security risks. The safeApprove function can potentially lead to a race condition where someone may use both the old and the new allowance due to unfortunate transaction ordering. This could result in unauthorized or unexpected token transfers. OpenZeppelin recommends first reducing the spender's allowance to 0 and then setting the desired value to mitigate this risk.

The CovalentXToken.sol contract forces users to grant infinite approval to the PERMIT2 address from Uniswap when the permit2Enabled variable is set to true. This could potentially expose users to unnecessary risks, as it allows the PERMIT2 address to spend an unlimited amount of tokens from the user's account at any time. While this might be intended to facilitate transactions with PERMIT2, it could be seen as an overreach, as users could simply approve to PERMIT2 when they want to use it, rather than being forced to grant infinite approval. This practice could potentially lead to misuse or unintended token transfers if the PERMIT2 address is compromised.

The DefaultEmissionManager.sol contract's constructor is initializing immutable variables. This practice is generally discouraged because immutable variables are set at contract creation and cannot be changed afterwards. In the context of upgradeable contracts, this means that all proxies that share the same implementation contract will also share the same values for these immutable variables. If this is not the intended behavior, it could lead to unexpected results and potential security risks.

Findings

Code
Title
Status
Severity
F-2024-4076Inefficient Token Minting Process in DefaultEmissionManager.sol
fixed

Observation
F-2024-4075 Incomplete Initialization of DefaultEmissionManager.sol Contract
fixed

Observation
F-2024-4073Floating Pragma Statement in CovalentXToken.sol
fixed

Observation
F-2024-4072Missing Zero Address Check in setToken Function
fixed

Observation
1-4 of 4 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/covalenthq/covalent-x-token
Commit3c3db2841fcd77415c42413feabe483f9b8a8881
Deployed Address0x7ABc8A5768E6bE61A6c693a6e4EAcb5B60602C4D (Ethereum Mainnet)
Whitepaper
Requirementshttps://covalentnetwork.mintlify.app/introduction
Technical Requirementshttps://covalentnetwork.mintlify.app/introduction

Contracts in Scope

CovalentMigration.sol - CovalentMigration.sol
CovalentXToken.sol - CovalentXToken.sol
DefaultEmissionManager.sol - DefaultEmissionManager.sol
lib
PowUtil.sol - lib › PowUtil.sol
interfaces
ICovalentMigration.sol - interfaces › ICovalentMigration.sol
ICovalentXToken.sol - interfaces › ICovalentXToken.sol
IDefaultEmissionManager.sol - interfaces › IDefaultEmissionManager.sol

Disclaimer