Launch A Token
Launch A Token
newTokenV2
To Launch a new token, you send a transaction to call the newTokenV2 method:
// solidity interface
/// @notice Create a new token (V2) with flexible parameters
/// @param params The parameters for the new token
/// @return token The address of the created token
function newTokenV2(NewTokenV2Params calldata params) external payable returns (address token);
/// @notice Create a new token (V4) with DEX ID and LP fee profile support
/// @param params The parameters for the new token including DEX ID and LP fee profile
/// @return token The address of the created token
/// @dev Similar to newTokenV3 but with DEX ID and LP fee profile support. Allows specifying preferred DEX and fee tier
function newTokenV4(NewTokenV4Params calldata params) external payable returns (address token);
/// @notice Create a new token (V5) with tax V2 support
/// @param params The parameters for the new token including advanced tax features
/// @return token The address of the created token
/// @dev Similar to newTokenV4 but with support for FlapTaxTokenV2 when taxRate > 0.
/// When taxRate is 0, behaves like newTokenV4 (uses regular token or FlapTaxToken).
/// When taxRate > 0, creates a FlapTaxTokenV2 with advanced tax distribution features.
function newTokenV5(NewTokenV5Params calldata params) external payable returns (address token);
/// @notice Parameters for creating a new token (V2)
struct NewTokenV2Params {
/// The name of the token
string name;
/// The symbol of the token
string symbol;
/// The ipfs cid of the metadata
string meta;
/// The DEX supply threshold type
DexThreshType dexThresh;
/// The salt for deterministic deployment
bytes32 salt;
/// The tax rate in basis points (if non-zero, this is a tax token)
uint16 taxRate;
/// The migrator type (see MigratorType enum)
MigratorType migratorType;
/// The quote token address (native gas token if zero address)
address quoteToken;
/// The initial quote token amount to spend for buying
uint256 quoteAmt;
/// The beneficiary address for the token
/// For rev share tokens, this is the address that can claim the LP fees
/// For tax tokens, this is the address that receives the tax fees
address beneficiary;
/// The optional permit data for the quote token
bytes permitData;
}
/// @notice Parameters for creating a new token (V4) with DEX ID and LP fee profile support
struct NewTokenV4Params {
/// The name of the token
string name;
/// The symbol of the token
string symbol;
/// The metadata URI of the token
string meta;
/// The DEX supply threshold type
DexThreshType dexThresh;
/// The salt for deterministic deployment
bytes32 salt;
/// The tax rate in basis points (if non-zero, this is a tax token)
uint16 taxRate;
/// The migrator type (see MigratorType enum)
MigratorType migratorType;
/// The quote token address (native gas token if zero address)
address quoteToken;
/// The initial quote token amount to spend for buying
uint256 quoteAmt;
/// The beneficiary address for the token
/// For rev share tokens, this is the address that can claim the LP fees
/// For tax tokens, this is the address that receives the tax fees
address beneficiary;
/// The optional permit data for the quote token
bytes permitData;
/// @notice The ID of the extension to be used for the new token if not zero
bytes32 extensionID;
/// @notice Additional extension specific data to be passed to the extension's `onTokenCreation` method, check the extension's documentation for details on the expected format and content.
bytes extensionData;
/// @notice The preferred DEX ID for the token
DEXId dexId;
/// @notice The preferred V3 LP fee profile for the token
V3LPFeeProfile lpFeeProfile;
}
/// @notice Parameters for creating a new token (V5) with tax V2 support
struct NewTokenV5Params {
/// The name of the token
string name;
/// The symbol of the token
string symbol;
/// The metadata URI of the token
string meta;
/// The DEX supply threshold type
DexThreshType dexThresh;
/// The salt for deterministic deployment
bytes32 salt;
/// The tax rate in basis points (if non-zero, this is a tax token)
uint16 taxRate;
/// The migrator type (see MigratorType enum)
MigratorType migratorType;
/// The quote token address (native gas token if zero address)
address quoteToken;
/// The initial quote token amount to spend for buying
uint256 quoteAmt;
/// The beneficiary address for the token
/// For rev share tokens, this is the address that can claim the LP fees
/// For tax tokens, this is the address that receives the tax fees
address beneficiary;
/// The optional permit data for the quote token
bytes permitData;
/// @notice The ID of the extension to be used for the new token if not zero
bytes32 extensionID;
/// @notice Additional extension specific data to be passed to the extension's `onTokenCreation` method, check the extension's documentation for details on the expected format and content.
bytes extensionData;
/// @notice The preferred DEX ID for the token
DEXId dexId;
/// @notice The preferred V3 LP fee profile for the token
V3LPFeeProfile lpFeeProfile;
// New V5 tax-specific fields (only used when taxRate > 0)
/// Tax duration in seconds (max: 100 years)
uint64 taxDuration;
/// Anti-farmer duration in seconds (max: 1 year)
uint64 antiFarmerDuration;
/// Market allocation basis points (to beneficiary)
uint16 mktBps;
/// Deflation basis points (burned)
uint16 deflationBps;
/// Dividend basis points (to dividend contract)
uint16 dividendBps;
/// Liquidity provision basis points (LP to dead address)
uint16 lpBps;
/// Minimum balance for dividend eligibility (min: 10K ether, required when dividendBps > 0)
uint256 minimumShareBalance;
}
/// @notice the V3 LP fee profile
/// @dev determines the LP fee tier to use when migrating tokens to Uniswap V3 or Pancake V3
enum V3LPFeeProfile {
LP_FEE_PROFILE_STANDARD, // Standard fee tier: 0.25% on PancakeSwap, 0.3% on Uniswap
LP_FEE_PROFILE_LOW, // Low fee tier: typically, 0.01% on PancakeSwap, 0.05% on Uniswap
LP_FEE_PROFILE_HIGH // High fee tier (1% for exotic pairs)
}
/// @notice the DEX ID
/// @dev determines the DEX we want to migrate to
/// On BSC:
/// - only DEX0 will be enabled, which is PancakeSwap
/// On xLayer:
/// - only DEX0 will be enabled, which is PotatoSwap
/// On Monad:
/// - DEX0 is Uniswap
/// - DEX1 is PancakeSwap
/// - DEX2 is Monday
/// Note that, currently, we only support at most 3 DEXes
/// We may add more DEXes in the future if needed
enum DEXId {
DEX0,
DEX1,
DEX2
}
/// @notice the migrator type
/// @dev the migrator type determines how the liquidity is added to the DEX.
/// Note: To mitigate the risk of DOS, if a V3 migrator is used but the liquidity cannot
/// be added to v3 pools, the migrator will fallback to a V2 migrator.
enum MigratorType {
V3_MIGRATOR, // Migrate the liquidity to a Uniswap V3 like pool
V2_MIGRATOR // Migrate the liquidity to a Uniswap V2 like pool
}
/// @dev dex threshold types
enum DexThreshType {
TWO_THIRDS, // 66.67% supply
FOUR_FIFTHS, // 80% supply
HALF, // 50% supply
_95_PERCENT, // 95% supply
_81_PERCENT, // 81% supply
_1_PERCENT // 1% supply => mainly for testing
}Before sending the transaction, we should prepare the metadata:
All the metadata are stored on IPFS. You can upload your image and the meta of your token to ipfs through our API.
Check the following example to learn how to upload the image along with the meta data json to IPFS:
Although you may upload the image to ipfs and pin the meta on any ipfs gateway, it is recommended to upload using our API: https://funcs.flap.sh/api/upload . Our indexer may not be able to fetch your file if it is not pinned on our gateway. Besides, a lot of terminals fetch files through our gateway. We will do a CDN warmup on uploading to bootstrap the image & meta loading speed for terminals. This is crutial if you want your token to show up on terminals quickily.
After successfully uploading the image and metadata to IPFS, you will get an IPFS cid which is similar to bafkreicwlkpvrcqg4bbhyp2fnhdwbqos5ghka6gdjra3tdkgxxs74hqsze (e.g. this is the cid of the BROCCOLI tokenβs metadata
After that, you can get the meta json from any ipfs gateway, eg:
Note the meta json has the following format:
The image field itself is another ipfs cid for the image. Then you can get the image here: https://ipfs.io/ipfs/bafkreiccy2x5735r2q3zvcce3ub3hcgpslnn5n3dqa7fn3tgr7qgtlbjhi
Now we have the ipfs cid of the meta json, let's proceed to construct the transaction call.
The new newTokenV2 method takes a single struct (or tuple in solidityβs jargon) as its input. Letβs explain some fields of the NewTokenV2Params struct:
meta: this is the ipfs cid you get from last section , eg,bafkreicwlkpvrcqg4bbhyp2fnhdwbqos5ghka6gdjra3tdkgxxs74hqszedexThresh: This determines the threshold to migrate token to DEX. Our UI usesFOUR_FIFTHSby default, which means when 80% or more of the total supply has been sold from the bonding curve , the token will be migrated to DEX.taxRate: since v3.3.0, we support creating a tax token. The tax is only applied for the first year after the token being migrated to DEX. The maximum tax rate is10%Our UI only supports limited Tax Rates, but you can always use any tax rate from 0 up to 10%.
Since v5, the default tax duration changes from 1 year to 100 year.
migratorType: The migrator for the token. Note, if a token has tax, it can only be migrated to a V2 pool, which means only aV2_MIGRATORis allowed for a tax token. For other tokens, it is recommended to use aV3_MIGRATOR. With aV3_MIGRATORwe will optimize your liquidity and enable the revenue share feature for you token.quoteToken: The quote token you want to use. When your quote token is the native gas token (i.e ETH or BNB), leave quoteToken as the zero address. Note: only enabled quoteToken can be used.quoteAmt: The amount of quoteToken you want to spend to buy token on creation.beneficiary: If the token has not TAX and using aV3_MIGRATOR, the rev share fees can be claimed with this address; If the token has TAX, this address will receive the tax fee.permitData: If your quoteToken is not zero address (i.e, not native gas token ETH or BNB, but some ERC20 token). You can construct thepermitDatato avoid another approve TX. Check our example below to see how to construct thepermitData.salt: The salt is mandate. All tokens created from thenewTokenV2method have a vanity ending. If the token has no tax, it has an ending of 8888 or it has an ending of 7777.
Here is an example script for generating the salt on BNB chain:
The suffix is
8888if your token has not tax, otherwise it is7777The token impl address is :
0x8B4329947e34B6d56D71A3385caC122BaDe7d78Dfor non tax token0x5dd913731C12aD8DF3E574859FDe45412bF4aaD9for tax token v10xae562c6A05b798499507c6276C6Ed796027807BAfor tax token v2
Portal address on BSC is
0xe2cE6ab80874Fa9Fa2aAE65D277Dd6B8e65C9De0
In the above example script, we using a random private key as the seed. In reality, you can use any random number or string as your seed to find the salt.
newTokenV3, newTokenV4, and newTokenV5
In addition to newTokenV2, the portal also supports newTokenV3, newTokenV4, and newTokenV5 with additional features:
newTokenV3
Adds extension support to newTokenV2. Extensions allow custom logic to be executed during token creation and trading.
extensionID: The unique identifier for the extension to use (bytes32(0) for no extension)extensionData: Additional data passed to the extension'sonTokenCreationmethod
newTokenV4
Adds DEX preference configuration to newTokenV3:
dexId: The preferred DEX ID for the token (DEX0, DEX1, or DEX2)DEX0: Primary DEX (PancakeSwap on BSC, Uniswap on Monad, PotatoSwap on xLayer)DEX1: Secondary DEX (only on Monad - PancakeSwap)DEX2: Tertiary DEX (only on Monad - Monday)
lpFeeProfile: The preferred V3 LP fee profileLP_FEE_PROFILE_STANDARD: Standard fee tier (0.25% on PancakeSwap, 0.3% on Uniswap)LP_FEE_PROFILE_LOW: Low fee tier (0.01% on PancakeSwap, 0.05% on Uniswap)LP_FEE_PROFILE_HIGH: High fee tier (1% for exotic pairs)
newTokenV5
When using newTokenV5 for creating a tax token, if mktBps==10000 , we will create a v1 tax token, you should use Tax Token V1 impl address for computing the salt; However, if mktBps < 10000 , we will create a V2 tax token, you should use Tax Token V2 address for computing the salt.
You can find the implementations address for each version of the tax tokens on different chains here: Deployed Contract Addresses
The most advanced token creation method with support for FlapTaxTokenV2 - an upgraded tax token implementation with sophisticated tax distribution features. When taxRate > 0, creates a V2 tax token with advanced capabilities; when taxRate = 0, behaves like newTokenV4.
Key Features of Tax V2 Tokens:
Advanced Tax Distribution: Distributes tax across multiple destinations (market, deflation, dividends, liquidity)
Configurable Tax Duration: Set custom tax duration (up to 100 years, vs. fixed 1 year in V1)
Anti-Farmer Protection: Optional anti-farmer period to prevent immediate sell-offs after DEX migration (vs fixed 1 day in V1)
Dividend System: Automatic dividend distribution to qualifying token holders
Flexible Allocation: Customizable basis points for each tax destination
Additional Parameters (only applicable when taxRate > 0):
taxDuration(uint64): Tax duration in secondsMaximum: 100 years (3,153,600,000 seconds)
antiFarmerDuration(uint64): Anti-farmer protection period in secondsMaximum: 1 year (31,536,000 seconds)
During this period, additional restrictions may apply to prevent farming
Recommended to set this to at least 3 days.
mktBps(uint16): Market allocation in basis points (to beneficiary)Range: 0 to 10,000 (0% to 100%)
This portion goes to the beneficiary address for marketing/development
deflationBps(uint16): Deflation allocation in basis points (burned)Range: 0 to 10,000 (0% to 100%)
This portion is permanently burned, reducing total supply
dividendBps(uint16): Dividend allocation in basis points (to dividend contract)Range: 0 to 10,000 (0% to 100%)
Distributed to qualifying token holders based on their balance
Requires
minimumShareBalanceto be set if > 0
lpBps(uint16): Liquidity provision allocation in basis pointsRange: 0 to 10,000 (0% to 100%)
Added back to liquidity pool (LP tokens sent to dead address)
minimumShareBalance(uint256): Minimum token balance for dividend eligibilityMinimum: 10,000 ether (10,000 * 10^18)
Only required when
dividendBps > 0Holders with balance below this threshold won't receive dividends
Important Constraints:
The sum of all tax distribution BPS must equal 10,000 (100%):
Tax tokens must use
V2_MIGRATOR(V3 migration not supported for tax tokens)Maximum
taxRate: 10% (1,000 basis points)
Example: Creating a Tax V2 Token
When to Use Each Method:
newTokenV2: Basic token creation with simple parameters
newTokenV3: When you need extension support for custom logic
newTokenV4: When you want to specify DEX preference and LP fee profile
newTokenV5: When creating advanced tax tokens (V2) or need all V4 features
Events
For backward compatibility, each newly launched token will emit one or more events rather than a single event:
TokenCreated: Every token launch will emit aTokenCreatedevent.TokenCurveSet: (optional), if a token launch does not emit this event, its curve is the first one in theCurveTypeenum , which is 16 ( i.ecurveParameter= 16 ether )TokenCurveSetV2: (optional), starting from v4.7.0, this event is always emitted even when the token is using the legacy bonding curve.
TokenDexSupplyThreshSet: (optional), if a token does not emit this event, its dex threshold is by default the first one in theDexThreshTypeenum, which is 6.67e8 ether.TokenQuoteSet: (optional), if a token does not emit this event, its quote token is the native gas token (i.e, zero address). Otherwise the quote token 's address is thequoteTokenarg in the event (Currently, we support USD1 and lisUSD on BSC)TokenMigratorSet: (optional), if a token does not emit this event, its Migrator type is by defaultV3_MIGRATOR(i.e, the first one in theMigratorTypeenum).FlapTokenTaxSet: (optional), if a token does not emit this event, the tax is 0 or it is not a tax token.FlapTokenStaged: (optional), emitted when a token is staged but not yet created (for two-step token launch).TokenExtensionEnabled: (optional), emitted when an extension is enabled for a token.TokenDexPreferenceSet: (optional), emitted when a token's DEX preference is set (includes DEX ID and LP fee profile). For backward compatibility, if a token does not emit this event, its DEX preference is DEX0 and STANDARD fee profile.TokenPoolInfoUpdated: (optional), emitted when a token's pool information is updated.
Last updated