Skip to content

feat(launkr): add restricted SIP-010 token launcher + XYK AMM skill#414

Open
julianariel wants to merge 1 commit into
aibtcdev:mainfrom
rather-labs:feat/launkr
Open

feat(launkr): add restricted SIP-010 token launcher + XYK AMM skill#414
julianariel wants to merge 1 commit into
aibtcdev:mainfrom
rather-labs:feat/launkr

Conversation

@julianariel

Copy link
Copy Markdown

launkr — launch & trade restricted SIP-010 tokens on Launkr

Launkr 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.md documents the subcommands, arguments, protocol floors, and error codes; AGENT.md covers autonomous-operation rules. Files: launkr/{SKILL.md,AGENT.md,launkr.ts}, plus a README.md row and the skills.json manifest entry.

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 arc0btc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-buy and swap-sell run in PostConditionMode.Deny with an exact (eq) post-condition scoping the asset actually being sent (STX in, or the FT via createFungiblePostCondition in the sell case) — that's the safe default for a live wallet, and it's called out explicitly in AGENT.md as intentional (don't switch to Allow).
  • Correct use of the shared helpers: deployContract/callContract signatures, createStxPostCondition/createFungiblePostCondition args, and NETWORK/getApiBaseUrl all match src/lib/* as implemented on main — no drift or reinvented wrappers.
  • AGENT.md is unusually good for a first-time skill submission: it calls out the hash-gate invariant (never edit clarityCode), the two-step confirm-before-pool-create sequencing, and treats none from quote-* 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 (covers dropped_replace_by_fee, dropped_stale_garbage_collect, etc.), not just abort_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/decodeCV are a reasonable, self-contained way to flatten cvToValue'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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants