Program
0.1.2 is in stake-for-fee #41. @meteora-ag/m3m3@2.0.0, stake_for_fee_interface@0.2.0, and common@0.0.2 are in stake-for-fee-sdk #36. Both pull requests are open. npm still publishes @meteora-ag/m3m3@1.0.10.Release summary
The published TypeScript package is
@meteora-ag/m3m3. The SDK changelog heading records this release as @meteora-ag/stake-for-fee 2.0.0.What We Shipped
- Deprecated new Stake2Earn vaults, new stakes, partial claims, and unstake requests
- Added a full exit: claim both token fees, then withdraw the whole stake with no unstake request and no lock
- Release locked fees to top stakers immediately, and claim the lock escrow fee only once
- Added permissionless closes for an empty stake escrow, a zero-amount unstake request, and an empty vault
What To Do
| Integrators | What Changed | What To Do |
|---|---|---|
| Partners |
|
|
Program: stake-for-fee 0.1.2
Program ID (mainnet and devnet): FEESngU3neckdwib9X3KWqdL7Mjmqk9XNp3uh5JbP4KPProgram PR #41Added
- New instruction
claim_fee_and_withdraw_full. Stakers claim all pending fees of both tokens, then withdraw their whole stake amount directly from the stake escrow, without an unstake request and lock duration. The stake token fee is transferred to the user instead of being restaked. A stake escrow without stake amount can still claim its pending fees. The top list and full balance list are synced the same way asrequest_unstake. EmitsClaimFeeSucceed, andWithdrawStakeSucceedonly when a stake amount is withdrawn. - New event
WithdrawStakeSucceed. - New errors
Deprecated(6023) andNothingToExit(6024).claim_fee_and_withdraw_fullfails withNothingToExitwhen the stake escrow has no stake amount and no pending fees. - Legacy IDL instructions with
#[program(legacy_idl)]. The existing on-chain IDL account can still be updated with the legacy IDL instructions instead of the Program Metadata Program. - New field
final_fee_claimedinFeeVault, taken frompadding_0. It is set to 1 by the first claim, even when nothing is locked in the lock escrow. - New instruction
close_zero_unstake. The owner closes an unstake request with zerounstake_amountand gets the rent back, even after the stake escrow is closed. Requests created before 0.1.1 have noownerand cannot be closed this way. - New event
CloseZeroUnstake. - New error
UnstakeAmountNotZero(6025). - New permissionless instruction
close_stake_escrow. Closes a stake escrow without stake amount, pending fees, and ongoing unstake amount, and returns the rent to the owner. - New permissionless instruction
close_vault. Once all stake escrows are closed and the vault has no stake amount, ongoing unstake amount, or effective stake amount, closes the vault, the top staker list, and the full balance list, and returns the rent to the creator. The token vaults are not closed, so the locked fees stay permanently locked. - New events
StakeEscrowClosedandVaultClosed. New errorsStakeEscrowNotEmpty(6026) andVaultNotEmpty(6027).
Changed
- Upgrade to Anchor 1.2.1. The dynamic AMM and dynamic vault programs are declared with
declare_program!from the IDLs inidls/. The program is built for SBPF v3 (Anchor 1.2.1 default). - Sync
idls/dynamic_amm.jsonandidls/dynamic_vault.jsonwith upstream dynamic AMM 0.5.7 and dynamic vault 0.9.5. The only local change ismetadata.name, renamed fromammandvaulttodynamic_ammanddynamic_vault. The account layouts and theclaim_feeinterface used by stake-for-fee are unchanged. withdrawno longer waits for the unstake lock duration. Existing unstake requests can be withdrawn immediately.- Lock escrow fee is claimed only once, by the first
claim_fee_crankorclaim_fee_and_withdraw_fullafter the upgrade, even when the pending fee is zero. When nothing is locked in the lock escrow, the claim fee CPI is skipped but the final claim is still marked as done. Later calls skip the claim fee CPI. The minimum claim interval (MIN_LOCK_ESCROW_CLAIM_FEE_DURATION) is removed. - Claimed fees are no longer locked. All locked fees are distributed to the top stakers immediately, instead of dripping over
seconds_to_full_unlock, which is no longer used. Fees stay locked only beforestart_fee_distribute_timestampor while the top stakers have no stake amount. metrics.total_stake_escrow_countis decreased byclose_stake_escrow, so it is the number of open stake escrows.
Deprecated
initialize_vault,initialize_stake_escrow,stake,claim_fee,request_unstake,cancel_unstake,update_seconds_to_full_unlock, andupdate_unstake_lock_durationalways fail withDeprecated. Their accounts and instruction data are unchanged. Pending fees are claimed withclaim_fee_and_withdraw_full.withdraw,claim_fee_and_withdraw_full, andclaim_fee_crankkeep working.
TypeScript SDK: @meteora-ag/m3m3 2.0.0
SDK PR #36Sync with stake-for-fee program 0.1.2.Added
claimFeeAndWithdrawFull. Claims all pending fees of both tokens, then withdraws the whole stake amount directly from the stake escrow, without an unstake request. The stake token fee is transferred to the owner stake token ATA (created when missing) instead of being restaked, and the quote token fee to the owner quote token ATA (created when missing, unwrapped when it is SOL). A stake escrow without stake amount can still claim its pending fees. Existing unstake requests are not affected. Complete them withwithdraw.closeStakeEscrow. Permissionless. Closes a stake escrow without stake amount, pending fees, and ongoing unstake amount, and returns the rent to the owner. Unstake requests with zero amount do not block the close.closeVault. Permissionless. Once all stake escrows are closed and the vault has no stake amount, ongoing unstake amount, or effective stake amount, closes the fee vault, the top staker list, and the full balance list, and returns the rent to the vault creator. The token vaults are not closed, so the locked fees stay permanently locked.StakeForFee.closeZeroUnstake. The owner closes an unstake request with zero amount and gets the rent back, also after the stake escrow and the fee vault are closed. Requests created before program 0.1.1 have no owner and cannot be closed this way.getPoolLpSupplyhelper. LP supply tracked by the dynamic AMM pool (pool.lpMintSupply). Throws when it is smaller than the LP mint supply.- IDL: event
WithdrawStakeSucceed, errorsDeprecated(6023) andNothingToExit(6024). - IDL: instructions
closeZeroUnstake,closeStakeEscrow, andcloseVault, eventsCloseZeroUnstake,StakeEscrowClosed, andVaultClosed, errorsUnstakeAmountNotZero(6025),StakeEscrowNotEmpty(6026), andVaultNotEmpty(6027). - IDL: field
finalFeeClaimedinFeeVault, taken frompadding0(now 6 bytes). It is set to 1 by the firstclaim_fee_crankorclaimFeeAndWithdrawFull, even when no lock escrow fee is claimed.
Changed
- The unstake lock duration is no longer enforced. Ongoing unstake requests can be withdrawn immediately with
withdraw, without waiting for their release time. - The program claims the lock escrow fee only once, by the first
claim_fee_crankorclaimFeeAndWithdrawFull, even when the pending fee is zero. A lock escrow without locked amount is not claimed, but the final claim is still marked as done.getLockedEscrowPendingFeereturns zero oncefeeVault.finalFeeClaimedis set or when the lock escrow has no locked amount, and no longer applies the minimum claim interval. - The program distributes all locked fees to the top stakers immediately instead of over
secondsToFullUnlock.StakeForFee.getFarmReleasedFeesreturns the locked fees plus the pending lock escrow fee, or zero untilfeeVault.configuration.startFeeDistributeTimestamphas passed or while the top stakers have no effective stake amount. This changes the pending fees returned bygetUserStakeAndClaimBalance,getStakeEscrowPendingFees, andStakeForFee.getAllStakedVaultByUser. getTokenBalancesandgetLockedEscrowPendingFeeuse the LP supply tracked by the dynamic vault (vault.totalLpSupply) for version 1 vaults, instead of the LP mint supply.getLockedEscrowPendingFeealso uses the LP supply tracked by the dynamic AMM pool (pool.lpMintSupply). They throw when the tracked supply is smaller than the LP mint supply.feeVault.metrics.totalStakeEscrowCountis decreased bycloseStakeEscrow, so it is the number of open stake escrows. This changesrawContext.totalStakersreturned byparseFeeVaultInfo.
Breaking Changes
getLockedEscrowPendingFeetakes the dynamic AMM pool state as the last parameter.StakeForFee.getFarmPendingClaimFeesandStakeForFee.getFarmReleasedFeestakeammPool.
Deprecated
createFeeVault,createFeeVaultWithParams,createFeeVaultInstructions,initializeStakeEscrow,getOrCreateStakeEscrowInstruction,stake,claimFee,unstake, andcancelUnstake. The program instructions are deprecated, so the transactions fail withDeprecatedonce they land on-chain. Their parameters are unchanged. Pending fees are claimed withclaimFeeAndWithdrawFull.MIN_LOCK_ESCROW_CLAIM_FEE_DURATION. The program removed the minimum lock escrow claim fee interval.feeVault.configuration.unstakeLockDurationandfeeVault.configuration.secondsToFullUnlockare no longer used by the program. IDL instructionsupdateUnstakeLockDurationandupdateSecondsToFullUnlockfail withDeprecated.
Fixed
getLockedEscrowPendingFeeincludeslockEscrow.unclaimedFeePending, which the dynamic AMM claims together with the new fee.StakeForFee.getUnstakeByUserno longer throws when the stake escrow does not exist. It derives the stake escrow address instead of fetching the account, so it also returns the unstake requests with zero amount left after the stake escrow is closed.getStakeEscrowPendingFeesandStakeForFee.getAllStakedVaultByUserreturn only the pending fees stored in the stake escrow when it is not in the top list, likegetUserStakeAndClaimBalance. Fees accrue only while the stake escrow is in the top list.
Rust interface: stake_for_fee_interface 0.2.0
SDK PR #36Sync with stake-for-fee program 0.1.2. This crate is not published to crates.io. Take it from the SDK repository.Added
- Instruction
claim_fee_and_withdraw_full. It emitsClaimFeeSucceed, andWithdrawStakeSucceedonly when a stake amount is withdrawn. - Event
WithdrawStakeSucceedand errorsDeprecated(6023) andNothingToExit(6024). - Field
final_fee_claimedinFeeVault, taken frompadding_0(now[u8; 6]). It is set to 1 by the firstclaim_fee_crankorclaim_fee_and_withdraw_full, even when no lock escrow fee is claimed. - Instruction
close_zero_unstake. The owner closes an unstake request with zerounstake_amountand gets the rent back, also after the stake escrow is closed. - Permissionless instruction
close_stake_escrow. Closes a stake escrow without stake amount, pending fees, and ongoing unstake amount, and returns the rent to the owner. - Permissionless instruction
close_vault. Once all stake escrows are closed and the vault has no stake amount, ongoing unstake amount, or effective stake amount, closes the vault, the top staker list, and the full balance list, and returns the rent to the creator. The token vaults are not closed. - Events
CloseZeroUnstake,StakeEscrowClosed, andVaultClosed.
Changed
- Breaking: The crate is generated by Anchor
declare_program!fromidls/stake_for_fee.json, replacing the previous generated code. It requiresanchor-lang1.2.1 and Rust 1.89 or newer. Forward theidl-buildfeature when your program generates its IDL. - Field
padding0ofFeeVault,StakeEscrow,Configuration,Metrics, andTopStakerInfois renamedpadding_0.Unstakegets the fieldsownerandvaultadded in program 0.1.1, andpaddingis renamed_padding(now[u64; 22]). Metrics.total_stake_escrow_countis decreased byclose_stake_escrow, so it is the number of open stake escrows.
Deprecated
initialize_vault,initialize_stake_escrow,stake,claim_fee,request_unstake,cancel_unstake,update_seconds_to_full_unlock, andupdate_unstake_lock_durationalways fail withDeprecatedon-chain. Their accounts and instruction data are unchanged.
Rust helpers: common 0.0.2
SDK PR #36Changed
- Breaking: Depends on
anchor-lang1.2.1 instead ofsolana-sdk1.16. The PDA helpers take and returnanchor_lang::prelude::Pubkey.
Release summary
Program
0.1.2 deprecates claim_fee. Use the 0.1.2 exit path for new integrations.Program: stake-for-fee 0.1.1
Program ID (mainnet and devnet): FEESngU3neckdwib9X3KWqdL7Mjmqk9XNp3uh5JbP4KPProgram PR #32Added
ownerandvaulton the unstake account.
Changed
claim_feepays only the quote token. The stake token fee is restaked.
TypeScript SDK: @meteora-ag/m3m3 1.0.10
SDK PR #35Changed
- Removed the
@solana-developers/helpersdependency and replaced@mercurial-finance/dynamic-amm-sdkwith@meteora-ag/dynamic-amm-sdk.
Earlier SDK notes
1.0.9(stake-for-fee-sdk #33): moved@mercurial-finance/dynamic-amm-sdkfrom a dev dependency to a dependency.1.0.1(stake-for-fee-sdk #24): refactoredfindLargestStakerNotInTopListFromFullBalanceListandfindReplaceableTopStaker.common0.0.1(stake-for-fee-sdk #28): PDA helpers for the Stake2Earn vault, top staker list, full balance list, and event authority.

