Game Pass package rail, part two: Admin > Game Pass gets a Pass sales table (every sale labelled package / credit-paid (old rule) / package (old rule), pass value, package value, package tx link) and stats passes.pay + sales; the chatbot canned answer, tier fact and system prompt say every pass is paid by a new package bought after tapping Get (sponsor and team paid, credits kept for ads, held credits never buy a pass); docs/GAME-PASS.md "Payment: the package rail" section; release-note update draft (not sent); admin.js tag bumped. Fulfilment stamps the pass at the event time again (as before). Tests: sov-passes store + local rebuilt on order + fresh package (seeded credits never spent), gamepass ALL PASS, member walk 0 bugs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-22 12:49:39 -05:00
parent 6a3313a861
commit 31b167e046
8 changed files with 195 additions and 81 deletions
+34 -3
View File
@@ -1,5 +1,8 @@
# Game Pass: draft spec (2026-10-16)
> **PAYMENT RULE CHANGED 2026-10-22 (Marty): every pass is paid by a FRESH on-chain package purchase; no pass is ever bought with
> credits again.** See "Payment: the package rail" at the end. Older sections below that mention credits describe the rule as it was.
Marty's direction (10-16): a $5 weekly Game Pass that covers all nine games and raises the daily POL cap; a tighter
free cap so nobody farms the games all day for free. Pass = "more game", never pitched as payback. Free play keeps
paying real POL (the "paid before they ever pay" funnel in the presentation, deck and guide).
@@ -31,7 +34,7 @@ a single day. No other game pays more than 2 POL for any single reward.
## 2. The pass
- **$5, 7 days, all nine games.** One pass per account; buying while active extends by 7 days.
- Paid with **purchased-grade credits only** (500 credits = the $5 package), through the existing game-purchase path
- (Superseded 2026-10-22, see "Payment: the package rail".) Paid with **purchased-grade credits only** (500 credits = the $5 package), through the existing game-purchase path
(`ads.gamePurchase` with `purchasedOnly`, the same rule as PolyWarriors mint passes). A $5 package bought while a pass
order waits fulfils it (the `pwpasses` pattern). Earned credits never buy a pass, or no money enters and the pass is
just a free cap increase.
@@ -95,7 +98,7 @@ that anyway." The paced total cap spreads a big boss payout over a few days; the
> `POST /api/partner/tournament/paid { game, week, place, tx }` so the row leaves the list. PolHunter's faucet pays them
> (`polhunter/lib/tournament.js`, see "Games: as built"); Admin > Game Pass shows the unpaid rows meanwhile.
> 9. **Not deviations, just dev conveniences (non-production only):** `devDay: 'YYYY-MM-DD'` on `polgrant`/`player`/`buy` fakes the
> Central day; `POST /api/dev/gamepass-purchase` fakes a package event; `devPaid: true` on `buy` skips the credit charge.
> Central day; `POST /api/dev/gamepass-purchase` fakes a package event; `devPaid: true` on `buy` skipped the credit charge (retired 2026-10-22: there is no charge any more; the dev purchase event takes `minedAt`, `now` and `tx`).
IAP is the single source of truth for the pass and for the account-wide caps. Every game already signs partner calls
with its shared secret (the `/api/partner/player` pattern); the new calls use the same auth.
@@ -114,7 +117,7 @@ with its shared secret (the `/api/partner/player` pattern); the new calls use th
`capFreeDaily` 0.30, `capFreeTotal` 2.0, `capPassDaily` 1.50, `capPassTotal` 5.0, `capsStartDate` (the free caps apply
only from this Central date; before it, the games' own caps stand, so the change can be announced a week ahead),
`passTournamentPct` 5.
- Pass purchase: `POST /api/my/gamepass/buy` spends 500 purchased-grade credits (`ads.gamePurchase` with
- Pass purchase (superseded 2026-10-22: Buy only opens an order, a fresh package fulfils it): `POST /api/my/gamepass/buy` spends 500 purchased-grade credits (`ads.gamePurchase` with
`purchasedOnly`); a $5 package bought while a pass order waits fulfils it (the `pwpasses` pattern). Buying while active
extends `until` by 7 days. The Games tab shows the card, the state, and the expiry.
- Games get the pass flag at the sign-in hand-off and on every `polgrant` response; apply perks locally.
@@ -333,3 +336,31 @@ drives the REAL `spooky-doors/server/polgrant.js` and `polhunter/lib/tournament.
(`carried` > 0, idempotent repeat), void, bad secret and IAP-down -> `{ allowed: 0, retry: true }`, the retry queue, and the
tournament payer in dry run and live (mocked faucet.send) until IAP's pending list is empty. 2026-10-16: 44/44 after the `rows`
fix on the pending endpoint (the games read `rows`; IAP answered only `pending`).
## Payment: the package rail (2026-10-22, Marty)
**Why.** A pass paid from a credit balance brings in no new money and pays nobody upline: credits come from packages whose POL was
already split on chain ($2.50 sponsor, $1 level 2, $0.50 level 3, $1 company on a $5 package). Today's pass buyer paid from an old
balance. From now on every pass is a fresh package purchase, so the sponsor and team are paid exactly like any package.
**Rule.**
- `POST /api/my/gamepass/buy { tier }` never charges anything. It opens a waiting order for that tier (or returns the one already
open) and answers `{ needPay: true, order, orderTs, package, payUrl, message }`. The card sends the member to Buy credits.
- The order is fulfilled only by an on-chain `Purchase` event (`gamepass.onEvent`, inside the `marks.claim` block, so one app copy
acts) that meets ALL of:
- the buyer id is one of this account's own positions: the main member id (`accounts.byMemberId`) or a linked position
(`accounts.positionByMember`);
- `priceCents` is at least the tier price (setting `gamePass*PriceCredits`, now read as cents; the copy names the package that
covers it: $5, $20, $50, $100, $250);
- the purchase was mined AFTER the order was opened: block time from `eth_getBlockByNumber` (server.js `blockTime` dep), with a
30 s clock grace; if the block cannot be read after 3 tries the indexed-at time is used (never earlier than the block);
- the tx has never paid a pass or an order before (checked across every order and every bought row, every account).
- One pass per purchase: the highest-priced waiting order the package covers. The member keeps every credit of the package.
- Bought row: `{ via: 'package', tier, tx, cents, order, buyerId, usd: <pass price>, packageUsd }`. `buyerId` marks the new rail.
- Existing passes are untouched (never revoked). On 2026-10-22 production held two sales: one `via: 'credits'` (500 credits,
campaign 513) and one `via: 'package'` fulfilled under the old rule (tx 0xdbfb77c7...). No order was left waiting.
- Admin > Game Pass > **Pass sales**: every sale with how it was paid ("package", "credit-paid (old rule)", "package (old rule)"),
pass value, package value and the package tx; the header splits the counts. Stats field `passes.pay` and `sales`.
- Tests: `qa/gamepass.mjs` (order, package mined before the order refused, too small refused, another member refused, fresh package
fulfils, replayed tx refused, extend while active); `qa/sov-passes-store.cjs` and `qa/sov-passes-local.mjs` updated the same way.
- Not changed: the caps, the tiers, the tournament (pool = pass price of each sale), the hand-off claims.