Trade and liquidity
Instructions for swapping and providing two-sided liquidity.
Updated Nov 3, 2026
Swaps execute on the ordinary liquidity tranche; liquidity instructions mint and burn srLP against the live reserve less unpaid interest, which stays with the holders who earned it. The previews return typed data for simulation and emit no accounting events. See Trade, Two-sided liquidity and The curve and fees.
swap
Exchange an exact amount of one market asset for the other along the live curve.
Pays the base fee plus any divergence, volatility and launch surcharges, capped together at half the fee basis. When either hLP vault has supply or residual exposure the transaction must carry the five reconciliation accounts; the SDK swap builders prepend them.
- Caller
- Any trader
- In the app
- Trade
- Discriminator
f8c69e91e17587c8
Arguments
args: SwapArgs
| Field | Type | Notes |
|---|---|---|
| exact_asset_in | u64 | Input amount in raw atoms, before any input token transfer fee. |
| min_asset_out | u64 | Minimum output after fees; the instruction fails below it. |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| market | writable | PDA ["market_v2", market.base_side.asset_mint, market.quote_side.asset_mint, market.params_hash] | |
| futarchy_authority | PDA ["futarchy_authority"] | ||
| trader | writable · signer | ||
| asset_in_mint | |||
| asset_out_mint | |||
| reserve_in_vault | writable | ||
| reserve_out_vault | writable | ||
| trader_asset_in_account | writable | ||
| trader_asset_out_account | writable | ||
| instructions_sysvar | Sysvar1n…1111 | during the configured launch rate-limit window. | |
| token_program | Tokenkeg…Q5DA | ||
| token_2022_program | TokenzQd…xuEb | ||
| event_authority | PDA ["__event_authority"] | ||
| program |
preview_swap
Read-only: quote a swap exactly as swap would execute it, returning output, fee components and the price after.
Simulate it and decode the return data with the SDK's previewSwap; nothing is persisted and no accounting event is emitted.
- Caller
- Any client, by simulation
- Discriminator
624ac573879abc46
Arguments
args: PreviewSwapArgs
| Field | Type | Notes |
|---|---|---|
| exact_asset_in | u64 |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| market | PDA ["market_v2", market.base_side.asset_mint, market.quote_side.asset_mint, market.params_hash] | ||
| futarchy_authority | PDA ["futarchy_authority"] | ||
| asset_in_mint | |||
| asset_out_mint |
add_liquidity
Deposit both assets at the current live-reserve ratio and mint srLP.
The first deposit in a market permanently locks a minimum amount of liquidity. Published yield is checkpointed before the eligible balance changes.
- Caller
- Any liquidity provider
- In the app
- Market page · Add liquidity
- Discriminator
b59d59438fb63448- Emits
- LiquidityAdded
Arguments
args: AddLiquidityArgs
| Field | Type | Notes |
|---|---|---|
| base_deposit_amount | u64 | Base atoms to deposit. |
| quote_deposit_amount | u64 | Quote atoms to deposit; the smaller ratio wins. |
| min_srlp_amount | u64 | Minimum srLP to receive. |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| market | writable | ||
| futarchy_authority | PDA ["futarchy_authority"] | ||
| owner | writable · signer | ||
| base_mint | |||
| quote_mint | |||
| srlp_mint | writable | ||
| base_reserve_vault | writable | ||
| quote_reserve_vault | writable | ||
| owner_base_account | writable | ||
| owner_quote_account | writable | ||
| owner_srlp_account | writable | ||
| base_yield_account | writable | any liquidity mutation. | |
| quote_yield_account | writable | any liquidity mutation. | |
| token_program | Tokenkeg…Q5DA | ||
| token_2022_program | TokenzQd…xuEb | ||
| system_program | 11111111…1111 | ||
| event_authority | PDA ["__event_authority"] | ||
| program |
remove_liquidity
Burn srLP for its proportional share of both sides at the live basis.
Must pass the cash, market-health and slippage checks; only cash can leave the vault. There is no withdrawal fee.
- Caller
- The srLP holder
- In the app
- Market page · Withdraw
- Discriminator
5055d14818ceb16c- Emits
- LiquidityRemoved
Arguments
args: RemoveLiquidityArgs
| Field | Type | Notes |
|---|---|---|
| srlp_amount | u64 | srLP to burn. |
| min_base_amount_out | u64 | Slippage bound on the base side. |
| min_quote_amount_out | u64 | Slippage bound on the quote side. |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| market | writable | ||
| futarchy_authority | PDA ["futarchy_authority"] | ||
| owner | writable · signer | ||
| base_mint | |||
| quote_mint | |||
| srlp_mint | writable | ||
| base_reserve_vault | writable | ||
| quote_reserve_vault | writable | ||
| owner_base_account | writable | ||
| owner_quote_account | writable | ||
| owner_srlp_account | writable | ||
| base_yield_account | writable | ||
| quote_yield_account | writable | ||
| token_program | Tokenkeg…Q5DA | ||
| token_2022_program | TokenzQd…xuEb | ||
| event_authority | PDA ["__event_authority"] | ||
| program |
preview_add_liquidity
Read-only: the srLP a deposit would mint and the exact amounts it would take.
- Caller
- Any client, by simulation
- Discriminator
6d6e33e1113af3ff
Arguments
args: PreviewAddLiquidityArgs
| Field | Type | Notes |
|---|---|---|
| base_deposit_amount | u64 | |
| quote_deposit_amount | u64 |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| market | writable | PDA ["market_v2", market.base_side.asset_mint, market.quote_side.asset_mint, market.params_hash] | |
| base_mint | |||
| quote_mint |
open_liquidity_gates
Lift a market's launch liquidity gate by making the qualifying initial deposit.
Takes the same arguments as add_liquidity. Used by the initial liquidity authority during a gated launch.
- Caller
- The initial liquidity authority
- Discriminator
54536e2db904bade- Emits
- LiquidityAdded
Arguments
args: AddLiquidityArgs
| Field | Type | Notes |
|---|---|---|
| base_deposit_amount | u64 | |
| quote_deposit_amount | u64 | |
| min_srlp_amount | u64 |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| market | writable | ||
| futarchy_authority | PDA ["futarchy_authority"] | ||
| owner | writable · signer | ||
| base_mint | |||
| quote_mint | |||
| srlp_mint | writable | ||
| base_reserve_vault | writable | ||
| quote_reserve_vault | writable | ||
| owner_base_account | writable | ||
| owner_quote_account | writable | ||
| owner_srlp_account | writable | ||
| base_yield_account | writable | any liquidity mutation. | |
| quote_yield_account | writable | any liquidity mutation. | |
| token_program | Tokenkeg…Q5DA | ||
| token_2022_program | TokenzQd…xuEb | ||
| system_program | 11111111…1111 | ||
| event_authority | PDA ["__event_authority"] | ||
| program |
preview_market
Read-only: the market with lazy interest accrued, spot and EMA prices, utilization, rates and hLP vault state.
The SDK's previewMarket decodes it. Because a fetched Market account is the state at its last checkpoint, this is the read to use for live numbers.
- Caller
- Any client, by simulation
- Discriminator
3ce7af111cdd2aec
Arguments
None.
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| market | writable | PDA ["market_v2", market.base_side.asset_mint, market.quote_side.asset_mint, market.params_hash] |