StablexFactory
—Deploy tokens + bonding curves via CREATE2
Integration
Integrate StableX Launch on Stable Chain — launch tokens, trade on the bonding curve, and route post-graduation swaps through Uniswap V3 or StableX.
Deploy tokens + bonding curves via CREATE2
Post-graduation Uniswap V3 buy/sell routing
Migrates curve liquidity to Uniswap V3 on graduation
Each launch also deploys a unique BondingCurve and Hoodx via CREATE2. Token addresses always end in …988.
StablexFactory.createLaunch to deploy curve + token.collectFees() has no time gate): token side burned, WETH side split 80% creator / 20% platform on each collect.StablexDexRouter for V3 buys/sells or trade via StableX.Fees & custody. StableX is non-custodial — every create, buy, sell, and graduation runs on-chain straight from your wallet, and the platform contract never holds your funds. Fees settle directly: the 0.0005 USDT0 launch fee and the platform's 1% of the 2% curve trade tax go to the fee wallet, the creator's matching 1% to the creator, and the graduation cut splits per the waterfall above. Because the LP is locked without a time gate, the position itself can never be withdrawn — only its trading fees are ever collected, and those keep flowing 80% creator / 20% platform.
Call createLaunch on the launchpad. Pay at least 0.0005 USDT0 launch fee; any extra USDT0 in the same tx is used as an optional creator dev-buy.
// HoodxFactory.createLaunch
function createLaunch(
string name,
string symbol,
string metadataURI, // ipfs:// or https:// JSON with name, symbol, image, socials
uint256 minTokensOut, // slippage guard for optional dev-buy (0 if no dev-buy)
bytes32 curveSalt, // CREATE2 salt — curve address must end in 988
bytes32 tokenSalt // CREATE2 salt — token address must end in 988
) external payable returns (address curve, address token);
// Example (viem / wagmi)
await writeContract({
address: "",
abi: launchpadAbi,
functionName: "createLaunch",
args: [name, symbol, metadataURI, 0n, curveSalt, tokenSalt],
value: parseEther("0.0005"), // launch fee only
});Read launch metadata: launchpad.launches(launchId) or launchpad.curveToLaunchId(curve). Resolve token → curve: Stablex(token).curve().
Send USDT0 to the curve's buy function. 2% fee is taken (1% platform USDT0 + 1% creator USDT0 accrued from curve trading).
// BondingCurve.buy — curve must not be graduated
function buy(uint256 minTokensOut) external payable;
await writeContract({
address: curveAddress,
abi: bondingCurveAbi,
functionName: "buy",
args: [minTokensOut],
value: parseEther("0.1"),
});
// Quote before sending
const [tokensOut] = await readContract({
address: curveAddress,
abi: bondingCurveAbi,
functionName: "quoteBuy",
args: [parseEther("0.1")],
});Approve the curve to spend tokens, then call sell.
// 1. Approve curve to spend tokens
await writeContract({
address: tokenAddress,
abi: erc20Abi,
functionName: "approve",
args: [curveAddress, tokenAmount],
});
// 2. Sell
function sell(uint256 tokenAmount, uint256 minEthOut) external;
await writeContract({
address: curveAddress,
abi: bondingCurveAbi,
functionName: "sell",
args: [tokenAmount, minEthOut],
});Once curve.graduated() == true, use StablexDexRouter. The router executes the Uniswap V3 swap and records volume on the curve for the activity feed.
const DEX_ROUTER = "0x92bca96C1f8579399Ae583efF1bCc3DdBcDeBc7C";
// Buy with USDT0
function uniBuy(address curve, uint256 minTokensOut) external payable;
await writeContract({
address: DEX_ROUTER,
abi: dexRouterAbi,
functionName: "uniBuy",
args: [curveAddress, minTokensOut],
value: parseEther("0.1"),
});
// Sell tokens — approve DEX_ROUTER first, then:
function uniSell(address curve, uint256 tokenAmount, uint256 minEthOut) external;
await writeContract({
address: DEX_ROUTER,
abi: dexRouterAbi,
functionName: "uniSell",
args: [curveAddress, tokenAmount, minEthOut],
});// BondingCurve views
curve.token() // Hoodx address
curve.creator() // launch creator
curve.graduated() // true after migration
curve.uniswapPool() // V3 pool (zero before grad)
curve.currentPrice() // spot price in wei per token
curve.tokensRemaining() // unsold sale inventory (800M cap)
curve.ethCollected() // net USDT0 in curve
curve.tokensSold()
curve.graduationTarget() // 4.2 USDT0 target
// Hoodx
token.curve() // bonding curve address
token.claimCreatorFees() // anyone can trigger 80% burn / 20% USDT0 swapPre-graduation trades emit on the curve contract:
event Buy(address indexed buyer, uint256 ethIn, uint256 tokensOut, uint256 newPrice);
event Sell(address indexed seller, uint256 tokensIn, uint256 ethOut, uint256 newPrice);
event DevBuy(address indexed creator, uint256 ethIn, uint256 tokensOut, uint256 newPrice);
event Graduated(address pool, uint256 ethLiquidity, uint256 tokenLiquidity, uint256 ethToDev);
// Launchpad
event LaunchCreated(uint256 indexed launchId, address curve, address token, address creator, string name, string symbol);Fetch historical logs via Blockscout: GET /api/v2/addresses/{curve}/logs