feat: tax-aware localnet swarm workers (#621) #1133

Merged
PlasticDigits merged 1 commit from issue-621-tax-aware-swarm into main 2026-08-24 06:57:59 +00:00
PlasticDigits commented 2026-08-24 06:31:41 +00:00 (Migrated from gitlab.com)

Summary

  • Gem / OE-1 swarm workers exclude listed community-tax tokens from offer, route, and LP picks so random walks no longer 1:1-size extra-debit sells.
  • Dedicated TypeScript profile tax_listed (wallet 4 when SWARM_TAX_WORKERS=1) and Python --worker tax (started from launch-swarm.sh) size sells with TaxPreview (fail-closed amount * (1 + sell_bps/10000) if preview is missing), leave pair-direct Swap.trader unset, Send official-router ≥2hop to VITE_ROUTER_ADDRESS, and log tax_hybrid_skip instead of broadcasting a 1:1 hybrid sell.
  • Invariants S621-1–S621-8 are documented in skills/AGENTS_LOCALNET_SWARM_TAX.md and cross-linked from the swarm, seed, router, and CW20 playbooks. Gate: make verify-issue-621.

Closes #621

Test plan

  • cd packages/localnet-trading-swarm && npm run test:run (50 tests, including preview math, gem exclude, pair-direct no-trader)
  • make test-swarm-liquidity (liquidity + test_swarm_tax.py)
  • make verify-issue-621 first pass + retest (docs, static, TS, Python)
  • LocalTerra TS --dry-run starts, emits kind: swarm_tax, gem profiles skipped_broadcast
  • After a #620 seed deploy (VITE_TOKEN_COMMUNITY_TAX_ADDRESS set): live 2–3 min TS soak — logs include tax_listed sell extra-debit, buy split, router trader, provide 1:1, limit 1:1, tax_hybrid_skip
  • make swarm-launch then make swarm-stop — tax-0 txs; swap/LP workers skip tax pair; limit worker may place on tax/EMBER
  • SWARM_TAX_WORKERS=0 — exclude only; no tax volume
  • make verify-issue-293 — gem hub OE-1 still pool_only (do not add tax/EMBER)

Acceptance (from #621)

  • Gem/OE-1 workers never offer the tax token (filter + unit tests)
  • Tax workers implement pair-direct sell (extra-debit gate), pair-direct buy, provide 1:1, place-limit 1:1, official-router ≥2hop (router stamps trader)
  • Hybrid on the tax pair logs tax_hybrid_skip (no 1:1 hybrid sell broadcast)
  • --dry-run still validates localterra + factory (emits swarm_tax + tax_pair_visible / skipped_broadcast)
  • npm run test:run and make test-swarm-liquidity stay green
  • README + AGENTS_LOCALNET_TRADING_SWARM.md + new AGENTS_LOCALNET_SWARM_TAX.md document exclude + tax workers
  • After seed deploy, make swarm-local / make swarm-launch start without Mint errors and without an insufficient-funds storm on the tax pair — needs a #620-pinned LocalTerra (this checkout's .env.local has no VITE_TOKEN_COMMUNITY_TAX_ADDRESS)

Not in this MR

  • Live extra-debit / buy-split / hop-trader LCD accounting after a fresh #620 seed (test plan items 4–8 on the issue)
  • Adding the tax pair to OE-1 reciprocal pool_only checks (explicitly out of scope until quotes are net-of-tax)
  • Hybrid net-quote execute on the tax pair (skipped with a log, per acceptance)
  • Playwright / e2e-tx tax coverage (#622) and named tax-on Layer B (#623)
## Summary - Gem / OE-1 swarm workers exclude listed community-tax tokens from offer, route, and LP picks so random walks no longer 1:1-size extra-debit sells. - Dedicated TypeScript profile `tax_listed` (wallet 4 when `SWARM_TAX_WORKERS=1`) and Python `--worker tax` (started from `launch-swarm.sh`) size sells with `TaxPreview` (fail-closed `amount * (1 + sell_bps/10000)` if preview is missing), leave pair-direct `Swap.trader` unset, Send official-router ≥2hop to `VITE_ROUTER_ADDRESS`, and log `tax_hybrid_skip` instead of broadcasting a 1:1 hybrid sell. - Invariants **S621-1–S621-8** are documented in [`skills/AGENTS_LOCALNET_SWARM_TAX.md`](../blob/issue-621-tax-aware-swarm/skills/AGENTS_LOCALNET_SWARM_TAX.md) and cross-linked from the swarm, seed, router, and CW20 playbooks. Gate: `make verify-issue-621`. Closes #621 ## Test plan - [x] `cd packages/localnet-trading-swarm && npm run test:run` (50 tests, including preview math, gem exclude, pair-direct no-trader) - [x] `make test-swarm-liquidity` (liquidity + `test_swarm_tax.py`) - [x] `make verify-issue-621` first pass + retest (docs, static, TS, Python) - [x] LocalTerra TS `--dry-run` starts, emits `kind: swarm_tax`, gem profiles `skipped_broadcast` - [ ] After a #620 seed deploy (`VITE_TOKEN_COMMUNITY_TAX_ADDRESS` set): live 2–3 min TS soak — logs include `tax_listed` sell extra-debit, buy split, router trader, provide 1:1, limit 1:1, `tax_hybrid_skip` - [ ] `make swarm-launch` then `make swarm-stop` — `tax-0` txs; swap/LP workers skip tax pair; limit worker may place on tax/EMBER - [ ] `SWARM_TAX_WORKERS=0` — exclude only; no tax volume - [ ] `make verify-issue-293` — gem hub OE-1 still `pool_only` (do not add tax/EMBER) ## Acceptance (from #621) - [x] Gem/OE-1 workers never offer the tax token (filter + unit tests) - [x] Tax workers implement pair-direct sell (extra-debit gate), pair-direct buy, provide 1:1, place-limit 1:1, official-router ≥2hop (router stamps `trader`) - [x] Hybrid on the tax pair logs `tax_hybrid_skip` (no 1:1 hybrid sell broadcast) - [x] `--dry-run` still validates localterra + factory (emits `swarm_tax` + `tax_pair_visible` / `skipped_broadcast`) - [x] `npm run test:run` and `make test-swarm-liquidity` stay green - [x] README + `AGENTS_LOCALNET_TRADING_SWARM.md` + new `AGENTS_LOCALNET_SWARM_TAX.md` document exclude + tax workers - [ ] After seed deploy, `make swarm-local` / `make swarm-launch` start without Mint errors and without an insufficient-funds storm on the tax pair — needs a #620-pinned LocalTerra (this checkout's `.env.local` has no `VITE_TOKEN_COMMUNITY_TAX_ADDRESS`) ## Not in this MR - Live extra-debit / buy-split / hop-trader LCD accounting after a fresh #620 seed (test plan items 4–8 on the issue) - Adding the tax pair to OE-1 reciprocal `pool_only` checks (explicitly out of scope until quotes are net-of-tax) - Hybrid net-quote execute on the tax pair (skipped with a log, per acceptance) - Playwright / e2e-tx tax coverage (#622) and named tax-on Layer B (#623)
PlasticDigits commented 2026-08-24 06:58:00 +00:00 (Migrated from gitlab.com)

mentioned in commit 3ca5f62887

mentioned in commit 3ca5f62887785f8b7adb311db47103ab4b74e7a1
PlasticDigits (Migrated from gitlab.com) merged commit 3ca5f62887 into main 2026-08-24 06:58:00 +00:00
PlasticDigits commented 2026-08-24 07:02:07 +00:00 (Migrated from gitlab.com)

mentioned in issue #621

mentioned in issue #621
PlasticDigits commented 2026-08-24 07:02:08 +00:00 (Migrated from gitlab.com)

mentioned in issue #622

mentioned in issue #622
PlasticDigits commented 2026-08-24 07:02:09 +00:00 (Migrated from gitlab.com)

mentioned in issue #623

mentioned in issue #623
PlasticDigits commented 2026-08-24 07:02:37 +00:00 (Migrated from gitlab.com)

mentioned in issue #625

mentioned in issue #625
PlasticDigits commented 2026-08-24 07:02:46 +00:00 (Migrated from gitlab.com)

mentioned in issue #624

mentioned in issue #624
PlasticDigits commented 2026-08-24 11:07:42 +00:00 (Migrated from gitlab.com)

mentioned in commit df759514fb

mentioned in commit df759514fb95dda88148c78080715829e2151afd
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!1133
No description provided.