Skip to main content

createMarketAccrueEmissionInstruction

Builds a raw instruction to accrue farm emissions for a liquidity provider position. This updates the internal accounting for all active farm emissions that the position is entitled to, based on the LP’s share of liquidity and time elapsed since the last accrual.
This instruction must be called before collecting emissions to ensure all pending rewards are calculated.

Usage

Accounts

Args

This instruction takes no arguments.

Behavior

The instruction:
  1. Fetches the current state of all active farm emissions in the market
  2. Calculates time-weighted emissions accrued since last update
  3. Updates the LP position’s internal trackers for each emission token
  4. Stages the accrued tokens for collection
The accrued amounts depend on:
  • LP position’s share of liquidity in the active tick range
  • Time elapsed since last accrual
  • Emission rates for each active farm
  • Current tick position relative to LP position bounds

Returns

Returns a MarketAccrueEmissionEvent containing:
TransactionInstruction — a transaction instruction ready to be added to a transaction.