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]wheremint_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.
pair_state for your pair to quote the default rate for each
direction.
The swap instruction
An address lookup table is available to keep transactions compact:
Custom pricing — the router proof
Without a proof, swaps execute at the defaultpair_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
Related
- Stableswap on EVM — the same protocol behind the GhostExchange interface.
- Stableswaps via the API — the same liquidity through
a single
getActioncall.