Judging

Ekubo

The most efficient and powerful AMM infrastructure on the EVM.

  • Start date19 Nov 2025
  • End date10 Dec 2025
  • Total awards$183,500 in USDC
  • Duration21 days

Ekubo audit details

  • Total Prize Pool: $183,500 in USDC
    • HM awards: up to $176,800 in USDC
      • If no valid Highs are found, the HM pool is $60,000
      • If no valid Highs or Mediums are found, the HM pool is $0
    • QA awards: $3,200 in USDC
    • Judge awards: $3,000 in USDC
    • Scout awards: $500 in USDC
  • Read our guidelines for more details
  • Starts November 19, 2025 20:00 UTC
  • Ends December 10, 2025 20:00 UTC

❗ Important notes for wardens

  1. A coded, runnable PoC is required for all High/Medium submissions to this audit.
    • This repo includes a basic template to run the test suite.
    • PoCs must use the test suite provided in this repo.
    • Your submission will be marked as Insufficient if the POC is not runnable and working with the provided test suite.
    • Exception: PoC is optional (though recommended) for wardens with signal ≥ 0.68.
  2. Judging phase risk adjustments (upgrades/downgrades):
    • High- or Medium-risk submissions downgraded by the judge to Low-risk (QA) will be ineligible for awards.
    • Upgrading a Low-risk finding from a QA report to a Medium- or High-risk finding is not supported.
    • As such, wardens are encouraged to select the appropriate risk level carefully during the submission phase.

V12 findings

V12 is Zellic's in-house AI auditing tool. It is the only autonomous Solidity auditor that reliably finds Highs and Criticals. All issues found by V12 will be judged as out of scope and ineligible for awards.

V12 findings can be viewed here.

Publicly known issues

Anything included in this section is considered a publicly known issue and is therefore ineligible for awards.

Compiler Vulnerabilities

Any vulnerabilities that pertain to the experimental nature of the 0.8.31 pre-release candidate and the project's toolkits are considered out-of-scope for the purposes of this contest.

Non-Standard EIP-20 Assets

Tokens that have non-standard behavior e.g. allow for arbitrary calls may not be used safely in the system.

Token balances are only expected to change due to calls to transfer or transferFrom.

Any issues related to non-standard tokens should only affect the pools that use the token, i.e. those pools can never become insolvent in the other token due to non-standard behavior in one token.

Extension Freezing Power

The extensions in scope of the audit are not expected to be able to freeze a pool and lock deposited user capital.

Third-party extensions, however, can freeze a pool and lock deposited user capital. This is considered an acceptable risk.

TWAMM Guarantees

TWAMM order execution quality is dependent on the liquidity in the pool and orders on the other side of the pool.

If any of the following conditions are true:

  • Liquidity in the pool is low
  • The other side has not placed orders
  • Blocks are not produced for a period of time

The user may receive a bad price from the TWAMM. This is a known risk; the TWAMM order execution price is not guaranteed.

Overview

Ekubo Protocol delivers the best pricing using super-concentrated liquidity, a singleton architecture, and extensions. The Ekubo protocol vision is to provide a balance between the best swap execution and liquidity provider returns. The contracts are relentlessly optimized to be able to provide the most capital efficient liquidity ever at the lowest cost.

Scope

Files in scope

FilenSLOC
src/Core.sol598
src/Incentives.sol79
src/MEVCaptureRouter.sol30
src/Orders.sol104
src/Positions.sol28
src/PositionsOwner.sol37
src/RevenueBuybacks.sol100
src/Router.sol256
src/TokenWrapper.sol109
src/TokenWrapperFactory.sol17
src/base/BaseExtension.sol44
src/base/BaseForwardee.sol17
src/base/BaseLocker.sol50
src/base/BaseNonfungibleToken.sol69
src/base/BasePositions.sol184
src/base/ExposedStorage.sol16
src/base/FlashAccountant.sol232
src/base/PayableMulticallable.sol13
src/base/UsesCore.sol13
src/extensions/MEVCapture.sol189
src/extensions/Oracle.sol271
src/extensions/TWAMM.sol464
src/interfaces/IBaseNonfungibleToken.sol3
src/interfaces/ICore.sol39
src/interfaces/IExposedStorage.sol3
src/interfaces/IFlashAccountant.sol11
src/interfaces/IIncentives.sol12
src/interfaces/IOrders.sol7
src/interfaces/IPositions.sol9
src/interfaces/IRevenueBuybacks.sol10
src/interfaces/extensions/IMEVCapture.sol10
src/interfaces/extensions/IOracle.sol16
src/interfaces/extensions/ITWAMM.sol18
src/lens/CoreDataFetcher.sol33
src/lens/ERC7726.sol73
src/lens/IncentivesDataFetcher.sol89
src/lens/PriceFetcher.sol159
src/lens/QuoteDataFetcher.sol116
src/lens/TWAMMDataFetcher.sol98
src/lens/TokenDataFetcher.sol64
src/libraries/CoreLib.sol62
src/libraries/CoreStorageLayout.sol65
src/libraries/ExposedStorageLib.sol57
src/libraries/ExtensionCallPointsLib.sol188
src/libraries/FlashAccountantLib.sol152
src/libraries/IncentivesLib.sol47
src/libraries/OracleLib.sol34
src/libraries/RevenueBuybacksLib.sol16
src/libraries/TWAMMLib.sol87
src/libraries/TWAMMStorageLayout.sol44
src/libraries/TimeDescriptor.sol35
src/math/constants.sol6
src/math/delta.sol85
src/math/exp2.sol200
src/math/fee.sol18
src/math/isPriceIncreasing.sol6
src/math/liquidity.sol76
src/math/sqrtRatio.sol69
src/math/tickBitmap.sol73
src/math/ticks.sol97
src/math/time.sol41
src/math/timeBitmap.sol50
src/math/twamm.sol83
src/types/bitmap.sol27
src/types/buybacksState.sol69
src/types/callPoints.sol60
src/types/claimKey.sol12
src/types/counts.sol31
src/types/dropKey.sol12
src/types/dropState.sol28
src/types/feesPerLiquidity.sol18
src/types/locker.sol19
src/types/mevCapturePoolState.sol18
src/types/observation.sol18
src/types/orderConfig.sol31
src/types/orderId.sol2
src/types/orderKey.sol34
src/types/orderState.sol33
src/types/poolBalanceUpdate.sol18
src/types/poolConfig.sol114
src/types/poolId.sol2
src/types/poolKey.sol19
src/types/poolState.sol36
src/types/position.sol24
src/types/positionId.sol40
src/types/snapshot.sol29
src/types/sqrtRatio.sol104
src/types/storageSlot.sol36
src/types/swapParameters.sol64
src/types/tickInfo.sol24
src/types/timeInfo.sol36
src/types/twammPoolState.sol44
Totals6283

