Create: Dynamic AMM Pool

Summary

Get an overview about Dynamic AMM Pools here.

Below we provide the steps to use Bun to configure and run sample scripts to conveniently set up a permissionless Dynamic AMM Pool (with fixed fee %) on your own.

Note: For a Dynamic AMM Pool with a fee scheduler and liquidity permanently locked at pool creation (a.k.a Memecoin Pool v1), visit Create: Memecoin Pool v1.

Getting Started

Resources

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 Dynamic AMM liquidity pool on Meteora.

Create Dynamic AMM Pool (fixed fee %) for Token Launch

Examples

Create a Dynamic AMM Pool with an existing token

To create a Dynamic AMM Pool with an existing token (without minting a new token).

Run this script with the config file which is set with your preferred parameters:

  • bun run src/create_pool.ts --config <./config/create_dynamic_amm_pool.json>

  • Replace <./config/create_dynamic_amm_pool.json> with the path to your config file, after you have selected the type of config from the list and set your config parameters.

Create a Dynamic AMM Pool with new token mint

To mint a new token and create a Dynamic AMM Pool for this token.

Run this script with the config file which is set with your preferred parameters:

bun run src/create_pool.ts --config ./config/create_dynamic_amm_pool_with_new_token.json

Lock Liquidity for Dynamic AMM Pool (Optional)

You have the option to lock liquidity in the Dynamic AMM Pool you created.

Run this script with the config file which is set with your preferred parameters:

bun run src/lock_liquidity.ts --config ./config/lock_liquidity.json

Allocating fees from locked liquidity: In the config file, you can also specify different wallet addresses to receive fees from the locked liquidity, and the % to allocate to each wallet. Multiple wallets are possible, but their allocations must add up to 100%.

After deployment

To view pool on the UI, access the link below

  • For Dynamic AMM 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)

Other 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 true 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.

Some configuration constraints:

  • createBaseToken and baseMint cannot be used together.

  • dynamicAmm and dlmm cannot be used together.

Create Base Token configuration

  • mintBaseTokenAmount: Base token amount to be minted.

Dynamic AMM configuration

  • baseAmount: Base token amount.

  • quoteAmount: Quote token amount.

  • tradeFeeNumerator: Trade fee numerator, with fee denominator is set to 100_000.

  • activationType: To activate pool trading based on slot or timestamp.

  • activationPoint: To activate pool trading at a point, either slot valut or timestamp value based on activationType.

  • hasAlphaVault: Whether alpha vault is enabled or not for this pool.

For Testing Bun Scripts

First, run the localnet

bun run start-test-validator

Then run the test: bun test

Last updated