4. Architecture

4.1 Control Plane vs Data Plane

Control plane components compute quotes and route plans from a normalised liquidity graph snapshot. Data plane components execute multi-leg plans and maintain the exchange lifecycle.

Figure 1. Control plane vs data plane architecture.

Components

Control Plane

Component
Description

API Gateway

Entry point for all requests. Authenticates via x-api-key.

Graph Service

Builds snapshots of available liquidity venues and token graphs.

Constraints & Policy

Enforces venue restrictions, size limits, and TTL rules.

Routing Engine

Computes optimal routes using k-best path algorithm with scoring. Outputs a RoutePlan.

Data Plane

Component
Description

Swap/Exchange Service

Receives the RoutePlan and manages swap lifecycle as a state machine.

Durable Queue

Persists swap jobs to ensure reliable, at-least-once delivery to the orchestrator.

Execution Orchestrator

Executes swap legs idempotently, coordinating across adapters and recording logs.

State Store

Persists swap state, individual legs, and a full audit trail.

Recipient Address

Resolves and validates the destination address for the swap output.

Provider Adapter

Generic adapter interface for liquidity providers.

DEX Adapter

Adapter for decentralized exchange integrations.

CEX Adapter

Adapter for centralized exchange integrations.


Data Flow

  1. A request hits the API Gateway and is authenticated.

  2. The Graph Service provides a live liquidity snapshot; Constraints & Policy applies limits.

  3. The Routing Engine computes the best route and emits a RoutePlan.

  4. The RoutePlan is handed to the Swap/Exchange Service, which transitions through states.

  5. Jobs are durably enqueued in the Durable Queue.

  6. The Execution Orchestrator picks up jobs and dispatches legs to the appropriate adapter (Provider, DEX, or CEX).

  7. All state transitions and results are written to the State Store for auditability.

Last updated