Concepts
The minimum vocabulary developers need to integrate Aqua0.
Strategies
A strategy is a SwapVM program (bytecode) describing how liquidity behaves during a swap. It encodes the curve, fees, and token pair. A strategy is identified by a stable strategyId equal to keccak256(initialStrategyBytes). The protocol-curated strategy catalog is admin-shipped, so end users join existing strategies rather than authoring their own.
When a strategy is shipped, it is registered in 1inch Aqua's 4D virtual ledger:
_balances[maker][app][strategyHash][token]For Aqua0, maker is the SLP, app is the SwapVM router, and strategyHash rotates on every reship (since Aqua enforces strategy immutability after dock). The stable strategyId lets the brain correlate strategy lifecycle events with its own swap_strategy_commitments table.
Shared Liquidity Pool (SLP)
The SLP is a UUPS-upgradeable custody vault deployed on each supported chain. It holds the tokens, verifies signatures and Aqua handshakes, and emits the events the off-chain brain indexes. It is intentionally a "dumb vault":
- It does not track per-LP balances. There is no
freeBalancemapping. - It does not track per-strategy LP commitments or pro-rata attribution.
- It does not track aggregate committed balances per token.
- It does not record bridge delivery attribution.
All of that lives in the brain DB. The contract is a passthrough that emits the events the brain consumes. The backend pre-validates against its own ledger before signing any payload that mutates SLP state.
The SLP exposes three single-slot privileged identities, each settable only by the contract owner:
| Slot | Purpose |
|---|---|
backendSigner | EIP-712 signer for JITPayload, WithdrawPayload, RepaymentWithdrawPayload |
repaymentWorker | The only EOA allowed to call withdrawForRepayment |
operator | The only EOA allowed to call shipStrategy / dockStrategy / reshipStrategy |
These are independent: leaking one does not authorize the others. There is no AccessControl role mapping.
Liquidity providers
LPs are EOAs or ERC-4337 wallets. They interact with the SLP directly. The SLP uses msg.sender as the LP identity. There is no smart-account factory, no LP smart account, no off-chain filler registration step.
LP deposit and withdraw use the SLP's standard surface (deposit, withdraw, signed-withdraw). Per-LP balance and capacity are derived off-chain by the brain from the indexed Deposited / Withdrawn event stream plus the brain's overlay of pending and settled obligations.
Trader flow: single-chain SwapVM
- Trader calls
POST /api/v1/swaps/quoteto size the trade. - Trader calls
POST /api/v1/swaps/prepareto receive calldata forAquaSwapVMRouter.swap. - Trader submits the transaction.
- The router pulls
tokenOutfrom the SLP and pushestokenInto the SLP, atomically inside Aqua's 4D virtual ledger. - The router emits
Swapped(orderHash, maker, taker, tokenIn, tokenOut, amountIn, amountOut). - The brain's
swapvm-attribution.service.tspoller picks up the event, looks up the matchingswap_strategy_commitmentsrows, and pro-rata-distributes the deltas across each committed LP's overlay.
No on-chain attribution writeback happens. The contract's role ends at the swap.
Trader flow: single-chain V4 JIT
- Trader calls
POST /api/v2/jit/authorizewith the swap params. - The backend signs an EIP-712
JITPayloadand returns it. - Trader submits a v4 swap with the signed payload as
hookData. Aqua0Hook.beforeSwapverifies the signature against the SLP'sbackendSigner, then injects a temporary range backed by SLP capital.- The swap executes against the injected range.
Aqua0Hook.afterSwapremoves the range and emitsSwapSettled.
Trader flow: cross-chain V4 JIT
Same as the single-chain V4 path, but the JIT payload references chain-A LP capital backing a chain-B swap. Once the swap settles on chain B, the brain's SwapSettled poller marks the SwapJITBreakdown settled and queues a repayment obligation. The repayment-worker then drains the source LP (see "Cross-chain mechanism").
Cross-chain mechanism: LayerZero OFT only
The protocol uses LayerZero V2 OFT adapters for all cross-chain repayment. There is no CCTP path, no Stargate path, no Composer hop.
sequenceDiagram
participant Be as Backend (brain)
participant Wk as Repayment-worker
participant SLPA as SLP_A (source)
participant OFT as LayerZero OFT
participant SLPB as SLP_B (destination)
Be->>Wk: signed RepaymentWithdrawPayload
Wk->>SLPA: withdrawForRepayment(payload)
SLPA->>OFT: forwardOut to OFT adapter
OFT-->>SLPB: bridged delivery → tokens in SLP_B balance
Be->>Be: credit destination filler in brain DBThe MockTokenOFTAdapter is the testnet stand-in for canonical OFTs. On mainnet, replace it with the canonical OFT for each token.
There is no on-chain attributeDelivery call. Tokens land directly in the destination SLP's balance via the OFT delivery, and the brain credits the destination filler off-chain.
Off-chain attribution
Attribution lives in the brain DB and the Ponder indexer.
- SwapVM attribution. Brain reads
SwapVMRouter.Swappedand applies pro-rata deltas acrossswap_strategy_commitments. - V4 attribution. Brain reads the SLP's
SwapSettledevent (via Ponder'sslp_swap_settledtable) and applies the route plan to LP overlays. - Cross-chain attribution. Brain walks the same
swap_strategy_commitmentstable and thefiller_repayment_jobsqueue. The on-chain repayment leg uses the samewithdrawForRepaymentplus LayerZero OFT path for both V4 and SwapVM.
Read the brain's snapshot via GET /api/v2/jit/debug/snapshot. The full route table and request/response shapes are auto-generated at GET /openapi.json on the running API.
Chains
Live testnet deployments are on Base Sepolia (chainId 84532) and Unichain Sepolia (chainId 1301). Both chains run the SLP, the V4 Aqua0Hook, the 1inch Aqua and SwapVM router, and LayerZero OFT adapters for mUSDC, mDAI, mWBTC, and mWETH. Live addresses are tracked in backend/deployments/{chainId}.json.