Hand the sponsor to PolHunter, and put its payouts in the P&L

PolHunter now pays a bounty when a hunter brings someone who turns up and
hunts, and the person who gets it has to be the one that member actually
joined under here. The sign-in payload carries sponsorRef and the join date
across so PolHunter is never guessing from a cookie.

Its payouts are real POL from its own faucet and none of it passes through the
ad contract, so the P&L could not derive it. It now reads the figures across,
cached and fail-soft, and shows finds, bounties and matches as their own card.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-23 04:36:02 -05:00
parent ce9f3e6904
commit 286ac9207a
3 changed files with 49 additions and 3 deletions
+19
View File
@@ -715,6 +715,25 @@
['Net after fixed costs', '$' + Math.round(platUsd - fixed).toLocaleString(), 'fixed ' + Math.round(fixed).toLocaleString() + ' over ' + months.toFixed(1) + ' month(s)'],
['Pass-ups', r.passedUp.count, r.passedUp.unqualified + ' unqualified · ' + r.passedUp.sendFailed + ' send-failed']
].map(t => '<div class="statx"><div><div class="nv" style="font-size:22px">' + esc(String(t[1])) + '</div><div class="lb">' + esc(t[0]) + '</div><span class="chip flat">' + esc(t[2]) + '</span></div></div>').join('');
// PolHunter: a marketing cost paid from its own faucet, so it is read across rather than
// derived from our chain events (Marty, 2026-09-23)
const ph = r.polhunter, phEl = $('pnlHunt');
if (phEl) {
if (!ph || ph.error || !ph.totals) phEl.innerHTML = '<tr><td colspan="3" class="muted small">PolHunter figures unavailable' + (ph && ph.error ? ' (' + esc(ph.error) + ')' : '') + '.</td></tr>';
else {
const t = ph.totals, rf = ph.referrals || {}, usd = n => '$' + (Number(n) * px).toFixed(2);
const findPol = Math.max(0, Number(t.pol || 0) - Number(rf.paidPol || 0));
phEl.innerHTML = '<tr><th>Line</th><th>POL</th><th>USD now</th></tr>'
+ [['Mission finds (' + Number(t.paid || 0).toLocaleString() + ' paid)', findPol],
['Referral bounties (' + Number(rf.bounties || 0) + ')', null],
['Referral matches (' + Number(rf.matches || 0) + ')', null],
['Referral payouts total', Number(rf.pol || 0)],
['All PolHunter payouts', Number(t.pol || 0)]]
.filter(x => x[1] !== null)
.map(x => '<tr><td>' + x[0] + '</td><td class="mono">' + Number(x[1]).toFixed(4) + '</td><td class="mono">' + usd(x[1]) + '</td></tr>').join('')
+ '<tr><td class="muted small">Hunters paid</td><td class="mono">' + Number(t.hunters || 0) + '</td><td class="muted small">today ' + Number(t.today || 0).toFixed(3) + ' POL</td></tr>';
}
}
$('pnlSplit').innerHTML = '<tr><th>Line</th><th>POL</th><th>USD now</th></tr>'
+ [['Level 1 (50%)', r.byTier[1]], ['Level 2 (20%)', r.byTier[2]], ['Level 3 (10%)', r.byTier[3]], ['Platform (20% + pass-ups)', r.platformWei]].map(x => '<tr><td>' + x[0] + '</td><td class="mono">' + pol(x[1]) + '</td><td class="mono">' + usdOf(x[1], px) + '</td></tr>').join('');
const W = r.wallets || {}, B = r.balances || {};