On-Chain Program Reference
The Orbit Finance DLMM program is built with Anchor and deployed on Solana mainnet.
Program ID: Fn3fA3fjsmpULNL7E9U79jKTe1KHxPtQeWdURCbJXCnMInstructions
Pool Lifecycle
| Instruction | Description | Signer |
|---|---|---|
init_pool | Create a new DLMM pool with token pair, bin step, and fee config | Admin |
create_bin_array | Create a BinArray account for a 64-bin range (lazy creation) | Payer |
update_admin | Transfer pool admin to a new wallet | Admin |
update_authorities | Update config_authority, pause_guardian, fee_withdraw_authority | Admin |
update_fee_config | Modify fee parameters (only before first swap) | Config Authority |
Liquidity
| Instruction | Description | Signer |
|---|---|---|
init_position | Create a Position PDA for the user | Owner |
add_liquidity_batch | Deposit liquidity across up to 32 bins | Owner |
remove_liquidity | Withdraw from specific bins in a position | Owner |
close_position | Close an empty position (reclaim rent) | Owner |
verify_accounting | Verify vault balances match bin totals | Anyone |
Swapping
| Instruction | Description | Signer |
|---|---|---|
swap | Execute a swap through the pool’s bins | User |
Swap data:
amount_in(u64) — input token amountmin_amount_out(u64) — slippage protectionswap_for_base(bool) — direction (true = buy base, false = sell base)
Rewards
| Instruction | Description | Signer |
|---|---|---|
init_holder_global_state | Initialize global reward tracker for a pool | Admin |
init_nft_global_state | Initialize NFT reward tracker | Admin |
init_user_holder_state | Initialize user reward account (required before first claim) | User |
init_user_nft_state | Initialize user NFT reward account | User |
sync_reward_indexes | Update global reward accumulators from fee vaults | Anyone |
sync_holder_stake | Record staking checkpoint (integrates with Streamflow) | User |
claim_holder_rewards | Claim accumulated USDC rewards | User |
claim_nft_rewards | Claim NFT-weighted USDC rewards | User |
claim_protocol_fees | Withdraw protocol fee share | Fee Withdraw Authority |
Admin
| Instruction | Description | Signer |
|---|---|---|
pause | Pause specific operations (swap, deposit, withdraw) | Pause Guardian |
unpause | Resume operations | Pause Guardian |
unpause_override | Emergency unpause | Squads Multisig |
force_reset_authorities | One-time emergency authority reset | Squads Multisig |
Account Types
Pool
The main pool state account. Contains:
- Token pair mints and vaults
- Fee configuration and vaults
- Active bin ID and price (Q64.64)
- Admin and authority pubkeys
- Pause state
BinArray
Holds 64 consecutive bins. Each bin tracks:
- Base and quote reserves
- Total LP shares
- Accrued fee counters
BinArrays are created lazily — they only exist when someone deposits into that range.
Position
Represents a user’s LP stake in a pool. Identified by pool + owner + nonce.
PositionBin
Links a position to a specific bin. Tracks:
- Share count (user’s proportion of the bin)
- Entry reserves (for IL calculation)
HolderGlobalState / NftGlobalState
Global reward index trackers. Accumulate fee-per-share values.
UserHolderState / UserNftState
Per-user reward tracking. Stores last-claimed index for proportional reward calculation.
PDA Seeds
| Account | Seeds |
|---|---|
| Pool | ["pool", base_mint, quote_mint, bin_step_bps_u16_le, base_fee_bps_u16_le] |
| BinArray | ["bin_array", pool, lower_bin_index_i32_le] |
| Position | ["position", pool, owner, nonce_u64_le] |
| PositionBin | ["position_bin", position, bin_index_i32_le] |
| LiquidityLock | ["lock", user, pool] |
Error Codes
| Code | Name | Description |
|---|---|---|
| 6000 | InvalidLiquidity | Provided liquidity value is invalid |
| 6001 | CalculationError | Arithmetic overflow/underflow |
| 6002 | InvalidInput | Invalid input data |
| 6006 | SlippageExceeded | Swap didn’t meet minimum output |
| 6007 | InsufficientLiquidity | Pool lacks liquidity |
| 6014 | PoolPaused | Pool is paused |
| 6037 | DuplicateBinIndex | Duplicate bin in deposit |
| 6038 | ActiveBinDepositForbidden | Can’t deposit into active bin |
| 6046 | AccountingInvariantViolation | Vault/bin mismatch |
| 6059 | PositionHasLiquidity | Can’t close position with active liquidity |
| 6060 | ExcessiveFee | Fee rate exceeds 10% maximum |
Full list: 64 error codes. See the SDK error mapping for all codes.
IDL
The Anchor IDL is bundled with the orbit-dlmm SDK. You can also find it at:
packages/dlmm/src/idl/orbit_finance.jsonUse it with Anchor to deserialize accounts and build instructions:
import { Program } from "@coral-xyz/anchor";
import idl from "orbit-dlmm/idl/orbit_finance.json";
const program = new Program(idl, provider);
const pool = await program.account.pool.fetch(poolAddress);Last updated on