Skip to Content
DevelopersOn-Chain Program Reference

On-Chain Program Reference

The Orbit Finance DLMM program is built with Anchor and deployed on Solana mainnet.

Program ID: Fn3fA3fjsmpULNL7E9U79jKTe1KHxPtQeWdURCbJXCnM

Instructions

Pool Lifecycle

InstructionDescriptionSigner
init_poolCreate a new DLMM pool with token pair, bin step, and fee configAdmin
create_bin_arrayCreate a BinArray account for a 64-bin range (lazy creation)Payer
update_adminTransfer pool admin to a new walletAdmin
update_authoritiesUpdate config_authority, pause_guardian, fee_withdraw_authorityAdmin
update_fee_configModify fee parameters (only before first swap)Config Authority

Liquidity

InstructionDescriptionSigner
init_positionCreate a Position PDA for the userOwner
add_liquidity_batchDeposit liquidity across up to 32 binsOwner
remove_liquidityWithdraw from specific bins in a positionOwner
close_positionClose an empty position (reclaim rent)Owner
verify_accountingVerify vault balances match bin totalsAnyone

Swapping

InstructionDescriptionSigner
swapExecute a swap through the pool’s binsUser

Swap data:

  • amount_in (u64) — input token amount
  • min_amount_out (u64) — slippage protection
  • swap_for_base (bool) — direction (true = buy base, false = sell base)

Rewards

InstructionDescriptionSigner
init_holder_global_stateInitialize global reward tracker for a poolAdmin
init_nft_global_stateInitialize NFT reward trackerAdmin
init_user_holder_stateInitialize user reward account (required before first claim)User
init_user_nft_stateInitialize user NFT reward accountUser
sync_reward_indexesUpdate global reward accumulators from fee vaultsAnyone
sync_holder_stakeRecord staking checkpoint (integrates with Streamflow)User
claim_holder_rewardsClaim accumulated USDC rewardsUser
claim_nft_rewardsClaim NFT-weighted USDC rewardsUser
claim_protocol_feesWithdraw protocol fee shareFee Withdraw Authority

Admin

InstructionDescriptionSigner
pausePause specific operations (swap, deposit, withdraw)Pause Guardian
unpauseResume operationsPause Guardian
unpause_overrideEmergency unpauseSquads Multisig
force_reset_authoritiesOne-time emergency authority resetSquads 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

AccountSeeds
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

CodeNameDescription
6000InvalidLiquidityProvided liquidity value is invalid
6001CalculationErrorArithmetic overflow/underflow
6002InvalidInputInvalid input data
6006SlippageExceededSwap didn’t meet minimum output
6007InsufficientLiquidityPool lacks liquidity
6014PoolPausedPool is paused
6037DuplicateBinIndexDuplicate bin in deposit
6038ActiveBinDepositForbiddenCan’t deposit into active bin
6046AccountingInvariantViolationVault/bin mismatch
6059PositionHasLiquidityCan’t close position with active liquidity
6060ExcessiveFeeFee 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.json

Use 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