Read launch data
Read drops, pools, and fees from the contracts, and index them from events.
Read a drop
const [creatorFeeRecipient, partnerId, creator, launchedAt] =
await publicClient.readContract({
address: LAUNCHPAD,
abi: launchpadAbi,
functionName: "drops",
args: [token],
});A token that the launchpad did not launch returns zero values. Read the name, symbol, and contractURI() from the token.
Find a pool
poolKey(quote, token) returns the Uniswap v4 pool key of the token's pool with that quote. The pool exists only if
positions(poolId).token is the token.
import { encodeAbiParameters, keccak256 } from "viem";
const key = await publicClient.readContract({
address: LAUNCHPAD,
abi: launchpadAbi,
functionName: "poolKey",
args: [USDC, token],
});
// The pool ID is the keccak256 of the ABI-encoded pool key.
const poolId = keccak256(
encodeAbiParameters(
[
{ type: "address" },
{ type: "address" },
{ type: "uint24" },
{ type: "int24" },
{ type: "address" },
],
[key.currency0, key.currency1, key.fee, key.tickSpacing, key.hooks],
),
);
const [positionToken, tickLower, tickUpper] = await publicClient.readContract({
address: LAUNCHPAD,
abi: launchpadAbi,
functionName: "positions",
args: [poolId],
});
const exists = positionToken === token;To list all pools of a token, read the DropPoolCreated events of the token.
Trade
Drop pools are standard Uniswap v4 pools. To swap, use any Uniswap v4 router, such as the Universal Router, with the pool key above. The hook does not change swap amounts.
Index launches
Index these events to follow all launches. All of them come from the launchpad, except DropSwap.
| Event | Use |
|---|---|
DropCreated | A new token, with its creator, partner, and fee recipient. |
DropPoolCreated | Each pool of a launch, with its pool ID, share, and start price. |
DropSwap (on DropHook) | Every swap in a Drop pool, including dev buys. |
DropPartnerFeesCollected, DropCreatorFeesCollected | Each collection, with each recipient's part. |
FeesClaimed | Each claim. |
PartnerRegistered, PartnerFeeRecipientUpdated | Partners and their recipients. |
CreatorFeeRecipientUpdated | Changes of a drop's creator fee recipient. |
const launches = await publicClient.getContractEvents({
address: LAUNCHPAD,
abi: launchpadAbi,
eventName: "DropCreated",
fromBlock,
toBlock,
});Some notes for indexers:
DropCreateddoes not include the name, symbol, or contract URI. Read them from the token at the launch block.DropSwaphas the swap'samount0andamount1, from the swapper's side. A negative amount is paid into the pool, including the fee. A positive amount is paid out.sqrtPriceX96is the price after the swap.- A collection that finds fees emits both fee events for the pool, even if one part is zero. A collection that finds no
fees emits nothing. In burn mode, the creator part is the amount credited to
0x…dEaD. - Unclaimed credits have no event. Read them with
claimable(recipient, asset).