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
Context
The
dexmodule (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 aCamelotV3RouteralongsideUniswapV3Router, 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 atrait DexRouter { fn quote(...); fn build_swap(...); ... }that both routers implement. KeepUniswapV3Routerworking through the trait.src/dex/camelot.rs— new file implementingCamelotV3Router. Camelot V3 uses a fork of Algebra — the router is at0x1F721E2E82F6676FCE4eA07A5958cF098D339e18on Arbitrum. Use alloysol!for the ABI (same pattern asUniswapV3Router).DexModuleinsrc/dex/mod.rs— accept anyDexRouterinstead of the concrete Uniswap type. Keep theDexModule::new(chain)constructor defaulting to Uniswap so no downstream breaks.examples/camelot_quote.rsthat prints a USDC → WETH quote on Arbitrum via Camelot.alloy's provider mock or gate with#[ignore].Acceptance criteria
cargo testgreen.cargo clippy --all-targets -- -D warningsclean.DexRoutertrait documented with rustdoc.Reference:
src/chains/arbitrum.rsfor thesol!macro usage; PR #4 for CI expectations.Estimated effort
M (1–2 days)
— kcolbchain / Abhishek Krishna