Creating a Coin

This guide covers coin creation through the BFun Factory contract.

The create flow now uses struct-based APIs. Standard and advanced creation are unified under the same create params.

Create Coin

To create a coin, call createBFunToken.

Method Interface

function createBFunToken(CreateParams calldata params)
    external
    returns (address token);

CreateParams is a unified struct that includes metadata/auth, recipient config, market config, optional lock config, and optional tax config.

For full field definitions and types, refer to the Factory ABI.

Mode Switches (Important)

  • Standard mode: targetRaise == 0 (uses per-collateral defaults)

  • Advanced mode: targetRaise > 0

  • Lock enabled: lockBps > 0

  • Tax enabled: taxRateBps > 0

Supported collateral assets are chain-config driven. On BSC, current options include native BNB (address(0)) and several ERC20 collaterals (for example CAKE / USDT / USD1 / ASTER / U / USDC).

Creation Events

Creation emits NewBFunToken, and also emits parameter snapshot events depending on token mode:

  • NewBFunTokenCurveParams

  • NewBFunTokenDynamicParams

  • NewBFunTaxTokenParams (tax market only)

See ABI for full field definitions.


Create and Buy Coin

To create and do an exact-in first buy in one transaction, call createBFunTokenAndBuy.

Method Interface

Payment Notes

  • Native collateral market (collateralToken == address(0)): msg.value must equal buy.collateralAmountIn.

  • ERC20 collateral market: msg.value must be 0, and caller must approve the Factory for buy.collateralAmountIn.

On successful first buy, the Factory emits Buy.


Basic Create (Standard / Non-tax / Non-lock)

For the simplest create flow, call createBFunTokenBasic.

This entrypoint is a convenience wrapper for standard mode only.


Additional Notes

  • tokenURI: points to metadata (commonly IPFS).

  • tokenSalt: if set to bytes32(0), factory auto-generates deployment salt; otherwise uses the provided deterministic salt.

  • signature: signature checks depend on factory configuration. Integrators should follow the active backend signing policy.

Last updated