BTB Finance for agents

Protocols / DEX

Raydium AMM

Raydium's original AMM (v4) on Solana, the constant-product pools that Raydium runs with the OpenBook order book. An agent can swap through a pool, add liquidity, and remove liquidity. Raydium's REST API lists pools, mints and prices.

On-chain + APISOLANA1 contractsWebsite · Docs

get_protocol({ "protocol": "raydium-amm" })

Risks an agent should know

What an agent can do

swapSwap one token for another in a Raydium AMM v4 pool
GET the pool from /pools/info/mint (or /pools/info/ids), build SwapBaseInV2(amount_in, minimum_amount_out) with the pool's accounts (amm, vaults, authority, user token accounts), sign and send. Compute minimum_amount_out from the pool reserves and your slippage.
add-liquidityDeposit two tokens into a pool and receive LP tokens
Deposit(max_coin_amount, max_pc_amount, base_side, other_amount_min) at the current ratio; check the pool's LP mint and ratio first
remove-liquidityBurn LP tokens for the two underlying tokens
Withdraw(amount, min_coin_amount, min_pc_amount)
create-poolCreate a new AMM v4 pool for a market
Initialize2 with the market id and the starting amounts. The pool needs an existing OpenBook market and a pool creation fee.

Contracts

solana

ContractAddressKey functionsTry
Raydium AMM v4 program
exchange
675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8
source
writeSwapBaseInV2(amount_in: u64, minimum_amount_out: u64)
writeSwapBaseOutV2(max_amount_in: u64, amount_out: u64)
writeSwapBaseIn(amount_in: u64, minimum_amount_out: u64)
writeSwapBaseOut(max_amount_in: u64, amount_out: u64)
writeDeposit(max_coin_amount: u64, max_pc_amount: u64, base_side: u64, other_amount_min: Option<u64>)
writeWithdraw(amount: u64, min_coin_amount: Option<u64>, min_pc_amount: Option<u64>)
writeInitialize2(nonce: u8, open_time: u64, init_pc_amount: u64, init_coin_amount: u64)
writeSetParams(param: u8, value: Option<u64>, fees: Option<Fees>)
+2 more via get_protocol

APIs

Raydium API V3: main info
auth: none
https://api-v3.raydium.io/main/info
GET main statistics for the Raydium venues.
Raydium API V3: pools by id
auth: none
https://api-v3.raydium.io/pools/info/ids
GET pool info (mints, vaults, LP mint, fees, price, TVL) for one or more pool ids. Cached about 60 seconds. Use it to resolve the pool before building a swap or liquidity transaction.
Raydium API V3: pools by mint
auth: none
https://api-v3.raydium.io/pools/info/mint
GET pools that contain a mint, or a mint pair. pageSize is capped at 1000. Use it to find the pool for a token pair.
Raydium API V3: list pools (cursor paging)
auth: none
https://api-v3.raydium.io/pools/info/list-v2
GET a paged list of pools with nextPageId cursor. size is capped at 1000.
Raydium API V3: token prices
auth: none
https://api-v3.raydium.io/mint/price
GET the price for one or more mints.

Notes

Mainnet program id 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 is listed on the official raydium-amm README under Program Deployments (devnet id DRaya7Kj3aMWQSy19kSjvmuwq9docCHofyP9kanQGaav is left out). Instruction names come from the AmmInstruction enum in program/src/instruction.rs of the official repository. Individual pool, market and authority addresses are not included; get them from the API. Raydium's Swap transaction API and other products are not covered here.

Sources

Researched 2026-11-28. Addresses are copied from the official sources above; check them before moving large amounts.