Swapping
Swap tokens, understand dynamic fees, and check pool trading controls
A swap exchanges one token for another. Coffer uses exact-input swaps: you choose the input amount, and the output depends on pool state when the transaction executes.
Before you sign
- Select the input token, output token, and amount.
- Review the pool or route, expected output, fees, and price impact.
- Choose slippage tolerance and check the minimum received.
- Sign in your wallet and wait for confirmation.
The interface can split a trade across several pools. A quote is an estimate, not a reservation: trades, liquidity changes, or pool updates can change the result before execution.
For SOL, the app wraps it into a token account. Keep enough SOL for network fees and any required account creation.
What determines your output?
The swap prices your trade using virtual balances, which provide the
concentrated liquidity depth, and the input/output token weights. For input
x after token transfer fees and the pool's base fee, the curve is:
amountOut = V_out × (1 − (V_in / (V_in + x))^(w_in / w_out))V_in and V_out are virtual balances; w_in and w_out are weights.
The contract evaluates this directly, without separately computing or
storing a pool-wide invariant. The formula above omits integer rounding.
If its output exceeds LP-owned actual reserves, the swap fails; output
is never silently reduced to fit inventory. Dynamic fees and any
output-token transfer fee then reduce the amount you receive.
Read Price Impact and Slippage for your output minimum, Fees for charges, and Pricing Model for calculations.
Pool controls that affect a swap
These controls are checked on-chain when your transaction executes.
Max sell-off window
Each token can have a max sell-off window limiting how much can be
sold into this pool over time, across all traders. The pool admin sets
the period and a cap based on a snapshot of that token's virtual balance.
Sales count the input received by the pool, after any token transfer fee
but before the pool's base fee. A trade exceeding
remaining capacity fails, even if you accept a higher fee or slippage.
Older sales gradually age out; splitting a sale or buying the token back
does not reset its counter. Setting max_selloff_pct to zero disables
both the cap and its dynamic fee. See Window Capacity.
Illustrative settings · selling FARTCOIN
Dynamic fees
An enabled max sell-off window can also charge a dynamic fee. Its rate is zero through the configured threshold, then starts at a configured low rate and rises toward a maximum as the window fills. An optional kink sets a middle rate at a chosen percentage of the window's capacity. Selling FARTCOIN uses FARTCOIN's window; buying it uses the input token's settings. Only output generated by the above-threshold part of a sale is charged. The fee is deducted from the output token and reserved for the protocol. See Dynamic Fees.
FARTCOIN · example sale of 1,000
Fee rate
through 80% fill
Window fill · 100% = 10,000 FARTCOIN cap
85% → 95%Each segment’s output ×
its average rate
Pool-wide trading switches
The pool admin or protocol admin can turn swaps_enabled off or on.
When off, all swaps in that pool fail; proportional deposits and
withdrawals remain available if the pool itself is enabled. A separate
pool_enabled flag lets the protocol admin pause the whole pool,
including normal deposits and withdrawals. Both flags must be enabled
for a swap to execute. Re-enabling the pool does not change its swap or
token flags. A quote received before a pause cannot bypass it.
See Pool Controls.
Individual token status
The pool admin or protocol admin can disable or re-enable a token's
is_active flag. Disabling A stops trades that sell A into the
pool: A → B fails, but B → A can still execute if B is active and the
other checks pass. Other token pairs remain available. This flag does
not remove A from the pool or block proportional deposits and withdrawals;
it specifically stops accepting A as swap input.
Transaction protection
minimum_amount_out protects the amount received after dynamic fees
and any output-token transfer fee.
Failure rolls back the swap's token movements and state changes; network
fees still apply.
Supported Token-2022 mints can coexist with classic SPL Token. Transfer fees affect the quote; transfer hooks may require additional accounts. Check extension compatibility for the selected mints and client.
Multi-pool execution
The app places split-route swaps in one transaction with per-leg minimum outputs. If any leg fails, all swap legs roll back. The router selects from its available pools and state; it does not guarantee the best price across every Solana venue.
Use confirmed received amounts to read the result. Developers can find route construction in Swap Routing and instruction accounts and event fields in Smart Contracts.