Skip to main content
This page collects working snippets you can copy. All examples target the live V2 hook at 0x4cC8F6d5B7cE150CCC0A9B7664532B1283b96AC4 on Ink mainnet.

Preview a buy from cast

Previews use the LaunchViewModule with local state. Read the launch state first, then call previewBuyLocal with the unpacked fields. See Quotes for the full pattern.
Returns four uint256 values: tokensOut, cost, refund, tokensRemaining.

Read launch state from cast

The returned bytes decode to the LaunchConfig struct. For a typed decode, use viem or ethers with the ABI.

Buy with viem

Sell with viem (requires approval first)

Listen for Trade events

Fetch recent V2 tokens from REST

Returns the most recent V2 launches with address, ticker, image URL, and target raise.

Fetch a single token

Returns the token’s full record. Includes the launch_id field if it is a V2 token.

Use the MCP server

After the MCP server is registered: In a Claude Code chat:
The agent calls the MCP tools and returns the JSON responses.

End to end: launch from cast

Easier through the UI or the MCP for one off launches. Direct contract calls are for automation.