Create a DAMM v2 Launch Pool
Dynamic AMM v2 (DAMM v2) is a brand new constant-product AMM program for liquidity pools, with a set of features to optimize transaction fees and provide greater flexibility for liquidity providers, launchpads, and token launches.
DAMM v2 Launch Pools can also be created with an Alpha Vault as part of the token launch process. This is optional.
Below we provide the steps to use Bun to configure and run sample scripts to conveniently set up a DAMM v2 Launch Pool on your own.
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
-
Readme: https://github.com/MeteoraAg/meteora-pool-setup/blob/main/README.md
-
Program id: cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG
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
Scripts
The following code examples can be used to initialize and seed a DAMM v2 pool on Meteora. It allows you to configure parameters for the pool, including fees, pricing, and activation conditions, before executing initialization and seeding commands.
1. Create customizable DAMM v2 pool
Clone repo: https://github.com/MeteoraAg/meteora-pool-setup
Select an example config to reference and change the parameters inside according to your needs: https://github.com/MeteoraAg/meteora-pool-setup/blob/main/config/create_damm_v2_customize_pool_default_dynamic_fee.json
Run the script with the config file which is updated with your preferred parameters.
For example, run:
Replace ./config/create_damm_v2_customize_pool.json
with the path to your config file, after you have set your config parameters.
After deployment
To view pool on the UI, access the link below
For DAMM v2 pool: https://app.meteora.ag/pools/`POOL_ADDRESS`
Configuration Details
There are various config files that can be found in the config directory.
It contains all the configurations required to run the scripts. We 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 transactions. -
keypairFilePath
: Keypair file path to send transactions. -
dryRun
: Set to false to send transactions. -
computeUnitPriceMicroLamports
: CU price in micro lamports unit. For example: 100000. -
createBaseToken
: Configuration to create base token. -
baseMint
: Base token address if the createBaseToken field is not set. -
quoteSymbol
: Quote token symbol, only SOL or USDC is supported. -
quoteMint
: Quote token mint, in case the user wants to create a DLMM launch pool with a token other than SOL or USDC. -
dynamicAmm
: Dynamic AMM pool configuration. -
dynamicAmmV2
: Dynamic AMM V2 pool configuration. -
dlmm
: DLMM pool configuration. -
alphaVault
: Fcfs or Prorata Alpha Vault configuration.
Some configuration constraints:
-
createBaseToken
andbaseMint
cannot be used together. -
dynamicAmm
anddlmm
cannot be used together.
Create Base Token configuration
-
mintBaseTokenAmount
: Base token amount to be minted. -
baseDecimals
: Base token decimal.
Dynamic AMM v2 configuration
-
baseAmount
: Base token amount. -
quoteAmount
: Quote token amount (Nullable value) -
initPrice
: Initial price for the pool -
maxPrice
: Max price range setup (null to use default) -
poolFees
:-
maxBaseFeeBps
: Starting fee in basis points (e.g., 25 = 0.25%). It is base fee if scheduler is not set. -
minBaseFeeBps
: Target fee after reduction periods. Should be equal maxBaseFeeBps when fee scheduler is not used. -
numberOfPeriod
: Number of periods for fee reduction schedule -
totalDuration
: Total duration of the fee schedule (in slots or seconds based on activation type). totalDuration == 0 if the FeeScheduler not be set up. -
feeSchedulerMode
: Fee scheduler mode (0 = linear, 1 = exponential) -
useDynamicFee
: Whether to use dynamic fee calculation based on price volatility (true/false) -
dynamicFeeConfig
: Configuration when useDynamicFee is true if not provide will use as default params in scripts-
filterPeriod
: Period for filtering price updates -
decayPeriod
: Period for decaying volatility accumulator -
reductionFactor
: Factor for reducing the volatility impact -
variableFeeControl
: Parameter controlling the variable fee response -
maxVolatilityAccumulator
: Maximum value for the volatility accumulator
-
-
collectFeeMode
: Fee collection mode (0 = base + quote, 1 = only quote)
-
-
activationType
: To activate pool trading base on slot or timestamp. -
activationPoint
: To activate pool trading at a point, either slot value or timestamp value base on activationType. -
hasAlphaVault
: Whether alpha vault is enabled or not for this pool.
Alpha Vault configuration
-
poolType
: dynamic or dlmm pool type. -
alphaVaultType
: Alpha Vault type, could be fcfs or prorata -
depositingPoint
: Absolute value that, the slot or timestamp that allows deposit depend on the pool activation type. -
startVestingPoint
: Absolute value, the slot or timestamp that start vesting depend on the pool activation type. -
endVestingPoint
: Absolute value, the slot or timestamp that end vesting depend on the pool activation type. -
maxDepositCap
: Maximum deposit cap. -
individualDepositingCap
: Individual deposit cap. -
escrowFee
: Fee to create stake escrow account. -
whitelistMode
: permissionless or permission_with_merkle_proof or permission_with_authority.
Pro rata configuration
-
depositingPoint
: Absolute value that, the slot or timestamp that allows deposit depend on the pool activation type. -
startVestingPoint
: Absolute value, the slot or timestamp that start vesting depend on the pool activation type. -
endVestingPoint
: Absolute value, the slot or timestamp that end vesting depend on the pool activation type. -
maxBuyingCap
: Maximum buying cap. -
escrowFee
: Fee to create stake escrow account. -
whitelistMode
: permissionless or permission_with_merkle_proof or permission_with_authority.
Technical FAQ
Please read this section for additional technical considerations and troubleshooting.
Alternative: Using TypeScript SDK to create a DAMM v2 Pool
Getting Started
The TypeScript SDK provides a set of tools and methods to interact with the Meteora Dynamic CP-AMM (DAMM v2) program.
-
Program Repo on Github: https://github.com/MeteoraAg/cp-amm
-
TypeScript SDK on Github: https://github.com/MeteoraAg/cp-amm-sdk/tree/main
-
Program ID (mainnet-beta): cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG
-
Program ID (devnet): cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG
Below you can find the main functions for creating a new pool:
createPool
createCustomPool
createCustomPoolWithDynamicConfig
createPosition
addLiquidity
1. Install dependencies and initialize instance
1.1 Install
1.2 Initialization
1.3 Test
1.4 Faucets
2. Core Functions and Use Cases
createPool
Creates a new standard pool according to a predefined configuration.
Function
Parameters
Returns
A transaction builder (TxBuilder) that can be used to build, sign, and send the transaction.
Example
Notes
- Both token amounts must be greater than zero
- If using native SOL, it will be automatically wrapped to wSOL
- The config parameter should be a valid configuration account
- Pool creation automatically creates an initial position
- To set your Pool and Fee Config, please read the instructions in Setting Pool and Fee Config for DAMM v2
createCustomPool
Creates a customizable pool with specific fee parameters, reward settings, and activation conditions.
Function
Parameters
Returns
An object containing:
tx
: The transaction to sign and sendpool
: The public key of the created poolposition
: The public key of the initial position
Example
Notes
- Use this function instead of createPool when you need custom fee structures
- Dynamic fees can adjust based on market volatility
- Partner fees allow a portion of trading fees to be directed to a specific account
- Alpha vault is an advanced feature for protocol-owned liquidity
createCustomPoolWithDynamicConfig
Creates a customizable pool with dynamic configuration, allowing for specific fee parameters with specified pool creator authority.
Function
Parameters
Returns
An object containing:
tx
: The transaction to sign and sendpool
: The public key of the created poolposition
: The public key of the initial position
Example
createPosition
Creates a new position in an existing pool.
Function
Parameters
Returns
A transaction builder (TxBuilder) that can be used to build, sign, and send the transaction.
Example
Notes
- The positionNft should be a new mint that doesn’t already have a position
- Creating a position doesn’t automatically add liquidity
- After creating a position, use addLiquidity to provide tokens
addLiquidity
Adds liquidity to an existing position.
Function
Parameters
Returns
A transaction builder (TxBuilder) that can be used to build, sign, and send the transaction.
Example
Notes
- Calculate the liquidity delta first using getLiquidityDelta
- The SDK handles wrapping/unwrapping of SOL automatically
- Token accounts are created automatically if they don’t exist
- Set appropriate thresholds to protect against slippage