合约接口
单体工厂(AI 发币):0x9FBb5858739E47940729cB824F600C5d6b9484F2(BSC 主网)
模块化工厂(实验):0x008ACDd9b294f854f4b504755E33221663E0FEC3
工厂合约
createToken
function createToken(
string name,
string symbol,
string meta, // JSON 字符串:{img,desc,x,tg,web}
address quote, // 0x0 = BNB,否则为 ERC20
uint256 creatorBuy, // 创建者首买金额(wei),最多 5%
bytes32 salt, // 靓号 salt;0x0 表示随机地址
Cfg cfg // 机制配置(32 个字段,见下)
) payable returns (address token)
Cfg 关键字段:buyTaxBps/sellTaxBps(≤1000)、transferTaxBps、
maxTxBps/maxWalletBps、snipeBlocks/snipeMaxWei、buybackBps/dividendBps/jackpotBps、
burnBps/lpBps/creatorBps/referralBps、progTaxEndBps、burnAtQuote/burnAtBps、
holdDiscountDays/Bps、rampDays/rampStartBps、cliffDays/vestDays、
nftGate、whitelistUntil、gradTarget、recips[]/shares[](shares 合计 10000)。
V19 模块化工厂额外接口
function deploy(bytes code, bytes args, bytes32 salt) payable returns (address) function approveCode(bytes32 codeHash, bool allow) // 仅平台 function approved(bytes32) view returns (bool)
code 必须是平台登记过的拼装字节码(keccak256(code) 在白名单里);args 是构造参数,不参与白名单。当前登记 84 个组合(12 个机制模块)。
msg.value 需 ≥ 创建费(普通 0.001 / 靓号 0.002 BNB),多余部分在首买后自动退回。
模块安全:所有模块的 4 个钩子(onTax/onBuy/onSell/onGraduated)都带 require(msg.sender == token) 校验,token 在构造时写入模块(address(this));用户入口(claim() / 回购 execute())保持公开。
只读接口
| 函数 | 说明 |
|---|---|
tokenCount() | 已发币总数 |
list(from,n) | 分页取代币地址 |
creationFee() / vanityFee() | 普通 / 靓号创建费 |
platform() | 平台费收款地址 |
predictAddress(...) | 预测 CREATE2 地址(前端自检用) |
tokenCodeHash() | 代币创建字节码哈希(版本一致性检测) |
事件
event TokenCreated( address indexed token, address indexed creator, string name, string symbol, address quote, bool vanity );
代币合约
交易
| 函数 | 说明 |
|---|---|
buy(uint256 minOut) payable | BNB 买入,minOut 防滑点 |
buyWithToken(uint256 qIn,uint256 minOut) | ERC20 底池币买入(需先 approve) |
sell(uint256 tokensIn,uint256 minQuote) | 卖出,毕业后 revert |
quoteBuy(uint256 qIn) | 报价(含 1% 费) |
状态
| 函数 | 说明 |
|---|---|
price() | 当前单价(wei / 枚) |
realQuote() / sold() | 已募集 / 已售出 |
graduated() | 是否已毕业 |
quote() | 底池币地址(0x0 = BNB) |
creator() / meta() | 创建者 / 元数据 JSON |
SALE / TOTAL / GRAD_QUOTE | 常量:8 亿 / 10 亿 / 15 BNB |
CREATOR_CAP | 首买上限(5%) |
事件
event Buy(address indexed buyer, uint256 qIn, uint256 out, uint256 price); event Sell(address indexed seller, uint256 inQ, uint256 out); event Graduated(address pair, uint256 q, uint256 t); event Transfer(address indexed from, address indexed to, uint256 value);
代码示例(ethers v6)
import { JsonRpcProvider, Contract, formatEther } from "ethers";
const provider = new JsonRpcProvider("https://bsc-dataseed.bnbchain.org", 56);
const token = new Contract(tokenAddress, [
"function price() view returns (uint256)",
"function realQuote() view returns (uint256)",
"function quoteBuy(uint256) view returns (uint256)"
], provider);
const price = await token.price(); // wei / 枚
const raised = await token.realQuote(); // 已募集
console.log(formatEther(price), formatEther(raised));
Contracts
Monolithic factory (AI launches): 0x9FBb5858739E47940729cB824F600C5d6b9484F2 (BSC mainnet)
Modular factory (experimental): 0x008ACDd9b294f854f4b504755E33221663E0FEC3
Download factory ABI · Download token ABI
Factory
createToken
function createToken(
string name,
string symbol,
string meta, // JSON: {img,desc,x,tg,web}
address quote, // 0x0 = BNB, otherwise ERC20
uint256 creatorBuy, // first buy in wei, capped at 5%
bytes32 salt, // vanity salt; 0x0 = random
Cfg cfg // mechanics config (32 fields)
) payable returns (address token)
Cfg covers tax caps, tx/wallet limits, anti-snipe, distribution splits, vesting,
NFT gate, whitelist, and recips[]/shares[] (shares sum = 10000).
V19 modular factory
function deploy(bytes code, bytes args, bytes32 salt) payable returns (address) function approveCode(bytes32 codeHash, bool allow) // platform only function approved(bytes32) view returns (bool)
keccak256(code) must be whitelisted by the platform; args is not part of the whitelist key.
msg.value must cover the creation fee (0.001 normal / 0.002 vanity); excess is refunded after the first buy.
Read methods
| Function | Description |
|---|---|
tokenCount() | Total tokens |
list(from,n) | Paginated addresses |
creationFee() / vanityFee() | Creation fees |
platform() | Fee receiver |
predictAddress(...) | Predict CREATE2 address |
tokenCodeHash() | Token bytecode hash |
Events
event TokenCreated(address indexed token, address indexed creator, string name, string symbol, address quote, bool vanity);
Token
Trading
| Function | Description |
|---|---|
buy(uint256 minOut) payable | Buy with BNB |
buyWithToken(uint256 qIn,uint256 minOut) | Buy with ERC20 quote |
sell(uint256 tokensIn,uint256 minQuote) | Sell; reverts after graduation |
quoteBuy(uint256 qIn) | Quote incl. 1% fee |
State
| Function | Description |
|---|---|
price() | Price in wei per token |
realQuote() / sold() | Raised / sold |
graduated() | Graduation status |
quote() | Quote token |
SALE / TOTAL / GRAD_QUOTE | 800M / 1B / 15 BNB |
Events
event Buy(address indexed buyer, uint256 qIn, uint256 out, uint256 price); event Sell(address indexed seller, uint256 inQ, uint256 out); event Graduated(address pair, uint256 q, uint256 t);
Example (ethers v6)
import { JsonRpcProvider, Contract, formatEther } from "ethers";
const provider = new JsonRpcProvider("https://bsc-dataseed.bnbchain.org", 56);
const token = new Contract(tokenAddress, [
"function price() view returns (uint256)",
"function realQuote() view returns (uint256)"
], provider);
console.log(formatEther(await token.price()));