Skip to main content
The YieldTokenPosition account tracks a user’s deposited YT balance and accrued yield (interest and emissions) for a specific vault. Each user has one yield position per vault, derived as a PDA.

YieldTokenPosition

YieldTokenTracker

Generic tracker used for both interest and emission yield accrual.

Fields

YieldTokenPosition

YieldTokenTracker

How Yield Accrual Works

  1. Deposit YT — User deposits YT into the position. The yt_balance increases and the tracker’s last_seen_index is set to the vault’s current rate.
  2. Stage Yield — When stageYtYield is called, the position calculates earned interest since the last staging:
    • Interest earned = change in exchange rate applied to the YT balance (converted to SY equivalent)
    • Emission rewards = change in emission indexes applied to the total SY balance
    • Earned amounts are added to the staged field of each tracker
  3. Collect — The staged amount can be withdrawn via collectInterest or collectEmission. The staged field is decremented by the collected amount.

Interest Calculation

Interest is computed based on the vault’s final_sy_exchange_rate (which freezes at maturity). If the current rate exceeds the final rate (post-maturity), earned SY is scaled down proportionally: