Create a Stake2Earn v1 Pool with Alpha Vault
Stake2Earn Pools are DAMM v1 Pools that are launched with a Stake2Earn Vault. This page provides code examples to initialize and seed a Stake2Earn Pool together with an Alpha Vault.
Key Components:
- DAMM v1 Pool: A DAMM v1 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
- Alpha Vault: Anti-sniper tool that allows depositors to be the first to buy from the pool and be guaranteed a share of tokens at the same average price
Getting Started
- Dynamic AMM SDK: https://github.com/MeteoraAg/damm-v1-sdk
- NPM: https://www.npmjs.com/package/@meteora-ag/dynamic-amm-sdk
- Stake2Earn Vault SDK: https://github.com/MeteoraAg/stake-for-fee-sdk
- Alpha Vault SDK: https://github.com/MeteoraAg/alpha-vault-sdk
- Alpha Vault Launch Calculation template: Copy this google sheet and adjust the numbers to help determine your preferred parameters
- Devnet: https://devnet.meteora.ag/
API
- Mainnet API endpoint: https://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
- Devnet API endpoint: https://devnet.stake-for-fee-api.meteora.ag/swagger-ui/
Dependencies
Install dependencies
Initialize AmmImpl instance
Scripts
1. Choose a suitable Pool and Fee Config
Before creating the pool, you need to choose a suitable pool and fee config. What fee parameters to choose depends on your project’s needs.
Key Requirements:
- Look at the pool config list and choose a suitable
pool_config_key
with your preferred fee parameters - If you want to create an Alpha Vault, you also need a
pool_config_key
mapped to avault_config_key
that meets your requirements - If none of the existing configs meet your requirements, reach out to Meteora for a custom pool config key
Public Pool Config List
- Pool config list: https://damm-api.meteora.ag/swagger-ui/#/pools/get_all_pool_configs
- Devnet API: https://damm-api.devnet.meteora.ag/swagger-ui/
- API endpoint for fee curves: https://damm-api.meteora.ag/swagger-ui/#/fee_config/get_config_associated_fee_configs
Default Pool Config used by Meteora Frontend
By default, Meteora’s frontend uses this pool config key for Memecoin Pool creation: FiENCCbPi3rFh5pW2AJ59HC53yM32eLaCjMKxRqanKFJ
Note: This config doesn’t allow creation of any Alpha Vault, therefore its vault_config_key
field is 1111111...
Custom Pool Config and Fee Curve
Custom Pool Config Key: Integrators such as launchpads may need their own unique custom pool config key for custom pool_creator_authority
to prevent front-running.
Important Notes:
- New dedicated config keys can only be created by Meteora
- The
pool_creator_authority
doesn’t work with program address - it needs to be a PDA or normal account - Custom fee curves require a dedicated config key from Meteora
Custom Fee Curve for a Specific Pool
If required, Meteora can set a custom fee curve for a single, specific pool. This would override the fee curve used by the pool’s config key.
2. Create the Memecoin Pool
After selecting your preferred pool_config_key
, reference this example in the Dynamic AMM SDK:
Update the example with your selected pool config and other parameters to create a Memecoin Pool.
How to assign fee claiming wallets
Refer to the allocations
section in the example:
Find your Stake2Earn Vault public key address and allocate the percentage of fees from permanently locked liquidity that you intend to go to the Stake2Earn vault.
How to find the Stake2Earn Vault address
Put your pool public key address in this example to derive the Stake2Earn Vault address before it’s created:
3. Create the Stake2Earn Vault
After creating the Memecoin Pool and setting up fee allocation, use this example to create the Stake2Earn Vault:
4. Create the Alpha Vault
Use this example to create the Alpha Vault:
Read the Alpha Vault SDK and code examples for more information.
Alpha Vault with Whitelist
For launches that want to restrict wallet addresses allowed to deposit into the Alpha Vault, specify the whitelistMode
in the config:
- permissionless: No whitelist, anyone can deposit
- permission_with_authority: Only the Alpha Vault creator can create escrow accounts with max_cap (suitable for ≤100 addresses)
- permission_with_merkle_proof: Only whitelisted wallets can deposit (requires CSV file of whitelisted addresses)
After deployment
To view pool on the UI, access the link below:
For Dynamic AMM and Memecoin Pool: https://app.meteora.ag/pools/`POOL_ADDRESS`
When can you withdraw tokens from the pool?
CustomizablePermissionless Dynamic AMM: After pool activation point (trading starts)
Important Notes
- Configure your Stake2Earn staking rewards distribution start time approximately 48 hours after launch to allow more fee accumulation
- Currently, only SOL or USDC is accepted as the quote token when initializing pools with Alpha Vault in permissionless setup
- If using a multisig on the Meteora website, ensure it’s the SquadsX multisig (only supported type)
- There must be a ~1 hour 5 minutes period between deposit close time and pool activation time
Timing Requirements:
- Crank start point:
activationPoint - 3600
(timestamp) oractivationPoint - 9000
(slot) - Vault deposit close point:
Crank start point - 5 min
(timestamp) orCrank start point - 750
(slot)
Configuration Details
There are various config files in the config directory containing all configurations required to run the scripts. You also need to provide the keypair for the payer wallet in keypair.json
file.
General configuration
rpcUrl
: Solana RPC URL to get data and send transactionskeypairFilePath
: Keypair file path to send transactionsdryRun
: Set to true to send transactionscomputeUnitPriceMicroLamports
: CU price in micro lamports unit (e.g., 100000)createBaseToken
: Configuration to create base tokenbaseMint
: Base token address if the createBaseToken field is not setquoteSymbol
: Quote token symbol, only SOL or USDC is supportedquoteMint
: Quote token mint for tokens other than SOL or USDCdynamicAmm
: Dynamic AMM pool configurationalphaVault
: FCFS or Pro-rata Alpha Vault configuration
Configuration constraints:
createBaseToken
andbaseMint
cannot be used togetherdynamicAmm
anddlmm
cannot be used together
Create Base Token configuration
mintBaseTokenAmount
: Base token amount to be minted
Dynamic AMM configuration
baseAmount
: Base token amountquoteAmount
: Quote token amounttradeFeeNumerator
: Trade fee numerator (fee denominator is 100,000)activationType
: Activate pool trading based on slot or timestampactivationPoint
: Pool activation point (slot or timestamp value)hasAlphaVault
: Whether alpha vault is enabled for this pool
Alpha Vault configuration
poolType
: Dynamic or DLMM pool typealphaVaultType
: Alpha Vault type (fcfs or prorata)depositingPoint
: Slot or timestamp that allows depositstartVestingPoint
: Slot or timestamp that starts vestingendVestingPoint
: Slot or timestamp that ends vestingmaxDepositCap
: Maximum deposit capindividualDepositingCap
: Individual deposit capescrowFee
: Fee to create stake escrow account (charged in native SOL)whitelistMode
: permissionless, permission_with_merkle_proof, or permission_with_authority
Alpha Vault Pro-rata configuration
depositingPoint
: Slot or timestamp that allows depositstartVestingPoint
: Slot or timestamp that starts vestingendVestingPoint
: Slot or timestamp that ends vestingmaxBuyingCap
: Maximum buying capescrowFee
: Fee to create stake escrow accountwhitelistMode
: permissionless, permission_with_merkle_proof, or permission_with_authority
Alpha Vault Key Components
Vault Types: Supports both permissionless (without whitelist) and permissioned (with whitelist) Alpha Vaults
Whitelist Modes:
- Without whitelist: Permissionless
- With whitelist: PermissionWithMerkleProof, PermissionWithAuthority
alphaVaultType (Vault Mode):
- Pro-rata
- FCFS (First-Come, First-Served)
Individual Deposit Cap: Global individual deposit cap without whitelist only possible on FCFS vault mode
Create Stake2Earn Vault configuration
topListLength
: Length of the top listunstakeLockDurationSecs
: Duration to wait before withdraw (from unstake action timestamp)secondsToFullUnlock
: Time required for locked claim fee to be fully drippedstartFeeDistributeTimestamp
: When fee distribution starts (should be 48h after pool activation)
Alpha Vault TypeScript SDK
After creating the Alpha Vault for your pool, check out the Alpha Vault SDK for different ways to interact with it, including depositing funds, cranking the vault to buy tokens, or claiming purchased tokens.