For a machine-readable version, see scope.txt

Files out of scope

File
test/**.**
Totals: 68

For a machine-readable version, see out_of_scope.txt

Additional context

Areas of concern (where to focus for bugs)

Assembly Block Usage

We use a custom storage layout and also regularly use stack values without cleaning bits and make extensive use of assembly for optimization. All assembly blocks should be treated as suspect and inputs to functions that are used in assembly should be checked that they are always cleaned beforehand if not cleaned in the function. The ABDK audit points out many cases where we assume the unused bits in narrow types (e.g. the most significant 160 bits in a uint96) are cleaned.

Main invariants

The sum of all swap deltas, position update deltas, and position fee collection should never at any time result in a pool with a balance less than zero of either token0 or token1.

All positions should be able to be withdrawn at any time (except for positions using third-party extensions; the extensions in the repository should never block withdrawal within the block gas limit).

The codebase contains extensive unit and fuzzing test suites; many of these include invariants that should be upheld by the system.

All trusted roles in the protocol

RoleDescription
Positions OwnerCan change metadata and claim protocol fees
RevenueBuybacks OwnerCan configure buyback rules and withdraw leftover tokens
BaseNonfungibleToken OwnerCan set metadata of the NFT

Running tests

Prerequisites

The repository utilizes the foundry (forge) toolkit to compile its contracts, and contains several dependencies through foundry that will be automatically installed whenever a forge command is issued.

Most importantly, the codebase relies on the clz assembly operation code that has been introduced in the pre-release solc version 0.8.31. This version is not natively supported by foundry / svm and must be manually installed.

The compilation instructions were evaluated with the following toolkit versions:

  • forge: 1.4.4-stable
  • solc: 0.8.31-pre.1

solc-0.8.31 Compiler Installation

The 0.8.31 compiler must become available as if it had been installed using the svm-rs toolkit that foundry uses under the hood. As the toolkit itself does not support pre-release candidates, the version must be manually installed.

To achieve this, one should head to the folder where solc versions are installed:

  • Default Location: ~/.svm
  • Linux ~/.local/share/svm
  • macOS: ~/Library/Application Support/svm
  • Windows Subsystem for Linux: %APPDATA%\Roaming\svm

A folder named 0.8.31 should be created within and the pre-release binary of your architecture should be placed inside it aptly named solc-0.8.31 without any extension.

To download the relevant pre-release binary, visit the following official Solidity release page: https://github.com/argotorg/solidity/releases/tag/v0.8.31-pre.1

Building

After the relevant 0.8.31 compiler has been installed properly, the traditional forge build command will install the relevant dependencies and build the project:

forge build

Tests

The following command can be issued to execute all tests within the repository:

forge test

Submission PoCs

The scope of the audit contest involves multiple internal and high-level contracts of varying complexity that are all combined to form the Ekubo AMM system.

Wardens are instructed to utilize the respective test suite of the project to illustrate the vulnerabilities they identify, should they be constrained to a single file (i.e. RevenueBuybacks vulnerabilities should utilize the RevenueBuybacks.t.sol file).

If a custom configuration is desired, wardens are advised to create their own PoC file that should be executable within the test subfolder of this contest.

All PoCs must adhere to the following guidelines:

  • The PoC should execute successfully
  • The PoC must not mock any contract-initiated calls
  • The PoC must not utilize any mock contracts in place of actual in-scope implementations

Miscellaneous

Employees of Ekubo Protocol and employees' family members are ineligible to participate in this audit.

Code4rena's rules cannot be overridden by the contents of this README. In case of doubt, please check with C4 staff.