Skip to content

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

Closed
julianariel wants to merge 3 commits into
mainfrom
feat/launkr-skill
Closed

feat(launkr): add restricted SIP-010 token launcher + XYK AMM skill#1
julianariel wants to merge 3 commits into
mainfrom
feat/launkr-skill

Conversation

@julianariel

Copy link
Copy Markdown

Adds the launkr skill — launch and trade restricted SIP-010 tokens on the Launkr protected AMM (Stacks): deploy a token, open a bonding or direct pool, quote, and swap STX for tokens via the lp-singleton-v6 singleton. Works on mainnet and testnet.

Files: launkr/{SKILL.md,AGENT.md,launkr.ts}, plus the README.md row and skills.json manifest entry.

Verified against the Launkr source (../launkr)

Cross-checked launkr.ts / SKILL.md against lp-singleton-v1.clar, restricted-token-template.clar, and front-end/api/{launch,protocol}.js:

  • Contract addresses (mainnet/testnet, -v6 suffix), create-pool-{direct,bonding} and swap-exact-{stx-for-tokens,tokens-for-stx} names + arg order.
  • get-pool tuple field names, fee schedule (bonding 1%, direct 5%, 90% to fee-receiver), floors, and error codes.
  • parseLaunkrArg handles every arg type the /api/launch intent emits; trait args encode as contract principals.

Review fixes folded in

  • Network single-sourced. Removed the per-command --network flag. It resolved a local network for the singleton address / read-only calls, but the tx is signed & broadcast against account.network (bound to the NETWORK env var) and fee/explorer used NETWORK — three sources that diverge if --network disagrees with the wallet. Now everything follows NETWORK (default testnet), matching every other skill (e.g. jingswap).
  • swap-sell post-condition. Was PostConditionMode.Allow justified by "asset name varies per token" — but the template hardcodes (define-fungible-token strategy-token), so the asset name is constant. Now Deny + a scoped fungible post-condition (strategy-token, eq --tokens-in), mirroring swap-buy. The STX paid back is covered by the singleton's Clarity-4 as-contract? allowance.
  • Dropped dead temp-file I/O in launch; reconciled the SKILL.md/AGENT.md contradictions (the Some("") uri claim, the missing strategy-token reference); documented --fee.

Known follow-up (not in this PR)

The /api/launch intent specifies clarityVersion: 4 and the token template uses contract-hash? (a Clarity 4 primitive), but the shared deployContract helper (src/lib/transactions/builder.ts) can't pass a clarity version, so the deploy currently uses the Stacks.js default. This touches shared infrastructure and needs a testnet deploy to verify — deliberately left out of this PR.

Note on tooling

bun isn't available in the authoring environment, so bun run typecheck / validate / manifest were not run locally. Call signatures, frontmatter fields, and the manifest entry were verified by hand against the generator; CI is the authoritative check for typecheck + manifest freshness.

🤖 Generated with Claude Code

Adds the `launkr` skill (SKILL.md, AGENT.md, launkr.ts) for launching and
trading restricted SIP-010 tokens on the Launkr protected AMM, plus the
README and skills.json manifest entries.

Verified against the Launkr source (lp-singleton-v6 contract + /api/{launch,
protocol}): contract addresses, function/arg order, get-pool tuple fields,
fee schedule (bonding 1% / direct 5%), floors, and error codes.

Notable review fixes folded in:
- Network is single-sourced from the shared NETWORK env var (matching every
  other skill and the wallet the tx is signed with). Removed the per-command
  --network flag, which diverged from the broadcast network and from the fee
  and explorer-URL network.
- swap-sell now broadcasts in Deny mode with a scoped fungible post-condition
  on the token sold (asset name is the constant `strategy-token`, since every
  token is a byte-identical copy of the template) instead of Allow mode.
- Dropped dead temp-file I/O in launch; reconciled SKILL.md / AGENT.md docs.

Follow-up (not in this PR): the /api/launch intent specifies clarityVersion 4
and the token template uses `contract-hash?` (Clarity 4), but the shared
deployContract helper cannot yet pass a clarity version.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@julianariel

Copy link
Copy Markdown
Author

Retargeting to upstream aibtcdev/skills (this repo is a fork; PRs belong on the parent). Reopening there with the same branch.

@julianariel julianariel reopened this Jul 21, 2026
julianariel and others added 2 commits July 21, 2026 17:39
makeContractDeploy is called without a clarity version, so deploys use
the Stacks.js default. Add an optional `clarityVersion` to
ContractDeployOptions and pass it through, so callers deploying a
contract that needs a specific Clarity version (e.g. one using
`contract-hash?`, a Clarity 4 primitive) can request it. Additive and
backward-compatible — omitting it keeps the previous behavior.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Pass the /api/launch intent's clarityVersion (4) through to the token
  deploy so the restricted-token template (which uses contract-hash?,
  a Clarity 4 primitive) deploys under the right version.
- Validate mode-specific required args client-side before the API call
  (bonding needs --virtual-stx/--graduation-threshold; direct needs
  --stx-seed), so a bad invocation fails fast with a clear message.
- Source the Hiro API host from the shared getApiBaseUrl(network) helper
  instead of a second hardcoded copy in NET_CONFIG.
- Add author-agent frontmatter and inline launkr.io / ratherlabs.com
  links in SKILL.md; fix the skills.json author (rather-labs) to match
  the frontmatter and add authorAgent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@julianariel

Copy link
Copy Markdown
Author

Superseded by the upstream PR aibtcdev#413 — this repo is a fork, so the PR lives on the parent.

@julianariel
julianariel deleted the feat/launkr-skill branch July 21, 2026 22:14
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.

1 participant