Swap Module

Architecture Overview

City Protocol's swap infrastructure delivers best-execution token exchange as part of our Neofinance as a Service layer. It is designed to route trades across hundreds of liquidity aggregating liquidity from top decentralized exchanges (e.g PancakeSwap, Aerodrome, Uniswap) and bridge protocols (Li.Fiarrow-up-right), in order to guarantees best-execution pricing and minimal slippage, exposed via the @cityprotocol/core SDK and the CitySwapClient interface.

These swap modules support quote discovery, transaction building, approval orchestration, and optional one-shot execution. This modular request-then-execute workflow mirrors the order management patterns used by professional trading desks, bridging the gap between institutional-grade routing and decentralized liquidity.

City Protocol's swap client is implemented in TypeScript, shipped inside the @cityprotocol/core package, and supports both EVM and Solana ecosystems. The architecture is entirely transport-agnostic and wallet-neutral.

circle-info

This module is natively integrated into the Vault Architecture, allowing curators to execute complex rebalancing strategies efficiently and enabling users to deposit into vaults using any supported asset, with the Swap Module handling the underlying conversion automatically.


Key Components

Component
Description

Quote Discovery

Read-only price estimates that simulate a swap against live aggregator routes before any transaction is committed.

Transaction Building

Aggregator-generated swap payloads with configurable slippage, gas preferences, and swap mode.

Approval Management

Allowance checks and ERC-20 approval calldata generation, with automatic handling of stale USDT-like approvals.

Execution Orchestration

End-to-end swap flow mediated through a developer-supplied executeTransaction callback.


Underlying Protocols

Last updated