Token Factories
Use Vertigo to create pool factories and launch pools from those factories
Vertigo exposes two default factory programs called SPL Token Factory and Token 2022 Factory. These factories mainly serve as a template. We encourage you to build your own factory to accomodate your specific launchpad needs.
Overview
Factories are useful for when deploying many pools that use the same configuration. A factory must first be initialized before a token can be launched from it. Factories can only be launched by the account that initialized it. Below are the following SDK methods related to factories.
SPL Token Factory methods
SPL token factories are for pools where MintB uses the SPL token program
vertigo.SPLTokenFactory.buildInitializeInstruction()
vertigo.SPLTokenFactory.initialize()
vertigo.SPLTokenFactory.buildLaunchInstruction
vertigo.SPLTokenFactory.launch()
Token 2022 Factory methods
Token 2022 factories are for pools where MintB uses the Token-2022 token program
vertigo.Token2022Factory.buildInitializeInstruction()
vertigo.Token2022Factory.initialize()
vertigo.Token2022Factory.buildLaunchInstruction
vertigo.Token2022Factory.launch()
When to use each method
The instruction()
methods are best if you are integrating into frontend applications or require more control over transactions. If running scripts/bots you might elect to use the other methods for simplicity.
Initialization Parameters
payer - the key pair that is paying for the transaction
owner - the key pair that will own the factory
mintA - the public key of the MintA token
params
shift - the virtual SOL (in lamports) to deploy the pool with. The initial "market cap" is defined by shift / 2. For example, if you set shift to 100 SOL, then the starting market cap will be 50 SOL.
initialTokenReserves - the token supply for mint B
feeParams
normalizationPeriod - the number of slots in which fees will decay from 100% to zero. Defaults to 10.
decay - the rate of decay. Defaults to 2.0
royaltiesBps - royalties on trading volume in basis points. Defaults to 50
tokenParams
decimals - the number of decimals that MintB tokens should use
mutable - whether the mint’s authorities (and extensions) can still be changed after creation
nonce - a number used as an identifier for the factory. Useful if creating multiple factories under the same owner
Launch Parameters
payer - the key pair that will pay for the launch transaction
owner - the key pair that will own the pool
mintA - the public key of the MintA token
mintB - the public key fo the MintB token
mintBAuthority - the key pair for the mint authority of MintB
tokenProgramA - the public key of the token program for MintA
params
tokenParams
name - the display name for the token to be launched
symbol - the symbol to be used for the token
uri - the uri that contains the JSON metadata for the token
reference - the reference slot for fee calculations. Defaults to 0
royaltiesBps - royalties on trading volume in basis points. Defaults to 50
privilegedSwapper - (optional) public key of the address that can swap without fees. Default is none.
nonce - the factory identifier to be used for token launch. This must match the nonce of a previously initialized factory
Example: Initialize a factory
The below example shows how to initialize an SPL token factory.
If you wish to launch a Token-2022 token factory, then the only change needed is to replace vertigo.SPLTokenFactory.initialize()
with vertigo.Token2022Factory.initialize()
Example: Launch a factory
Using the instruction builder methods
You may want to only build the transaction instructions and handle sending the transaction manually. The function parameters are the same in both cases.
For initialization:
replace
initialize
withbuildInitializeInstruction
For launch:
replace
launch
withbuildLaunchInstruction
Examples
Initialize with buildInitializeInstruction
Launch with buildLaunchInstruction
Note that this will return an object with launchInstructions
and devBuyInstructions
field which you can add to your final transaction.
Last updated