Skip to main content

Documentation Index

Fetch the complete documentation index at: https://actfun.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Calling createToken on the LaunchpadFactory deploys two contracts at once: a LaunchToken ERC-20 and a TokenLauncher that handles Phase 1 mining and Phase 2 trading. The factory registers both addresses in its on-chain token list and transfers mint authority to the launcher. You pay a creation fee (denominated in ARC) as msg.value to prevent spam deployments.

Function signature

function createToken(
    string  calldata name,
    string  calldata symbol,
    string  calldata imageUri,
    uint256 maxSupply,
    uint256 mineAmount,
    uint256 cooldown,
    uint256 dailyMax,
    uint256 feePerMine
) external payable returns (address tokenAddr, address launcherAddr)
Contract: LaunchpadFactory at 0x6Ac3CaF79A5d68D259795380F012f922476A1721 on Arc Testnet (Chain ID 5042002)

Required value

You must send at least creationFee() ARC with the call. Read the current fee before submitting:
uint256 fee = LaunchpadFactory(factory).creationFee();
The entire msg.value is forwarded to the protocol feeRecipient. If you send more than the minimum the excess is also forwarded there is no refund mechanism in the factory.
Call creationFee() immediately before building your transaction. The owner can update the fee at any time and your transaction will revert with "LaunchpadFactory: creation fee required" if msg.value falls short.

Parameters

name
string
required
Human-readable token name, e.g. "DogeFun". Must be non-empty.
symbol
string
required
Ticker symbol, e.g. "DOGEFUN". Must be non-empty.
imageUri
string
required
URL or emoji used as the token’s avatar in the UI, e.g. "https://example.com/doge.png" or "🐶". Can be an empty string the contract does not validate it.
maxSupply
uint256
required
Total token supply cap in token units with 18 decimals. For example, one million tokens is 1_000_000 * 1e18. Must be greater than zero.
mineAmount
uint256
required
Tokens minted to the caller on each successful mine() call, in units with 18 decimals. Must be greater than zero and less than or equal to maxSupply.
cooldown
uint256
required
Per-wallet cooldown in seconds between consecutive mine() calls. Must be greater than zero. Set to 60 for a one-minute cooldown.
dailyMax
uint256
required
Maximum tokens a single wallet may mine within any rolling 24-hour window, in units with 18 decimals. Must be greater than or equal to mineAmount, meaning each wallet can mine at least once per day.
feePerMine
uint256
required
ARC (in wei) the caller must send with each mine() call. These fees accumulate in the TokenLauncher and seed the AMM liquidity pool on graduation. Set to 0 for free mining (though the factory’s creation fee still applies).

Return values

tokenAddr
address
Address of the newly deployed LaunchToken ERC-20 contract.
launcherAddr
address
Address of the newly deployed TokenLauncher contract. This is the only address that can mint tokenAddr tokens.

Validation rules

The factory enforces the following checks and reverts with the shown messages if any fail:
ConditionRevert message
msg.value >= creationFee"LaunchpadFactory: creation fee required"
maxSupply > 0"LaunchpadFactory: maxSupply must be > 0"
mineAmount > 0 && mineAmount <= maxSupply"LaunchpadFactory: invalid mineAmount"
cooldown > 0"LaunchpadFactory: cooldown must be > 0"
dailyMax >= mineAmount"LaunchpadFactory: dailyMax < mineAmount"
bytes(name).length > 0 && bytes(symbol).length > 0"LaunchpadFactory: empty name/symbol"

TokenCreated event

event TokenCreated(
    address indexed tokenAddress,
    address indexed launcherAddress,
    address indexed creator,
    string  name,
    string  symbol,
    string  imageUri,
    uint256 maxSupply,
    uint256 feePerMine
);
The event is emitted at the end of a successful createToken call. Index on creator to find all tokens launched by a particular address.
mineAmount, cooldown, and dailyMax are not included in the event. Read them from the TokenRecord returned by getToken(index) or directly from the TokenLauncher contract’s immutable public state variables.

Code example

import { createWalletClient, createPublicClient, http, parseEther, parseUnits } from "viem";
import { arcTestnet } from "./chains";
import { FACTORY_ABI, FACTORY_ADDRESS } from "./contracts";

const publicClient = createPublicClient({
  chain: arcTestnet,
  transport: http(),
});

const walletClient = createWalletClient({
  chain: arcTestnet,
  transport: http(),
  account: myAccount,
});

// 1. Read the current creation fee
const creationFee = await publicClient.readContract({
  address: FACTORY_ADDRESS,
  abi: FACTORY_ABI,
  functionName: "creationFee",
});

// 2. Submit the transaction
const hash = await walletClient.writeContract({
  address: FACTORY_ADDRESS,
  abi: FACTORY_ABI,
  functionName: "createToken",
  args: [
    "DogeFun",                   // name
    "DOGEFUN",                   // symbol
    "https://example.com/doge.png", // imageUri
    parseUnits("1000000", 18),   // maxSupply: 1,000,000 tokens
    parseUnits("100", 18),       // mineAmount: 100 tokens per mine
    60n,                         // cooldown: 60 seconds
    parseUnits("500", 18),       // dailyMax: 500 tokens per 24h
    parseEther("0.01"),          // feePerMine: 0.01 ARC
  ],
  value: creationFee,
});

// 3. Wait for the receipt and decode the TokenCreated event
const receipt = await publicClient.waitForTransactionReceipt({ hash });
const log = receipt.logs[0]; // TokenCreated is the first event
Parse the TokenCreated event log using viem’s decodeEventLog with the factory ABI to extract tokenAddress and launcherAddress without a secondary getTokenCount() call.