Skip to content

feat: add Rubicon Aquila V2 (constant-product AMM, 4 chains) - #1182

Open
bghughes wants to merge 1 commit into
VeloraDEX:masterfrom
RubiconDeFi:feat/add-rubicon-aquila-v2
Open

feat: add Rubicon Aquila V2 (constant-product AMM, 4 chains)#1182
bghughes wants to merge 1 commit into
VeloraDEX:masterfrom
RubiconDeFi:feat/add-rubicon-aquila-v2

Conversation

@bghughes

@bghughes bghughes commented May 19, 2026

Copy link
Copy Markdown

Summary

Adds Rubicon Aquila V2 — Rubicon Finance's UniswapV2-fork constant-product AMM — as a routable liquidity source via the existing generic UniswapV2 adapter. Aquila is deployed on Ethereum, Optimism, Arbitrum, and Base.

Scope

Config-only on the adapter side. The UniswapV2 class in this repo is parameterized over UniswapV2Config and auto-registers every key via getDexKeysWithNetwork/_.omit. Adding Aquila is a new top-level entry in that map. No new directory, no new class, no math.

Files changed (5 files, +109 / -0)

  • src/dex/uniswap-v2/config.ts — one new entry, RubiconAquila, covering all four chains.
  • src/dex/uniswap-v2/uniswap-v2-e2e-mainnet.test.ts — one minimal describe('RubiconAquila', ...) block with a single SELL test (WETH → USDC).
  • src/dex/uniswap-v2/uniswap-v2-e2e-optimism.test.ts — same shape, single SELL test (USDC → DAI — Aquila Optimism has no native WETH/USDC pair).
  • src/dex/uniswap-v2/uniswap-v2-e2e-arbitrum.test.ts — single SELL test (WETH → USDC).
  • src/dex/uniswap-v2/uniswap-v2-e2e-base.test.ts — single SELL test via the file's testForNetwork() helper (WETH/USDC).

Configuration

Chain Factory Init code hash feeCode
Ethereum 0x7bad585c3ae4ae266f92a4af13b388bc7b26067c 0x79cb29831f0abd24ae48de6fa5dc9eb647f10df38618ed09b70b2044d35dfba5 30
Optimism 0x3B2C6fe3039B42f00E98b76531C05932abfB258e same 30
Arbitrum 0xEca3EA559b7566e610d113bbA8D1B15B085C9c68 same 30
Base 0xA5cA8Ba2e3017E9aF3Bd9EDa69e9E8C263Abf6cD same 30

Verification

  • Pair swap() ABI — byte-identical to UniswapV2 (IAquilaPair.sol:70-75).
  • getReserves() shape — standard UniV2 (uint112, uint112, uint32) confirmed on-chain.
  • Init code hash — sourced from RubiconDeFi/aquila → AquilaLibrary.sol:35; verified on-chain by computing pairFor(USDC.e, OP) and matching factory.allPairs(0) on Optimism.
  • Fee997/1000 numerator from AquilaLibrary.sol:82feeCode: 30 (standard UniV2).
  • Cross-validation — the Aquila Base factory 0xA5cA8Ba2e3017E9aF3Bd9EDa69e9E8C263Abf6cD is the same address DefiLlama/DefiLlama-Adapters already indexes at projects/rubicon/index.js.

Local checks

pretty-quick, tsc, and eslint all pass (run via the repo's prepare script during pnpm install and again via the pre-commit hook). Existing uniswap-v2-integration.test.ts continues to pass on the 2 RPC-only cases (getTopPoolsForToken requires API_KEY_THE_GRAPH which we don't set locally — affects all UniswapV2 forks equally, not specific to this change).

Links


Note

Low Risk
Low risk: config-only addition of a new UniswapV2-fork entry plus new e2e tests; main risk is incorrect factoryAddress/initCode values causing routing or quoting failures on the listed networks.

Overview
Adds RubiconAquila to UniswapV2Config, wiring in factory addresses + init code hash (and standard feeCode/gas estimates) for Mainnet, Optimism, Arbitrum, and Base so the existing UniswapV2 adapter can route against Aquila.

Extends UniswapV2 e2e suites on those networks with minimal RubiconAquila swap tests (e.g., WETH→USDC on Mainnet/Arbitrum/Base, USDC→DAI on Optimism) to validate integration.

Reviewed by Cursor Bugbot for commit 1ed2fe3. Bugbot is set up for automated code reviews on this repo. Configure here.

Adds Rubicon Aquila V2, a UniswapV2-fork constant-product AMM deployed by
Rubicon Finance on Ethereum, Optimism, Arbitrum, and Base, as a routable
liquidity source via the existing generic UniswapV2 adapter.

Aquila is byte-identical to UniswapV2 — same pair `swap()` ABI
(IAquilaPair.sol:70-75), same `getReserves()` shape, and the standard
997/1000 fee numerator (AquilaLibrary.sol:82). Adding it is a single
new entry in UniswapV2Config plus a minimal SELL e2e test per chain.

Pair init code hash (same on all chains, from AquilaLibrary.sol:35):
  0x79cb29831f0abd24ae48de6fa5dc9eb647f10df38618ed09b70b2044d35dfba5

Factories:
  Ethereum: 0x7bad585c3ae4ae266f92a4af13b388bc7b26067c
  Optimism: 0x3B2C6fe3039B42f00E98b76531C05932abfB258e
  Arbitrum: 0xEca3EA559b7566e610d113bbA8D1B15B085C9c68
  Base:     0xA5cA8Ba2e3017E9aF3Bd9EDa69e9E8C263Abf6cD

Cross-validation: Aquila Base factory matches the address DefiLlama's
adapter already indexes at DefiLlama-Adapters projects/rubicon/index.js.

Docs: https://docs.rubicon.finance/integrations
Contracts: https://github.com/RubiconDeFi/aquila
@bghughes

bghughes commented Jun 2, 2026

Copy link
Copy Markdown
Author

Hi @0xNazarii @KanievskyiDanylo 👋 — friendly bump on this one. It adds Rubicon's Aquila V2 (constant-product AMM) across 4 chains; CI (Cursor Bugbot) is green and there are no open comments. Companion to #1183 (our CLMM PR). Happy to rebase or address anything whenever you get a chance — thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant