initialize_pool

Creates a new launchpad pool, mints the sale token (PDA mint), assigns authorities, creates vaults, and sets on-chain metadata via the Metaplex Token Metadata program.

Program: Tradersdex Curve (Launchpad) Instruction: initialize_pool


What it does

  • Creates pool PDA: ["pool", mint]

  • Creates PDA mint for the sale token (authority = ["token_authority"])

  • Creates vaults:

    • Token vault = ATA(mint, pool)

    • Quote vault = ATA(quote_mint, pool) (if quote != native SOL)

  • Creates MPL metadata with name, symbol, and uri

  • Stores curve parameters and sale targets

  • Emits PoolCreatedEvent for indexers

URI enforcement: If a non-empty uri is provided, it must begin with with a valid ipfs gateway:

"https://ipfs.io/ipfs/"
"https://gateway.pinata.cloud/ipfs/"
"https://cloudflare-ipfs.com/ipfs/"

otherwise the transaction fails. Name and symbol must each be at least 1 characters long.


Accounts (in order)

#
Name
Writable
Seeds / Constraints
Notes

0

pool_signer

["token_authority"]

Program authority for mint & vaults

1

payer

βœ…

Funds rent & creates accounts

2

mint

βœ…

Created in handler

PDA mint for sale token

3

quote_mint

Native SOL or SPL quote asset

4

pool

βœ…

["pool", mint] (PDA), space = Pool::size_for_type(args.curve_type)

Pool state

5

token_vault

βœ…

ATA(mint, pool)

Base token vault

6

quote_vault

βœ…

ATA(quote_mint, pool) or WSOL vault

Quote token vault

7

metadata

βœ…

MPL PDA: ["metadata", mpl_token_metadata::ID, mint]

Token metadata

8

metadata_program

= mpl_token_metadata::ID

MPL Token Metadata program

9

token_program

= anchor_spl::token::ID

SPL Token

10

associated_token_program

For ATA creation

11

system_program

12

tradersdex_curve

= crate::ID

Self-check

13

event_authority

["event_authority"]

Event signer for Anchor events


Arguments


Events


PDA Derivation

  • Pool = PDA(["pool", mint])

  • Program signer = PDA(["token_authority"])

  • Mint = PDA(["mint", le_u128(salt)])

  • Vaults:

    • Token vault = ATA(mint, pool)

    • Quote vault = ATA(quote_mint, pool) or pool for SOL

  • Metadata = PDA(["metadata", MPL_ID, mint], program = MPL_ID)


Validation rules

  • decimals must equal 6

  • name.len() >= 1 and symbol.len() >= 1

  • quote_mint must be either wrapped SOL mint or the native SOL mint

  • PDA derivations must match

  • Adequate lamports for rent-exempt accounts


Client example (TypeScript)


Vanity mint grinder (TypeScript)

Finds one salt that produces a mint PDA (seed: ["mint", le_u128(salt)]) ending with a desired Base58 suffix.

grinder_one.ts

Usage:

Output:

Use the found salt (in LE hex) as your InitializePoolArgs.salt.

Last updated