# 5xYourTeam app: The Draft (5xyourteam.com rebuild) Phase 1, LOCAL ONLY (Marty 2026-11-15). Nothing here is deployed; no contract is on chain; the holding tank is a local stub that adopts nobody and sends no mail; Telegram posts go to an outbox. Plain Node http server, no framework (the ViralAdBlitz / DownlineHydra pattern). Contract: `../contracts` (DraftPosition). ## What it does - **A position**: $10 one-time in POL (never a subscription). It gives 5 instant picks from the current pool and a spot in every weekly draft. Paid through DraftPosition: sponsor 25%, levels 2-5 5% each (pass-up over people with no position, 20 places), 10% to the Best Coach prize pot wallet, 45% company. The server builds the `buy()` call with a keeper-signed EIP-712 line voucher from the hub line (shop.js, the VABShop pattern); the watcher records each `Purchase` once and adds the instant picks. - **The draft** (draft.js, pure and unit-tested with a mocked clock; league.js wires it): every Monday 7 PM Central (env), 5 rounds, straight order. Draft order is EARNED: most of last week's picks started (payouts on or a first purchase), then started ever, then the earlier position, then a fixed shuffle of (week, coach). A coach in the draft room (the board pinged within 2 minutes) gets a 90-second clock; an away coach is auto-picked at once from their own queue, else the best available by scouting score. A coach with 10 open picks is skipped for that slot. A draft missed by more than 6 hours (app down) is skipped, never run late. - **Picks are adoptions** (tankpool.js): every pick goes through `tank.adopt()` first. The pool never has anyone locked on a network contract, already sponsored, adopted twice (every pick counts, plus the network's count), spam/throwaway, or inside the 24-hour sign-up grace. An unconverted pick returns to the pool after 3 days, unless that person has now had 2 adoptions (then they stay with the coach). A started pick stays. A coach cannot release a pick in its first 48 hours. - **Coaching tools** (`/team`): stat tiles (on my team, started this week, next draft spot, back to pool soon), the focused pick card (scouting stats, the 5 getting-started steps, one-tap messages, the composer and thread, release), the rest of the team, who to help first (back to pool soon, one step from payouts, quiet), the draft queue. Someone who is a pick sees their coach, the steps and the thread, and the coach's builder links. Messages go through the site only. No email, phone or any contact data is ever shown, stored from sign-in, or exported (smoke-tested). - **Scouting stats** on draft cards: last seen, the door they came from, wallet linked, game plays and title, POL earned in games and surfing where the network tracks it ("not tracked yet" otherwise, never invented). Earnings show to coaches only. - **Cards**: trading cards Rookie (drafted), Starter (wallet), Pro (payouts on), All-Star (first purchase), Hall of Fame (holds a position of their own). Public cards show milestones, never earnings. Coach page `5xyourteam.com/`. - **Boards**: Best Coach (picks started inside the Central week; tie = got there first), the week's pot (10% of positions sold that week, from the Purchase events), Rookie of the Week (the pick that climbed highest that week), last week's top 3. - **Builder** (`/builder`, wild.js from DownlineHydra, the CryptoTeamBuild builder programs seeded from `data-seed/programs.seed.json`): coaches save referral IDs; their picks see the coach's link for each program. - **Trust pack** (proof.js): `/ledger` (every share with its place in the line, passed over, pot, company; Best Coach payouts with tx), `/contract` (live facts incl. the prize wallet), toasts (positions, picks, level-ups), Telegram sale card (rotated proof images), Draft Day card (`/draftday/` 1080x1080, PNG via `tools/art.mjs --draftday`), a line per pot payout; Terms / Earnings Disclaimer / Privacy naming TrustClickz; the network footer from the hub (netsites.js, 5xYourTeam added locally as `fivex`, LinkSpin code `nw5x`). - **Promo kit** (`/promote`, `/api/promo-kit?u=`): 21 creatives `public/art/kit/fx-{draft,coach,cards}-{shape}.png`, swipe copy. - **Old links**: `/?`, `/splashpg.php?r=`, `/lcp.php?r=`, `/index.php?r=` 301 to the coach page via the old-ref map (`POST /api/admin/oldrefs`), `/members/*` to `/team`, any other `*.php` to `/`. - **Admin** (`/admin`, `ADMIN_TOKEN`): status, run a tick, the week's pot shares, record a pot payout (`POST /api/admin/pot/paid`), old-link map. Test-only: `POST /api/admin/clock` (needs `ALLOW_TEST_CLOCK=1`, refused in production), `POST /api/admin/stub/status`. - **Data**: docstore.js (MySQL via `DOCSTORE_URL`, the LinkSpin copy that skips unchanged writes): document `fivex.json` + row tables `fx_picks`, `fx_msgs`, `fx_refids`; `hubreport.json`, `oldrefs.json`, `tg-outbox.json`, `stub-tank.json` are documents. ## Look The approved draft-night mockup (2026-11-14): stadium navy #0b1530 / bar #07102a, gold #ffc93c rule and accents, red #ff4d4d week tag, white scouting cards with navy heads, Oswald + Inter. One stylesheet `public/assets/fx.css`. Deviation from the mockup on purpose: the mockup's coach card showed an email line; it is gone (no contact data, Marty's rule). ## Run and test ``` npm ci node server.js # prototype mode (files, stub tank); never launch this way node qa/unit.test.cjs # 62 checks: tiers, tank rules, earned order, the clocked draft, tank refusals, returns, boards, the split model # against the fork rehearsal (to the wei), Central weeks, the league end to end node qa/smoke.mjs # 156 checks against stand-in hub / chain / Telegram (ports 3561-3564) + Playwright 1280/390 UI_FONTS=1 node qa/smoke.mjs # same, Google Fonts allowed so qa/out screenshots show the real type node qa/iap-tank.test.cjs # 23 checks: league + the real client against InstantAdPay's REAL draftpartner.js + tank.js (sibling # checkout) behind a signed local server on 3565, then a dead port (3566); skips without the sibling node tools/pages.mjs # regenerate public/*.html (one source of copy + legal facts) node tools/art.mjs # icon, OG, proof cards, kit, tier cards; --draftday for a Draft Day PNG ``` ## The real holding tank (built 2026-11-15, local only) `TANK_MODE=iap` (or `hub`) switches tankpool.js from the stub to InstantAdPay's signed partner routes (`IAP_URL`, shared `DRAFT_PARTNER_SECRET`, 32+ characters, the same value on both apps). InstantAdPay is the tank's home and the single source of the pool: its tank.waiting() is already the one network tank (LinkSpin and hub arrivals included, anyone adopted on LinkSpin left out), so LinkSpin needs no route of its own. Every pick is a real `tank.adopt()` there: the 2-adoption count, the 24-hour grace, rule 3, the normal "X is now your sponsor" email (the only mail), the sponsor change through sponsorfollow and the hub. InstantAdPay checks "holds a 5x position" from the coach claim this app signs (positions), a wallet linked there and someone on its contract in the coach's line. Picks keep their 3-day window there too; whichever sweep runs first, both apps end with the same outcome (returned / kept / done). A tank refusal about the coach passes the draft slot; a silent tank pauses the draft until the next tick. ## Phase 2 (needs Marty's go): see the open questions in the build report Hub `HUB_SITES` entry `fivex` + secret; `TANK_MODE=iap` + `DRAFT_PARTNER_SECRET` + `IAP_URL` (above); the network-sites list and LinkSpin `nw5x`; the contract on chain with the prize wallet; DOCSTORE_URL; old-member reconciliation; PolHunter mission. ## Site assistant (2026-11-15) Chat widget on every page (`public/assets/chat.js` + `chat.css` in the draft-night look). `chatbot.js` holds what it knows (CANNED + FACTS from this repo's code); `chatcore.js`, `kb.js` (`kb.json` = a MySQL document) and `netkb.js` (the shared network knowledge on the hub) are the same files on every rebuilt site. OpenRouter key: `/app/data/openrouter.key` on the volume. Account problems hand off to `https://instantadpay.com/support?from=fivex`. Admin API (x-admin-token): `/api/admin/kb`, `/api/admin/kb/`, `/api/admin/kb/test`, `/api/admin/kb/network?refresh=1&publish=1`. Test: `node qa/chatbot.test.mjs` (Q&A in `qa/chat-qa.json`).