Level 4 override for LinkSpin: weekly dry-run report + the payer, shipped OFF (Marty approved 2026-10-23)

override.js is the InstantAdPay module (same code, same tests) with LinkSpin defaults: qualification is the
LinkSpin contract's own buyerCount >= 5 (referred first buys of $20+, which on the $10/$25/... ladder means
$25+, the level-3 bar), house id #1, hunt up to 25 hops, one recipient per purchase, purchases from
overrideGoLive on, weekly Mon-Sun Central, settled Monday after 9 AM CT.

- Default overrideMode 'dryrun': Monday who-would-be-paid summary to the admin Telegram chat
  (telegramAdminChatId; email to ADMIN_EMAIL if the bot is not set). No money moves.
- Payer pays only with overrideMode 'live' + overrideGoLive + OVERRIDE_PAYER_KEY. LinkSpin has no MySQL,
  so every once-only step is an exclusive file create on the shared volume (fails closed); plan frozen
  per week, 'sending' persisted before the tx, lost answers -> review (never re-sent), dust carried,
  weekly cap held whole, balance + gas checked first.
- Members: AwardPaid from the payer emails + on-site notice "Your Level 4 override is paid"; Wallet
  screen and feeds label it "Level 4 override". /api/my/activity now reads the whole history (was the
  last 600 events, the IAP bug of 2026-09-16; LinkSpin is at 525).
- Admin: /api/admin/override (+ status, payer), POST /pay (live only), POST /resolve; P&L card.
- Contract page: Level 4 override panel hidden until overrideMode is live (contract.js reveals it).
- qa/override.test.cjs (bash qa/run.sh override): 30 checks, fake chain/signer, throwaway data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-23 15:20:02 -05:00
parent 1c2ef3780c
commit 010c3afdd9
23 changed files with 693 additions and 23 deletions
+1 -1
View File
@@ -93,7 +93,7 @@ window.IAP = (function () {
case 'AdminPaid': return 'platform fee settled: ' + pol(ev.amountWei);
case 'BuyerCounted': return '' + nm(ev.sponsorId) + ' now has ' + ev.newCount + ' qualifying buyer(s)';
case 'MemberActivated': return '' + nm(ev.id) + ' activated a payout wallet';
case 'AwardPaid': return 'award: ' + pol(ev.amountWei) + ' → ' + nm(ev.toId);
case 'AwardPaid': return ev.override ? 'Level 4 override' + (ev.overrideWeek ? ' (week of ' + ev.overrideWeek + ')' : '') + ': ' + pol(ev.amountWei) + ' → ' + nm(ev.toId) : 'award: ' + pol(ev.amountWei) + ' → ' + nm(ev.toId);
case 'CreditsConsumed': return '' + nm(ev.memberId) + ' ran ads: −' + ev.amount.toLocaleString() + ' credits';
case 'PriceCached': return 'oracle price refreshed';
case 'FallbackPriceUsed': return 'cached price bridged an oracle gap';