{"skill":{"slug":"nadfun-skill","displayName":"Nadfun Skill","summary":"Launch, trade, and monitor Monad blockchain tokens using bonding curves, permit signatures, and on-chain event queries with viem integration.","description":"# NadFun Integration Guide\n\nMonad blockchain token launchpad with bonding curves. Trade tokens, launch your own, monitor events—all with pure viem.\n\n## Skills\n\n| Module           | Purpose                                | URL                                                  |\n| ---------------- | -------------------------------------- | ---------------------------------------------------- |\n| **skill.md**     | Architecture, constants, setup         | [nad.fun/skill.md](https://nad.fun/skill.md)         |\n| **ABI.md**       | Smart contract ABIs                    | [nad.fun/abi.md](https://nad.fun/abi.md)             |\n| **QUOTE.md**     | Price quotes, curve state              | [nad.fun/quote.md](https://nad.fun/quote.md)         |\n| **TRADING.md**   | Buy, sell, permit signatures           | [nad.fun/trading.md](https://nad.fun/trading.md)     |\n| **TOKEN.md**     | Balances, metadata, transfers          | [nad.fun/token.md](https://nad.fun/token.md)         |\n| **CREATE.md**    | Token creation, image upload           | [nad.fun/create.md](https://nad.fun/create.md)       |\n| **INDEXER.md**   | Historical event querying              | [nad.fun/indexer.md](https://nad.fun/indexer.md)     |\n| **AGENT-API.md** | REST API, API key management           | [nad.fun/agent-api.md](https://nad.fun/agent-api.md) |\n| **WALLET.md**    | Wallet generation                      | [nad.fun/wallet.md](https://nad.fun/wallet.md)       |\n| **AUSD.md**      | LiFi swap (MON → aUSD) + Upshift vault | [nad.fun/ausd.md](https://nad.fun/ausd.md)           |\n\n## Network Constants\n\n```typescript\nconst NETWORK = \"testnet\" // 'testnet' | 'mainnet'\n\nconst CONFIG = {\n  testnet: {\n    chainId: 10143,\n    rpcUrl: \"https://monad-testnet.drpc.org\",\n    apiUrl: \"https://dev-api.nad.fun\",\n    DEX_ROUTER: \"0x5D4a4f430cA3B1b2dB86B9cFE48a5316800F5fb2\",\n    BONDING_CURVE_ROUTER: \"0x865054F0F6A288adaAc30261731361EA7E908003\",\n    LENS: \"0xB056d79CA5257589692699a46623F901a3BB76f1\",\n    CURVE: \"0x1228b0dc9481C11D3071E7A924B794CfB038994e\",\n    WMON: \"0x5a4E0bFDeF88C9032CB4d24338C5EB3d3870BfDd\",\n    V3_FACTORY: \"0xd0a37cf728CE2902eB8d4F6f2afc76854048253b\",\n    CREATOR_TREASURY: \"0x24dFf9B68fA36f8400302e2babC3e049eA19459E\",\n  },\n  mainnet: {\n    chainId: 143,\n    rpcUrl: \"https://monad-mainnet.drpc.org\",\n    apiUrl: \"https://api.nadapp.net\",\n    DEX_ROUTER: \"0x0B79d71AE99528D1dB24A4148b5f4F865cc2b137\",\n    BONDING_CURVE_ROUTER: \"0x6F6B8F1a20703309951a5127c45B49b1CD981A22\",\n    LENS: \"0x7e78A8DE94f21804F7a17F4E8BF9EC2c872187ea\",\n    CURVE: \"0xA7283d07812a02AFB7C09B60f8896bCEA3F90aCE\",\n    WMON: \"0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A\",\n    V3_FACTORY: \"0x6B5F564339DbAD6b780249827f2198a841FEB7F3\",\n    CREATOR_TREASURY: \"0x42e75B4B96d7000E7Da1e0c729Cec8d2049B9731\",\n  },\n}[NETWORK]\n```\n\n## Basic Setup\n\n```typescript\nimport { createPublicClient, createWalletClient, http } from \"viem\"\nimport { privateKeyToAccount } from \"viem/accounts\"\n\nconst chain = {\n  id: CONFIG.chainId,\n  name: \"Monad\",\n  nativeCurrency: { name: \"MON\", symbol: \"MON\", decimals: 18 },\n  rpcUrls: { default: { http: [CONFIG.rpcUrl] } },\n}\n\nconst account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`)\n\nconst publicClient = createPublicClient({\n  chain,\n  transport: http(CONFIG.rpcUrl),\n})\n\nconst walletClient = createWalletClient({\n  account,\n  chain,\n  transport: http(CONFIG.rpcUrl),\n})\n```\n\n## Core Concepts\n\n### Bonding Curve\n\nTokens start on a bonding curve. Price increases as more buy. Check state with `getCurveState(token)`.\n\n### Graduation\n\nWhen target reserves reached: curve → Uniswap V3 DEX. Check `isGraduated(token)` or `getProgress(token)` (0-10000 = 0-100%).\n\n### Permit Signatures (EIP-2612)\n\nSign approval off-chain for gasless approve: `generatePermitSignature()` → use in `sellPermit()`.\n\n### Action IDs\n\nAlways use `actionId: 1` for token creation.\n\n## Authentication (Login Flow)\n\n**Login is NOT required for any functionality.** All trading, token creation, and queries work without login.\n\nLogin is ONLY needed to manage API keys (create/list/delete). See `AGENT-API.md` for:\n\n- Rate limits (10 req/min without key, 100 req/min with key)\n- API key CRUD operations\n\nCookie name: `nadfun-v3-api`\n\n```typescript\n// 1. Request nonce\nconst { nonce } = await fetch(`${CONFIG.apiUrl}/auth/nonce`, {\n  method: \"POST\",\n  headers: { \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({ address: account.address }),\n}).then((r) => r.json())\n\n// 2. Sign nonce\nconst signature = await walletClient.signMessage({ message: nonce })\n\n// 3. Create session\nconst sessionRes = await fetch(`${CONFIG.apiUrl}/auth/session`, {\n  method: \"POST\",\n  headers: { \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({ signature, nonce, chain_id: CONFIG.chainId }),\n})\n// Cookie: nadfun-v3-api=<token>\nconst cookies = sessionRes.headers.get(\"set-cookie\")\n\n// 4. Use session for API key management\nawait fetch(`${CONFIG.apiUrl}/api-key`, {\n  headers: { Cookie: cookies },\n})\n```\n\n## Common Pitfalls\n\n- **Gas estimation**: Always `estimateContractGas()` before sending. Never hardcode gas limits.\n- **Deadline**: Must be future timestamp. Use `BigInt(Math.floor(Date.now() / 1000) + 300)` (5 min).\n- **Slippage**: Calculate `amountOutMin` with buffer. `(amountOut * 99n) / 100n` = 1% slippage.\n- **Permit nonce**: Fetch immediately before signing. Stale nonce = tx revert.\n\n## Common ABI Errors\n\n| Error                | Meaning                        |\n| -------------------- | ------------------------------ |\n| `InsufficientAmount` | Output < amountOutMin          |\n| `DeadlineExpired`    | Deadline passed                |\n| `AlreadyGraduated`   | Token on DEX                   |\n| `BondingCurveLocked` | Curve locked during graduation |\n| `InvalidProof`       | Bad merkle proof (claims)      |\n\n## Installation\n\n```bash\nnpm install viem\n```\n","tags":{"latest":"0.1.0"},"stats":{"comments":0,"downloads":2165,"installsAllTime":81,"installsCurrent":0,"stars":2,"versions":1},"createdAt":1770200820102,"updatedAt":1779076646222},"latestVersion":{"version":"0.1.0","createdAt":1770200820102,"changelog":"nadfun-skill 0.1.0 – Initial Release\n\n- Adds integration guide for NadFun Monad blockchain token launchpad.\n- Documents core modules: trading, quoting, token creation, event indexer, wallet, and more.\n- Provides setup instructions, including viem client configuration and network constants.\n- Explains bonding curve mechanics, graduation to DEX, permit signatures, and login flow for API key management.\n- Lists common pitfalls, ABI errors, and installation steps for quick onboarding.","license":null},"metadata":null,"owner":{"handle":"zaki9501","userId":"s1795katyjfe4mjh624pqw4c6s8853j1","displayName":"zaki9501","image":"https://avatars.githubusercontent.com/u/80619916?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1779947114011}}