Graduation
Track the transition from curve trading to a Uniswap V4 pool.
Understand the launch status
Graduation closes curve trading and moves liquidity toward a Uniswap V4 pool. A buy that exhausts the sellable supply attempts the first step automatically; pool creation is a separate transaction.
notGraduated: use the curve whilegraduationReadyis false. Once ready, curve trading stops.swept: assets have left the curve; the V4 pool is not ready yet.poolCreated: use the V4 pool for trading. Curve trading remains closed.emergencyExited: use the active EmergencyDistributor for redemption.
Complete Graduation when needed
Most integrations only need to display the current status. If your application offers a completion action, both Graduation and pool creation are permissionless. Read the state before submitting:
1. Complete the curve sweep
import { launchpadGraduateIsIdempotentSuccess } from "@masterpeach/launchpad-sdk";
const state = await client.getTokenState(token, {
blockNumber: await publicClient.getBlockNumber(),
});
if (state.graduation.status === "notGraduated" && state.curveState.graduationReady) {
try {
const prepared = await client.prepareGraduate(token);
const hash = await client.send(prepared);
const result = await client.wait(hash, { confirmations: chain.confirmations });
if (result.status !== "confirmed") throw new Error("Graduation reverted");
} catch (error) {
const { status } = await client.getGraduation(token);
if (!launchpadGraduateIsIdempotentSuccess(status)) throw error;
}
}2. Create the V4 pool
Run this when the refreshed status is swept. Pool creation is a separate transaction; another caller may complete it first, so refresh the status after a failure before offering a retry.
AutoGraduationFailed does not revert a successful buy or token creation. Refresh the status before offering a retry. Another transaction may already have completed the step.
Resume trading or recover
If pool creation fails, assets remain in GraduationExecutor and the launch stays swept. Retry pool creation. The seven-day Emergency Exit delay starts at sweptAt.
After poolCreated, client.getPoolId(token) returns the V4 pool ID; before then it returns bytes32(0). Route trading to the pool. Curve trading is permanently closed and returns LaunchpadTradingClosedError.
Continue trading through the Aggregator after pool creation. For routing in both stages, seeTrading before and after graduation
Uniswap V4 Hooks
Pool creation and Aggregator route availability are separate conditions. Continue with Pool structure for PoolKey/poolId and Trading integration for post-graduation execution.
Direct contract calls
SDK equivalents: getGraduation, prepareGraduate and prepareCreateGraduatedPool. Use LaunchFactory as the public transaction entry; the coordinator and executor implement the internal lifecycle.
Factory.graduations(address token) returns (uint8 status, uint64 sweptAt, uint256 tokenAmount, uint256 quoteAmount, uint256 positionId). Status: 0 NotGraduated, 1 Swept, 2 PoolCreated, 3 EmergencyExited.
Factory.graduate(address token): permissionless first step when the curve is ready and status is 0. A boundary buy may already perform it. If automatic graduation fails, the buy can still succeed; inspect its events and refresh state before retrying.Factory.createGraduatedPool(address token) → uint256 positionId: permissionless second step from status 1. No user token approval is required for either graduation call.After graduation, stop calling the old curve for trades. Read
MemeHook.poolForToken(token)andpoolConfig(poolId), then use a supported V4 Router or Arc Aggregator route. See V4 trading integration for PoolKey, swap and hookData examples. Hook callbacks are invoked by PoolManager.
Last updated
Was this helpful?