Skip to main content
Three programs, three schemas. Farm v3, v5, and v6 are separate programs with separate state layouts. This page documents each side by side. In practice most new integrations target v6; v3 and v5 are read-only for most integrators (staking already happened there long ago and the pools are in wind-down).

Account inventory (per farm, any version)

The SDK returns the full set on raydium.farm.getFarmById. For arbitrary third-party farms, the API endpoint GET https://api-v3.raydium.io/main/farms/info?ids=<FARM_ID> also returns them.

FarmState layout — v6

v6 is the current version. Its account structure is the most general.
Integrator-facing fields:
  • staking_mint, staking_vault — what gets staked and where it sits.
  • total_staked — current total. Required to compute APR: reward_per_second × 86400 / total_staked.
  • reward_infos[i].emission_per_second_x64 — the Q64.64 rate. Divide by 2^64 for the true per-second token count.
  • reward_infos[i].open_time / end_time — for UI “X days left” displays.
  • reward_infos[i].reward_per_share_x64 — the counter the UserLedger debts off.

FarmState layout — v5

Differences from v6:
  • Per-slot, not per-second. v5’s update loop runs on slots rather than on the wall clock. The SDK normalizes this into “per-second” for the UI but on-chain the unit is slots.
  • Integer emission rate. reward_per_second is u64. This caps the minimum expressible rate at 1 unit per second, which is too coarse for low-emission streams on 9-decimal mints. v6 fixed this with the Q64.64 rate.
  • No reward_sender. On v5 the owner is the implicit sender; only owner can top up.

FarmState layout — v3

Single-reward. Slot-based. The oldest program generation, kept alive for the RAY-USDC and SOL-USDC farms that predate v5.

UserLedger (v6) / UserStake (v5/v3)

Per-user state, one account per (farm, user) pair. Seeded PDA:
(Seed strings are the values actually used by the SDK; program versions have historically varied them. Verify against the v6 source for anything security-critical.)
The per-stream debt is the accounting offset described in the overview:
After each Deposit, Withdraw, or Harvest, the debt is reset to the current deposited × reward_per_share_x64[i] / 2^64.

Authority PDAs

All three versions derive the farm authority per-farm with a single seed. This PDA is the authority on the staking vault and on each reward vault. It signs every transfer the farm makes.

Vaults

Staking and reward vaults are standard SPL Token accounts whose owner is the farm authority PDA. Addresses are stored on FarmState — do not re-derive; read from state. Freeze authorities must be disabled on the staking mint for v5/v6 (the program checks). Token-2022 notes:
  • v3: SPL Token only.
  • v5: SPL Token only.
  • v6: Supports Token-2022 on both staking and reward mints, gated on staking_token_program / reward_token_program fields. Transfer fees on Token-2022 reward mints are charged on emit (vault → user).

Observation and APR

Farms do not store APR on-chain. To compute:
Consumers typically pull staking_mint_usd_price from the pool the LP belongs to (via api-v3.raydium.io/pools/info/ids) and reward_usd_price from any price oracle.

Where to go next

Sources: