Stake2Earn Pool Integration
Summary
Stake2Earn Pools are Dynamic AMM Memecoin Pools that are launched with the stake-to-earn mechanism. For more information, read here.
StakeForFee
is the technical term used in the docs to describe the Stake2Earn mechanism and program, while feeFarm
refers to a Stake2Earn Vault.
Memecoin Pool: A Dynamic AMM Pool created with a fee scheduler and with initial liquidity perma-locked.
Stake2Earn Vault: Stake-to-earn farming mechanism and vault where top stakers can earn a share of fees from the locked liquidity.
Stake2Earn Pool: A Memecoin Pool with a Stake2Earn Vault.
List of Sections
Getting Started
Program ID: FEESngU3neckdwib9X3KWqdL7Mjmqk9XNp3uh5JbP4KP
API
Mainnet API endpoint: https://stake-for-fee-api.meteora.ag/swagger-ui/
Devnet API endpoint: https://devnet.stake-for-fee-api.meteora.ag/swagger-ui/
API endpoint to get Stake2Earn vault info from pool address: https://stake-for-fee-api.meteora.ag/swagger-ui/#/vault/filter_vaults
1. Install dependencies and initialize StakeForFee Instance
Below are the steps to use the StakeForFee TypeScript SDK.
1.1 Install Dependencies
1.2 Initialize StakeForFee Instance
2. Code Examples to interact with StakeForFee
In the following code, feeFarm
refers to the Stake2Earn Vault.
Stake
Get stake balance and claimable balance
Claim Fee
Unstake
Get unstake period (Seconds)
Cancel unstake
Withdraw
3. How to create a Memecoin Pool with Stake2Earn Vault
Important Reminder:
You are recommended to configure your Stake2Earn staking rewards distribution start time (fee claim start time) to be approximately 48 hours after launch. This allows more time for total fee rewards to accumulate from trading activity in the memecoin pool. A bigger total fee reward would help make your Stake2Earn Vault look more appealing to potential stakers.
3.1 TypeScript Code Example
Use this example to to create a Memecoin Pool with Stake2Earn Vault: https://github.com/MeteoraAg/stake-for-fee-sdk/blob/main/ts-client/src/examples/index.ts
This code example includes the steps to:
Mint a token
Create dynamic vault and pool
Create Stake2Earn Vault
Lock user's LP to Stake2Earn Vault
3.2 CPI Example to initialize a Stake2Earn vault
Other examples: https://github.com/MeteoraAg/cpi-examples?tab=readme-ov-file
3.3 Script to deploy a Stake2Earn vault
Alternatively, we also provide a convenient script to deploy a new Stake2Earn vault.
Note: The following script is for deploying a new Stake2Earn vault only. To deploy a Memecoin Pool with permanently locked liquidity, please refer to Memecoin Pool Integration.
Getting Started
Clone repo: https://github.com/MeteoraAg/meteora-pool-setup
Config list to reference: https://github.com/MeteoraAg/meteora-pool-setup/tree/main/config
Dependencies
Install Bun: You'll also need bun to run the scripts. Install it via bun installation. Then install the dependencies by running the command
bun install
Code Example
https://github.com/MeteoraAg/meteora-pool-setup/blob/main/config/create_m3m3_farm.json
Note: You can also deploy a Memecoin Pool with a Stake2Earn Vault, as well as an Alpha Vault if required.
4. How to create a Dynamic AMM Pool (fixed fee %) with Stake2Earn vault
If you are creating the pool using the instruction:
initializeCustomizablePermissionlessConstantProductPool
It will be fixed fee. Same applies to a Dynamic AMM pool created using the script in this repo: https://github.com/MeteoraAg/meteora-pool-setup/tree/main
createPermissionlessConstantProductPoolWithConfig2
Make sure you choose the config account that doesn't have any Dynamic Fee.
Check using https://amm-v2.meteora.ag/swagger-ui/#/fee_config/get_config_associated_fee_configs and make sure it returns no fee curve.
5. Important Considerations
Stake2Earn staking rewards distribution start time
You are recommended to configure your Stake2Earn staking rewards distribution start time (fee claim start time) to be approximately 48 hours after launch. This allows more time for total fee rewards to accumulate from trading activity in the memecoin pool. A bigger total fee reward would help make your Stake2Earn Vault look more appealing to potential stakers.
Difference between locking liquidity via Stake2Earn vs directly locking liquidity in the Memecoin Pool
User lock and Stake2Earn lock use the same lock mechanism on a Dynamic AMM / Memecoin Pool. But users and Stake2Eearn vaults have their own personal lock escrow account for the pool.
When a user permanently locks liquidity directly on the Memecoin Pool page, the user is locking the LP token to their own personal escrow account for the pool. Fees from this locked liquidity go to the user's wallet.
However, when a user locks via the Stake2Earn creation process, the user is locking the LP to their unique Stake2Earn Vault stake escrow account. Therefore, fees from this locked liquidity go to the Stake2Earn Vault, which then distributes fees to the top stakers.
How to find the Stake2Earn vault address and a user wallet's unique personal Stake Escrow address?
Use a wallet simulator (e.g. Sherlock extension) and paste the user's wallet address. Try to stake or unstake tokens in a Stake2Earn Vault.
Click "Open explorer" and on the explorer page search for
Vault
and/orStake Escrow
fields to find the respective addresses.
Other Considerations
If you plan to use a multisig on the Meteora website, please make sure it is the SquadsX multisig, as that is the only type supported on Meteora website. Otherwise, you can't manage liquidity through the website.
There is a minimum ~1 hour 5 minutes period between the deposit close time and the pool activation time.
Last updated