Skip to main content
On Solana, Swaps’ stableswap protocol is a single on-chain program, deployed on mainnet:
It swaps between 6-decimal stable mints:
Integration is permissionless at default rates read from pair_state. Custom pricing is delivered through Swaps-signed router proofs (covered below) — reach out to us to get set up.

Fees and pair_state

Each tradeable pair has a pair_state PDA holding directional fees, refreshed continuously by the Swaps pricing keeper:
  • Seeds: ["pair_state", mint_x, mint_y] where mint_x < mint_y (lexicographic pubkey sort — the lower-sorted mint is canonical X).
  • Fields: mint_x, mint_y, x_to_y_fee_bps, y_to_x_fee_bps, last_updated_slot, bump.
Read the pair_state for your pair to quote the default rate for each direction.

The swap instruction

Accounts, in order: An address lookup table is available to keep transactions compact:

Custom pricing — the router proof

Without a proof, swaps execute at the default pair_state rates. A router proof — an Ed25519 signature produced by the Swaps router key — overrides the rate for a specific swap. This is how partners receive custom pricing. The proof is supplied as an Ed25519 signature-verification precompile instruction that must be at transaction instruction index 0; the program reads it through the Instructions sysvar. The signed message is 118 bytes: The stableswap-sdk npm package’s buildRouterProofMessage and buildRouterProofInstruction helpers are the reference implementation for this encoding. Proofs are signed by Swaps — contact us to set up custom pricing.

Errors