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:
@@ -17,7 +17,7 @@
|
||||
.map(([k, v, n], i) => '<div class="tile' + (i === 0 ? ' hi' : '') + '"><span class="k">' + k + '</span><span class="v">' + v + '</span><span class="muted mono" style="font-size:11px">' + n + '</span></div>').join('');
|
||||
$('walletBox').innerHTML = addr ? '<div class="code" style="display:block">' + esc(addr) + '</div><div style="margin-top:8px">' + (on ? '<span class="ok"><span class="dot"></span>PAYOUTS ON · member #' + ME.memberId + '</span>' : '<span class="warn"><span class="dot"></span>WALLET LINKED · PAYOUTS OFF</span><div class="muted" style="margin-top:4px">Switch payouts on so the people you bring pay you from their first purchase.</div>') + '</div>' : '<span class="warn">No wallet linked yet.</span><div class="muted" style="margin-top:4px">Link one to be paid. Your email account keeps working either way.</div>';
|
||||
const pays = E && Array.isArray(E.earnings) ? E.earnings : [];
|
||||
$('payRows').innerHTML = pays.length ? pays.slice(0, 25).map(x => '<div class="rw"><span class="mono muted" style="font-size:12px">' + new Date((x.ts || 0) * (x.ts > 1e12 ? 1 : 1000)).toLocaleString() + '</span><span><b>' + esc(x.buyerName || x.fromName || (x.names && x.buyerId && x.names[x.buyerId] ? '@' + x.names[x.buyerId] : x.buyerId ? 'member #' + x.buyerId : x.type === 'AwardPaid' ? 'award' : 'member')) + '</b></span><span class="mono">' + (x.tier ? 'L' + x.tier + ' · ' + (x.tier === 1 ? '50%' : x.tier === 2 ? '20%' : '10%') : (x.type === 'AwardPaid' ? 'award' : '')) + '</span><span class="mono">' + (x.priceCents ? '$' + (x.priceCents / 100) : '') + '</span><span class="r num ok">+' + pol(x.amountWei || '0') + ' POL' + (U.usd > 0 ? '<br><span class="muted" style="font-size:11px">' + usd(x.amountWei) + '</span>' : '') + '</span>' + (x.tx ? '<a class="mono" style="font-size:11px" href="/tx/' + esc(x.tx) + '" target="_blank" rel="noopener">' + esc(String(x.tx).slice(0, 10)) + '…</a>' : '<span></span>') + '</div>').join('')
|
||||
$('payRows').innerHTML = pays.length ? pays.slice(0, 25).map(x => '<div class="rw"><span class="mono muted" style="font-size:12px">' + new Date((x.ts || 0) * (x.ts > 1e12 ? 1 : 1000)).toLocaleString() + '</span><span><b>' + esc(x.buyerName || x.fromName || (x.names && x.buyerId && x.names[x.buyerId] ? '@' + x.names[x.buyerId] : x.buyerId ? 'member #' + x.buyerId : x.type === 'AwardPaid' ? (x.override ? 'Level 4 override' : 'award') : 'member')) + '</b></span><span class="mono">' + (x.tier ? 'L' + x.tier + ' · ' + (x.tier === 1 ? '50%' : x.tier === 2 ? '20%' : '10%') : (x.type === 'AwardPaid' ? (x.override ? 'L4 · 3%' : 'award') : '')) + '</span><span class="mono">' + (x.priceCents ? '$' + (x.priceCents / 100) : '') + '</span><span class="r num ok">+' + pol(x.amountWei || '0') + ' POL' + (U.usd > 0 ? '<br><span class="muted" style="font-size:11px">' + usd(x.amountWei) + '</span>' : '') + '</span>' + (x.tx ? '<a class="mono" style="font-size:11px" href="/tx/' + esc(x.tx) + '" target="_blank" rel="noopener">' + esc(String(x.tx).slice(0, 10)) + '…</a>' : '<span></span>') + '</div>').join('')
|
||||
: '<div class="rw"><span class="muted">No payouts yet. They appear here the moment someone in your line buys.</span></div>';
|
||||
$('payFoot').textContent = 'every line is a Polygon transaction · nothing is held by the site' + (U.usd > 0 ? ' · 1 POL ≈ $' + U.usd.toFixed(4) + ' at today’s price (updated ' + Math.max(0, Math.round((Date.now() - U.at) / 60000)) + ' min ago); dollar amounts are today’s value, not the value on the payout day' : '');
|
||||
const rows = Array.isArray(POS) ? POS : (POS && (POS.positions || POS.list)) || [];
|
||||
|
||||
Reference in New Issue
Block a user