Skip to content

[help wanted] Camelot V3 router + DexRouter trait (multi-DEX routing) #10

@abhicris

Description

@abhicris

Context

The dex module (src/dex/mod.rs, src/dex/router.rs) currently supports only Uniswap V3. On Arbitrum, Camelot V3 is a major DEX and routes a meaningful share of agent volume that Uniswap doesn't cover (especially ARB/GMX pairs). Adding a CamelotV3Router alongside UniswapV3Router, behind a common router trait, unlocks multi-DEX routing for agents without changing any caller code.

Scope

Medium-effort ticket. Touch:

  • src/dex/mod.rs — extract a trait DexRouter { fn quote(...); fn build_swap(...); ... } that both routers implement. Keep UniswapV3Router working through the trait.
  • src/dex/camelot.rs — new file implementing CamelotV3Router. Camelot V3 uses a fork of Algebra — the router is at 0x1F721E2E82F6676FCE4eA07A5958cF098D339e18 on Arbitrum. Use alloy sol! for the ABI (same pattern as UniswapV3Router).
  • DexModule in src/dex/mod.rs — accept any DexRouter instead of the concrete Uniswap type. Keep the DexModule::new(chain) constructor defaulting to Uniswap so no downstream breaks.
  • New example: examples/camelot_quote.rs that prints a USDC → WETH quote on Arbitrum via Camelot.
  • Unit test comparing Camelot + Uniswap quotes for the same pair (Arbitrum only). Offline — mock the RPC using alloy's provider mock or gate with #[ignore].

Acceptance criteria

  • cargo test green.
  • cargo clippy --all-targets -- -D warnings clean.
  • DexRouter trait documented with rustdoc.
  • Example runs and prints a non-zero quote.

Reference: src/chains/arbitrum.rs for the sol! macro usage; PR #4 for CI expectations.

Estimated effort

M (1–2 days)

kcolbchain / Abhishek Krishna

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions