ProtocolCore release 0.1.0

Public Swap

A standard signed token swap settles directly between a trader's SPL accounts and the pool's public LP vaults.

A Public Swap is the ordinary CPMM path. The trader signs the transaction, debits an input token account, receives output into the other token account and is visible as a transaction signer. The pool and reserve movements are public as well.

Trader token account → LP input vault → LP output vault → Trader token account
       public                 public            public              public

What the program checks

The instruction identifies a pool, direction, amount_in and caller-specified min_amount_out. Core reads both LP vault balances, computes the fee-adjusted integer output, checks the minimum and the LP-claim reserve floor, then executes checked SPL Token transfers. The pool's swap nonce increments after settlement.

The trader's public key is the trader signer account, not a value inferred from a relayer. The transaction's token accounts and the trader identity are therefore directly associated in the instruction.

Public data

Visible on-chainWhy
Trader signer and token accountsThey sign and authorize the token transfers.
Pool, input/output mint and directionThey are explicit in the instruction and accounts.
Input amount and minimum outputThey are instruction arguments.
Output, reserve changes and fee-vault changesThey result from public token transfers.

Public Swap does not use a shielded note or a proof. For the shielded alternative, see Private Swap; for the exact math, see CPMM.

PreviousFeesNext Shield
Source baseline: frozen Core v0.1.0 / SDK v0.1.1.