Skip to content
ubi.fun
Esc
navigateopen⌘Jpreview
On this page

Launching programmatically

Create coins from your own product through FlaunchZap, the same one-transaction entry point the app uses.

If your product launches coins on behalf of users (a bot, a terminal, another launchpad frontend), call the same contract our app calls: FlaunchZap. One transaction creates the token, its Uniswap v4 pool, locked liquidity, the fair launch, and the creator’s revenue stream. Launches at the minimum $10,000 initial market cap are currently fee-free; larger market caps can owe a flaunch fee as msg.value.

The call

function flaunch(
  FlaunchParams calldata _flaunchParams,
  address _trustedFeeSigner,
  bytes calldata _premineSwapHookData,
  WhitelistParams calldata _whitelistParams,
  AirdropParams calldata _airdropParams,
  TreasuryManagerParams calldata _treasuryManagerParams
) payable returns (address memecoin_, uint256 ethSpent_, address deployedManager_);

with

struct FlaunchParams {
  string  name;
  string  symbol;
  string  tokenUri;                // token metadata (name, description, image); see below
  uint256 initialTokenFairLaunch;  // supply sold in the fair launch phase
  uint256 fairLaunchDuration;      // seconds
  uint256 premineAmount;           // coins the creator buys at launch price in the same tx
  address creator;                 // receives the Flaunch NFT and the creator revenue
  uint24  creatorFeeAllocation;    // creator vs floor-bid split of the creator share, in hundredths of a percent (9000 = 90/10)
  uint256 flaunchAt;               // 0 for now, or a future start timestamp
  bytes   initialPriceParams;      // pricing config consumed by UsdcMarketCappedPrice
  bytes   feeCalculatorParams;
}

struct WhitelistParams {
  bytes32 merkleRoot;              // zero for an open launch
  string  merkleIPFSHash;
  uint256 maxTokens;
}

struct AirdropParams {                 // zero values for no launch airdrop
  uint256 airdropIndex;
  uint256 airdropAmount;
  uint256 airdropEndTime;
  bytes32 merkleRoot;
  string  merkleIPFSHash;
}

struct TreasuryManagerParams {         // zero manager for a standard launch (the app passes none)
  address manager;
  address permissions;
  bytes   initializeData;
  bytes   depositData;
}

Always compute the transaction value with calculateFee(premineAmount, slippageBps, initialPriceParams), even with zero premine: it covers the premine purchase when there is one, and the flaunch fee that applies to initial market caps at or above the on-chain threshold. Sending less reverts with InsufficientFlaunchFee.

Supply is fixed at 100 billion per coin; the Flaunch NFT is the revenue claim itself, held by the creator (for launches that configure revenue splits, the zap deposits it into the split manager instead). Simulate before sending (the app does) so a launch that would revert never costs gas, and read the coin address from the simulated memecoin_ return value.

Token images and metadata

tokenUri should resolve to standard token metadata JSON. Our API exposes the same upload path the app uses: POST https://api.ubi.fun/upload takes a multipart image file plus the metadata text fields (including optional website, twitter, telegram, discord links, which surface on the market APIs), pins both, and returns { tokenUri, image } as ipfs:// URIs; pass that tokenUri straight into FlaunchParams. IP rate limited. You are equally welcome to host metadata yourself on IPFS.

After the launch

Watch for your PoolCreated event to get the coin address, pool id, and treasury (see Contracts and events); the coin is tradeable immediately at the fair launch price. The REST data API picks it up within seconds.

For the parts of launching that are product decisions rather than contract mechanics (fair launch sizing, anti-sniper behavior, revenue splits, X handle claims), the creator docs cover them: Launch a coin, Anti-sniper protection, Revenue splits.

Was this page helpful?