Skip to main content

Overview

Token creation on KasFun requires a platform signature — you cannot call createToken() directly without one. This is by design: all tokens should be created through the kas.fun website.
Token creation is designed to be done through the KasFun website at kas.fun/create-token. The platform signature ensures metadata integrity and prevents spam.

How It Works

1

Prepare (via KasFun)

The user fills in token details (name, symbol, icon, description) on kas.fun. The platform generates a signature authorizing the creation.
2

On-Chain Transaction

The user’s wallet calls MemeFactory.createToken(params) with the signed parameters. This is a payable call — it requires a creation fee.
3

Token Deployed

MemeFactory deploys an ERC-20 token, sets up the bonding curve pool, and emits a Created event.

createToken Parameters

struct CreateTokenParams {
    string name;           // Token name
    string symbol;         // Token symbol
    string metadataUri;    // IPFS/S3 metadata URL
    uint256 creatorBuyAmount; // Optional: buy tokens at creation (wei)
    bytes32 salt;          // For deterministic address (vanity address)
    uint256 nonce;         // Anti-replay
    uint256 deadline;      // Signature expiry (unix timestamp)
    bytes signature;       // Platform EIP-712 signature
}

Creation Fee

The contract charges a creation fee in KAS. Query it via:
const fee = await factory.creationFee();
console.log("Creation fee:", ethers.formatEther(fee), "KAS");
If creatorBuyAmount > 0, the transaction value must be creationFee + creatorBuyAmount.

Token Address

All KasFun tokens have addresses ending in 7777 (vanity address). The address is deterministic — computed from the salt and creator address:
const predictedAddress = await factory.computeTokenAddress(salt, creatorAddress);

Created Event

event Created(
    address indexed token,
    address indexed creator,
    uint256 indexed tokenId,
    address pool,
    string name,
    string symbol
);
Listen for new token creations:
factory.on("Created", (token, creator, tokenId, pool, name, symbol) => {
  console.log(`New token: ${name} (${symbol}) at ${token}`);
});