DEVELOPERS / LAUNCH
Launching a token
ABIs live in contracts/abi/, one JSON per contract. Addresses come from
config.js, where anything not deployed is null, so every snippet below starts
by refusing to run without one.
Model V2
ethers v6 · AgiV2LaunchFactory
const FACTORY = window.AGI_CONFIG.contracts.launchpad.v2.factory; // null if not deployed
if (!FACTORY) throw new Error('AGI Launchpad V2 is not open yet');
const factory = new ethers.Contract(FACTORY, FACTORY_ABI, signer);
// 1. Pick a config and a quote asset. address(0) = native ETH.
const configId = 0n;
const pairToken = ethers.ZeroAddress;
const cfg = await factory.getLaunchConfig(configId); // supply, curveFeeBps, phantomQuote,
// graduationThreshold, poolFee,
// tickSpacing, enabled
if (!cfg.enabled) throw new Error('launch config disabled');
// 2. Pin the terms you were quoted. Zero waives the check.
const economics = await factory.previewLaunchEconomics(configId, pairToken);
const params = {
name: 'My Token',
symbol: 'MYT',
logo: 'https://.../logo.webp',
description: 'What it is.',
socials: { twitter: '', telegram: '', discord: '', website: '', farcaster: '' },
creatorFeeRecipient: await signer.getAddress(),
creatorTaxBps: 100, // 1%; ceiling is factory.maxCreatorTaxBps()
buybackEnabled: false, // always false on the AGI Launchpad
expectedEconomics: economics,
salt: ethers.hexlify(ethers.randomBytes(32)),
};
// 3. Optional: know the addresses before you send.
const deployer = await factory.launchDeployer();
// AgiV2LaunchDeployer.predictLaunchAddresses(deployment) -> (token, curve)
// 4. Send. msg.value must equal launchFee() exactly.
const fee = await factory.launchFee();
const tx = await factory['launchToken((string,string,string,string,(string,string,string,string,string),address,uint16,bool,bytes32,bytes32),uint256,address,address[])'](
params, configId, pairToken, [], // up to 32 snipe-tax exemptions
{ value: fee }
);
const receipt = await tx.wait(); // TokenLaunched(token, curve, deployer, ...)
The three-argument overload without the exemption list behaves identically; the launching account and its
fee recipient are exempted either way. Common reverts: LaunchFeeNotPaid (value must equal the
fee, not merely cover it), NotWhitelisted (launching is closed to the public — which is the case today: only the team wallet can launch),
CreatorTaxTooHigh, LaunchEconomicsMismatch (the terms moved after your preview)
and PairTokenNotApproved.
Model V1
ethers v6 · AgiLaunchFactory
const FACTORY = window.AGI_CONFIG.contracts.launchpad.v1.factory; // null if not deployed
if (!FACTORY) throw new Error('AGI Launchpad V1 is not open yet');
const factory = new ethers.Contract(FACTORY, FACTORY_V1_ABI, signer);
const fee = await factory.launchFee();
const openingBuy = ethers.parseEther('0.05'); // anything above the fee is spent buying
const params = {
name: 'My Token',
symbol: 'MYT',
logo: 'https://.../logo.webp',
description: 'What it is.',
socials: { twitter: '', telegram: '', discord: '', website: '', farcaster: '' },
feeWallet: await signer.getAddress(), // receives LP fees and the opening buy
};
const tx = await factory.launchToken(
params,
0n, // launchConfigId
0n, // dexId
ethers.hexlify(ethers.randomBytes(32)), // salt
{ value: fee + openingBuy }
);