Files
linkspin/public/assets/contract.js
T
martbost 010c3afdd9 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>
2026-10-23 15:20:02 -05:00

24 lines
1.6 KiB
JavaScript

// Contract page: live address, chain, explorer + verified-source links, the chain totals. No shared nav (2026-10-07).
(async function () {
const $ = id => document.getElementById(id);
let c = {}; try { c = await (await fetch('/api/config')).json(); } catch (e) {}
const addr = String(c.contract || '');
// Level 4 override panel (2026-10-23): only when the site setting overrideMode is 'live' and overrideGoLive is set
if (String(c.overrideMode || '') === 'live' && Number(c.overrideGoLive) && $('ovPanel')) {
const d = new Date(Number(c.overrideGoLive)).toLocaleDateString('en-US', { timeZone: 'America/Chicago', month: 'long', day: 'numeric', year: 'numeric' });
document.querySelectorAll('[data-ov-start]').forEach(e => { e.textContent = d; }); $('ovPanel').hidden = false;
}
$('cAddr').textContent = addr || 'not deployed yet';
$('cChain').textContent = c.chainName || '';
const src = 'https://repo.sourcify.dev/contracts/full_match/' + (c.chainId || 137) + '/' + addr + '/';
$('lnkExplorer').href = c.explorer ? c.explorer + '/address/' + addr + '#code' : src;
$('lnkSource').href = src; $('lnkSource2').href = src;
try {
const s = await (await fetch('/api/stats')).json();
$('stMembers').textContent = Number(s.onchainMembers || 0).toLocaleString();
$('stPackages').textContent = Number(s.purchases || 0).toLocaleString();
const pol = Number(BigInt(String(s.payoutWei || s.paidInWei || '0')) / 10000000000000000n) / 100;
$('stPol').textContent = pol.toLocaleString(undefined, { maximumFractionDigits: 2 });
} catch (e) {}
})();