Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.meteora.ag/llms.txt

Use this file to discover all available pages before exploring further.

This page summarizes the constraints that matter when configuring or integrating Stake2Earn.

Vault Requirements

RequirementSource Behavior
Pool typeThe pool must be a DAMM v1 ConstantProduct pool.
Stake mintMust be one side of the pool and must not be wrapped SOL or USDC.
Quote mintMust be one side of the pool and must be wrapped SOL or USDC.
Lock escrowMust belong to the pool and have the Stake2Earn vault PDA as owner.
Vault PDADerived from the program vault seed and the DAMM v1 pool address.
Token vaultsAssociated token accounts for the vault PDA, one for the stake mint and one for the quote mint.
Supported production quote mints:
AssetMint
Wrapped SOLSo11111111111111111111111111111111111111112
USDCEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
The program validates the lock escrow owner and pool relationship. It does not make Stake2Earn a generic staking product for unrelated tokens or pool types.

Initialization Parameters

ParameterProduction RangeNotes
top_list_length5 to 1,000Number of stakers eligible for newly released fees.
seconds_to_full_unlock6 hours to 31 daysDuration used to drip collected fees.
unstake_lock_duration6 hours to 31 daysCooldown applied to newly requested unstakes.
start_fee_distribute_timestampCurrent time to 31 days in the futureOptional. If omitted, current time is used. Past timestamps are invalid.
The start timestamp creates a join window before rewards begin releasing. During this window, claimed fees can accumulate as locked fees, but released amount is zero until current_time > start_fee_distribute_timestamp.

Account and List Limits

Account or ListProduction LimitPurpose
Top-staker list1,000 stakersHolds the current eligible reward set.
Full-balance list10,000 stakersTracks candidate balances for top-list promotion.
Stake escrowOne per vault-owner pairStores active stake, pending fees, checkpoints, and unstake accounting.
Unstake accountOne per requestStores amount and release time, then closes on cancel or withdraw.
When a stake escrow is created, the program attempts to add it to the full-balance list while there is capacity. After the full-balance list reaches its hard limit, a staker outside the list can reclaim the smallest listed index only if their active stake is larger and the transaction supplies the required smallest stake escrow account.

Instruction Behavior

Stake2Earn does not update continuously by itself. State changes happen when instructions are sent.
InstructionWho Can CallMain Behavior
initialize_vaultCreator or payerCreates the vault, token vaults, top-staker list, and full-balance list for a supported DAMM v1 pool and lock escrow.
initialize_stake_escrowPayer for an ownerCreates one stake escrow for a vault-owner pair and grows list accounts as needed.
stakeStake escrow ownerAttempts to claim and drip fees, updates the user’s pending rewards if eligible, transfers stake tokens into the vault, and syncs list state.
claim_feeStake escrow ownerAttempts to claim and drip fees, updates pending rewards, transfers quote rewards up to max_fee, restakes the stake-mint side, and syncs list state.
request_unstakeStake escrow ownerAttempts to claim and drip fees, updates pending rewards, removes active stake into a new unstake account, and syncs list state.
cancel_unstakeStake escrow ownerAttempts to claim and drip fees, closes the unstake account, returns the amount to active stake, and syncs list state.
withdrawStake escrow ownerAfter the release time, transfers the unstaked amount back to the user and closes the unstake account.
claim_fee_crankPermissionlessAttempts to claim and drip fees for the vault without updating a specific user’s stake escrow.

Ranking Rules

Stake2Earn ranks stakers by active stake_amount.
SituationResult
Larger active stakeRanks higher.
Equal active stakeEarlier full-balance-list index ranks higher.
Entering top listFee checkpoints reset to current cumulative values.
Leaving top listPending rewards are updated before the user is marked out.
Requesting unstakeActive stake decreases immediately and the leaderboard can update in the same instruction.
Claiming base rewardsBase-token rewards are restaked and can improve rank.

Fee Collection Rules

Stake2Earn can collect fees from the connected DAMM v1 lock escrow when fee accounting runs.
RuleProduction Behavior
First claimAllowed when both token sides have pending claimable fees.
Subsequent claimsRequire at least 5 minutes since the previous lock-escrow claim.
Zero pending sideIf either pending token fee is zero, the lock-escrow claim is skipped.
Dripping without new claimExisting locked fees can still drip even when no new lock-escrow fee is claimed.
No effective stakeLocked fees are preserved for future stakers and last_updated_at is moved forward.
Fee updates are triggered by user actions and by the permissionless claim_fee_crank instruction. Interfaces should not assume fee accounting updates continuously without transactions.

Claim Rules

RuleBehavior
Quote sideTransferred to the user’s quote token account, capped by max_fee.
Stake sideClaimed in full and added to active stake.
Partial quote claimAny unclaimed quote reward remains pending.
Checkpoint updatePending rewards are updated before claim logic runs when the user is in the top list.
Because the stake side is restaked, claiming can change top-staker ordering.

Unstake Rules

ActionBehavior
Request unstakeRequires enough active stake. Removes the amount from active stake immediately and creates an Unstake account.
Cancel unstakeCloses the Unstake account and returns the amount to active stake.
WithdrawAllowed only after the recorded release time. Transfers stake tokens back to the user and closes the Unstake account.
Updating unstake_lock_duration does not rewrite existing unstake accounts. Existing records keep the release time calculated when they were created.

Admin-Controlled Updates

Approved admin keys can update these values:
SettingConstraint
unstake_lock_durationMust remain between 6 hours and 31 days and must differ from the old value.
seconds_to_full_unlockMust remain between 6 hours and 31 days, must differ from the old value, and must be preceded by a valid claim_fee_crank for the same vault in the same transaction.
The program has a private-build access check for vault and stake-escrow initialization, gated by an access mint. That check is behind the private feature flag and is not part of the default public program path.

Interface Checklist

A useful Stake2Earn interface should show:
  • vault pool, stake mint, quote mint, and lock escrow;
  • configured top-staker count and the user’s current top-list status;
  • active stake, total active stake, and effective top-list stake;
  • the minimum visible stake needed to enter or remain in the top list;
  • locked fees, released-fee history, and last fee-claim time where available;
  • pending quote rewards and the max_fee value used for claims;
  • base-token rewards that will be restaked on claim;
  • requested unstake amounts, release times, and cancel or withdraw availability;
  • clear messaging that only top stakers earn newly released fees.
Avoid promising fixed APY or guaranteed rewards. Rewards depend on trading volume, lock-escrow fee availability, fee claim timing, drip timing, leaderboard position, active stake, and integer rounding.