BTB
/

Meteora DLMM

Dexswebsite
Meteora DLMM (lb_clmm) is a bin-based concentrated liquidity AMM on Solana with dynamic fees. An agent can swap through a pool, and open, change, claim from and close positions made of price bins.

What you can do

swapSwap through a DLMM poolQuote with the DLMM SDK, then send swap2(amount_in, min_amount_out) with the bin arrays for the price path. Use min_amount_out from the quote minus slippage.
open-positionOpen a position and add liquidity in a bin rangeinitialize_position2(lower_bin_id, width) to create the position, then add_liquidity_by_strategy2 with a strategy and the amounts for X and Y.
close-positionRemove liquidity and close a DLMM positionremove_liquidity_by_range2 (bps_to_remove 10000) over the position's bin range, claim_fee2 and claim_reward2 if needed, then close_position2.
claim-feesClaim swap fees from a positionclaim_fee2(min_bin_id, max_bin_id) for the position's bin range.
Liquidity sits in bins. A position only earns fees on bins the price has crossed, and an out-of-range position holds one token.
Dynamic fees rise when volatility rises, so the fee paid on a swap can be higher than the base fee.
Pools can be created permissionlessly for any token pair. Check mints and pool liquidity before providing liquidity.
Program upgrades and the operator roles can change pool parameters, fee settings and reward funding.

Contracts

Read any function, or build a write and sign it. Amounts are in base units (1 USDC = 1000000).
lb_clmm program (DLMM)exchange on solanaLBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo
write swap2
Exact-in swap through a DLMM pool. Arguments: amount_in (base units of the input token), min_amount_out (slippage guard), and remaining accounts info for bin arrays. Pass user input and output token accounts, the reserves, the oracle and the host fee account. Pass the bin arrays for the price path.
write swap_exact_out2
Exact-out swap: specify the output amount and the most input you accept, with remaining accounts info. Build the accounts with the SDK.
write initialize_position2
Create an empty position on a pool. Arguments: lower_bin_id (signed 32-bit) and width (number of bins, up to the program limit). Add liquidity afterwards.
write add_liquidity_by_strategy2
Add liquidity across bins with a strategy (spot, curve or bid-ask shapes) on an existing position. Arguments: a liquidity parameter struct (amounts for X and Y, active bin id, and the strategy) and remaining accounts info for bin arrays.
write remove_liquidity_by_range2
Remove a share of liquidity between two bin ids. Arguments: from_bin_id, to_bin_id (signed 32-bit), bps_to_remove (basis points of the liquidity in that range, 10000 for all), remaining accounts info.
write remove_liquidity2
Remove liquidity from chosen bins with a per-bin removal struct and remaining accounts info. Use it when you need exact bin control. remove_liquidity_by_range2 is simpler.
write claim_fee2
Claim the swap fees a position has earned between min_bin_id and max_bin_id (signed 32-bit). Fees go to the owner's token accounts.
write claim_reward2
Claim one reward's emissions for a position. Arguments: reward_index (u64), min_bin_id, max_bin_id, remaining accounts info. Only for pools that have rewards funded.
write close_position2
Close an empty position and return the rent to rent_receiver. Remove all liquidity and claim fees and rewards first.
write update_fees_and_reward2
Refresh a position's fee and reward accounting before reading or claiming, without moving tokens.