Files
viraladsource/public/assets/ledger.js
T
Marty Bostick edaf98c8f6 ViralAdSource app (Marty approved 2026-11-16): free text ads that spread by reshares, each ad with its own family tree
Watershed look from the approved mockup (hero, topo pattern, icons). Network sign-in through the hub, hub membership, activity ping.
Reshare links per member per ad with branch/step tracking; family-tree dashboard (branch, step, reshares, views, clicks, sign-ups, Boosts).
Verified views earn ad credits for the branch's resharer (L3). L2 sign-up pipeline (hub-new, confirmed email, not self device/IP,
throwaway block, daily cap, fraud score) with keeper-signed reward vouchers and a pending-rewards ledger; payouts OFF (REWARD_PAYOUTS).
L1 Boosts through VASShop with signed orders naming the sponsor line and the resharer. Trust pack, chatbot, promo kit, PolHunter embed.
All numbers are PROPOSALS until Marty sets them. qa/e2e.mjs 59/59 on a local anvil chain, chatbot test 108/108.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 09:19:34 -06:00

23 lines
2.5 KiB
JavaScript

// Live ledger: every Boost with its split (resharer, sponsor levels, pot, company) and every sign-up reward, refreshed every 30 s.
(function () {
const $ = VAS.$, esc = VAS.esc; const pol = w => VAS.polOf(w) + ' POL';
const who = (a, nm) => nm ? '@' + esc(nm) : '<span class="mono">' + esc(VAS.short(a || '')) + '</span>';
async function load() {
const d = await VAS.getJSON('/api/ledger?n=100').catch(() => null); if (!d || !d.items) return;
const ex = d.explorer || 'https://polygonscan.com'; const t = d.totals || {};
$('ledStats').innerHTML = [[VAS.n(t.boosts), 'Boosts on chain'], [pol(t.resharerWei), 'paid to resharers'], [pol(t.potWei), 'added to the reward pot'],
[VAS.n((d.rewards || []).filter(r => r.status === 'paid').length), 'sign-up rewards paid']].map(x => '<div class="stat"><b>' + x[0] + '</b><span>' + x[1] + '</span></div>').join('');
const tx = h => h ? '<a href="' + esc(ex) + '/tx/' + esc(h) + '" target="_blank" rel="noopener">verify</a>' : '';
if (d.items.length) $('rows').innerHTML = d.items.map(r => {
const lv = (r.pays || []).filter(p => p.kind >= 1 && p.kind <= 5).map(p => 'L' + p.kind + ' ' + pol(p.wei) + ' ' + who(p.to, p.name)).join('<br>') || '<span class="muted">none qualified</span>';
const co = (r.pays || []).find(p => p.kind === 0);
return '<tr><td>' + VAS.when(r.at) + '</td><td>' + who(r.buyer, r.buyerName) + '</td><td class="n">' + VAS.usd(r.usdCents) + '<br>' + pol(r.weiPaid) + '</td><td>'
+ (r.resharer ? who(r.resharer.to, r.resharer.name) + '<br>' + pol(r.resharer.wei) : '<span class="muted">none</span>') + '</td><td>' + lv + '</td><td class="n">' + pol(r.potWei) + '</td><td class="n">' + (co ? pol(co.wei) : '') + '</td><td>' + tx(r.tx) + '</td></tr>';
}).join('');
$('payNote').textContent = d.payoutsOn ? '' : 'Payouts are switched off for now: verified rewards wait here as pending until the amounts are confirmed.';
if ((d.rewards || []).length) $('rrows').innerHTML = d.rewards.map(r => '<tr><td>' + VAS.when(r.at) + '</td><td>' + (r.name ? '@' + esc(r.name) : esc(r.to)) + '</td><td>' + (r.kind === 'tier' ? 'tier bonus' : 'new member') + '</td><td class="n">' + VAS.usd(r.cents) + '</td><td><span class="chip' + (r.status === 'paid' ? '' : ' grey') + '">' + esc(r.status) + '</span>'
+ (r.unlockAt && r.unlockAt > Date.now() ? '<br><span class="muted" style="font-size:13px">withdrawable ' + VAS.when(r.unlockAt) + '</span>' : '') + '</td><td>' + tx(r.tx) + '</td></tr>').join('');
}
VAS.wire('other').catch(() => {}); load(); setInterval(load, 30000);
})();