feat(launkr): add restricted SIP-010 token launcher + XYK AMM skill#414
feat(launkr): add restricted SIP-010 token launcher + XYK AMM skill#414julianariel wants to merge 1 commit into
Conversation
Adds the `launkr` skill (SKILL.md, AGENT.md, launkr.ts) for launching and trading restricted SIP-010 tokens on the Launkr protected AMM by Rather Labs, plus the README row and skills.json manifest entry. Subcommands: launch (deploy token + open a bonding/direct pool), get-pool, quote-buy, quote-sell, swap-buy, swap-sell. Network follows the shared NETWORK env var; swaps run in Deny mode with scoped post-conditions (exact STX on buy, exact `strategy-token` FT on sell); launch validates mode-specific args and waits for the deploy to confirm before opening the pool. Verified end-to-end against live testnet + mainnet pools (reads) and the Launkr contract source / API (addresses, arg order, fees, floors, error codes). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
arc0btc
left a comment
There was a problem hiding this comment.
Adds launkr — a skill for launching restricted SIP-010 tokens and trading through Launkr's XYK AMM singleton on Stacks. Clean, well-scoped addition that reuses this repo's existing transaction/post-condition/fee helpers rather than reinventing them.
What works well:
- Both
swap-buyandswap-sellrun inPostConditionMode.Denywith an exact (eq) post-condition scoping the asset actually being sent (STX in, or the FT viacreateFungiblePostConditionin the sell case) — that's the safe default for a live wallet, and it's called out explicitly inAGENT.mdas intentional (don't switch toAllow). - Correct use of the shared helpers:
deployContract/callContractsignatures,createStxPostCondition/createFungiblePostConditionargs, andNETWORK/getApiBaseUrlall matchsrc/lib/*as implemented on main — no drift or reinvented wrappers. AGENT.mdis unusually good for a first-time skill submission: it calls out the hash-gate invariant (never editclarityCode), the two-step confirm-before-pool-create sequencing, and treatsnonefromquote-*as "do not proceed" rather than "assume zero." That's exactly the kind of guidance that prevents an agent from doing something costly on a misread.waitForConfirmation's abort-status list is broad (coversdropped_replace_by_fee,dropped_stale_garbage_collect, etc.), not justabort_by_response— good coverage of the ways a Stacks tx can fail to land.
[suggestion] Cross-check the API's returned pool-creation args against what was requested (launkr.ts:866-874, 903)
poolStep.functionArgs comes straight from https://launkr.io/api/launch and is broadcast via create-pool-* without comparing it back to the launchBody that was sent (e.g. feeReceiver, supply). The on-chain hash gate protects the token contract (byte-identical to the template), but nothing protects the pool-creation call itself — if the API ever returned a different feeReceiver than the one requested (bug, cache issue, compromised endpoint), the caller would silently launch a pool that permanently routes 90% of swap fees to an address they didn't choose, and AGENT.md even flags that risk in its "what NOT to do" section without the code enforcing it. A cheap mitigation: assert the feeReceiver (and maybe supply) arg in poolStep.functionArgs matches opts.feeReceiver/opts.supply before calling deployContract, and abort with a clear error if they don't.
[nit] Minor formatting inconsistency in swap-buy/swap-sell: .option("--recipient <address>", ...) and the following .option("--fee <fee>", ...) are glued onto the same line (launkr.ts:1163-1166, 1229), unlike every other option in the file which gets its own line. Harmless, but a prettier/format pass would catch it.
Code quality notes:
unwrapCV/decodeCVare a reasonable, self-contained way to flattencvToValue's{type,value}tree into plain JS without pulling in another dependency — no simplification needed there.- No dead code or unused imports spotted; the three read-only commands (
get-pool/quote-buy/quote-sell) intentionally duplicate the wallet-address-fallback pattern rather than sharing a helper — three call sites is right at the "still fine inline" threshold, wouldn't push for extraction yet.
Big-picture fit: Follows the same shape as bitflow/defi (CLI skill, shared src/lib transaction helpers, README.md + skills.json entries), and the network-selection convention (NETWORK env var, no per-command flag) matches how the rest of the repo's skills already work. No conflicts with anything else in the tree.
Nothing here is blocking — the feeReceiver cross-check is worth doing before agents start using this against mainnet, but it doesn't need to hold up the merge.
launkr— launch & trade restricted SIP-010 tokens on LaunkrLaunkr is a protected token launcher and XYK AMM on Stacks, built by Rather Labs. Each pool trades STX against a restricted SIP-010 token whose transfers are locked to the authorized singleton, so every swap routes through the protocol and captures fees. Tokens launch in one of two pool modes — bonding (virtual reserves, 1% fee, auto-graduates once it crosses its threshold) or direct (real STX seed, 5% fee). Works on mainnet and testnet.
This skill lets an agent (or a user via any LLM client) drive the full lifecycle:
launch— deploy a restricted token (byte-identical to the on-chain template) and open its bonding or direct pool.get-pool— read a pool's mode, reserves, graduation progress, and fee receiver.quote-buy/quote-sell— simulate a trade and get expected output net of fees (no wallet needed).swap-buy/swap-sell— trade STX for tokens and back through the singleton, with slippage guards.SKILL.mddocuments the subcommands, arguments, protocol floors, and error codes;AGENT.mdcovers autonomous-operation rules. Files:launkr/{SKILL.md,AGENT.md,launkr.ts}, plus aREADME.mdrow and theskills.jsonmanifest entry.