2fe3d9e4c0
- proof.js: /api/ledger (each VBBShop purchase with its split read from the receipt's Paid/PaymentFailed events, else the contract's fixed 30/10/60 math; weekly prize transfers with their transactions), /api/contract (owner, prize wallet, company, keeper, paused, orders, balance and owed, read live and cached 5 min; Sourcify exact match, Polygonscan pending).
- Telegram (CTB Rewards bot, payments topic, TG_TOKEN/TG_CHAT/TG_PAY_TOPIC same as Downline Banners): one photo card per purchase (prebuilt VBB proof image rotated, buyer, sponsor/prize/company split in POL, this week's purchases + prize pot, Polygonscan + ledger links) and one line per confirmed prize payout. Hooks: shop.setHook (newly credited purchases only) and prize.setHook (confirmed transfers); once per tx via an in-process guard plus docstore.claim; nothing older than 2 hours.
- Pages /contract, /ledger, /terms, /disclaimer (Earnings Disclaimer), /privacy (TrustClickz, real mechanics: advertising not income, same-transaction split, prize wallet holds the 10% until Monday, no refunds on-chain, one-time purchases, crypto risk, data incl. hashed visit checks and the network hub); sitemap.
- Footer: Terms, Earnings Disclaimer, Privacy, Contract, Ledger, Support, company line, 'Part of the network' from the hub (netsites.js, /api/network-sites, fallback list), VBB marked current. Toasts add purchases and prize payouts.
- tools/proof-art.mjs renders public/art/proof/vbb-proof-{pink,blue,yellow}.png. common.js?v=5, vbb.css?v=6.
chain.mjs 49/49 (real contract on anvil + stand-in Telegram: exact split, 2 cards, no repost on rescans, 6 prize lines). smoke 241/241.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
32 lines
3.1 KiB
JavaScript
32 lines
3.1 KiB
JavaScript
// Live ledger (trust pack 2026-11-14): purchases with their split and weekly prize payouts from /api/ledger, refreshed every 30 s.
|
|
(function () {
|
|
VBB.renderNav('/ledger'); VBB.renderFooter();
|
|
const esc = VBB.esc;
|
|
const pol = w => { try { const v = BigInt(w || 0); const n = Number(v / 10n ** 12n) / 1e6; return (n >= 100 ? n.toFixed(2) : n.toFixed(4)) + ' POL'; } catch (e) { return '0 POL'; } };
|
|
const usd = c => '$' + (Number(c || 0) / 100).toFixed(2);
|
|
const when = t => t ? new Date(t).toLocaleString('en-US', { timeZone: 'America/Chicago', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }) + ' CT' : '';
|
|
const who = (a, n) => n ? '@' + esc(n) : '<span class="mono">' + esc(VBB.short(a || '')) + '</span>';
|
|
const ROLE = { sponsor: 'Sponsor 30%', prize: 'Prize pot 10%', company: 'Viral Banner Blitz' };
|
|
async function load() {
|
|
let d; try { d = await VBB.getJSON('/api/ledger?n=100'); } catch (e) { return; } if (!d || !d.items) return;
|
|
const ex = d.explorer || 'https://polygonscan.com'; const t = d.totals || {};
|
|
document.getElementById('totals').innerHTML = '<div class="stat"><b>' + VBB.n(t.purchases) + '</b><span>purchases on-chain</span></div>'
|
|
+ '<div class="stat"><b>' + pol(t.sponsorWei) + '</b><span>paid to sponsors, same transaction</span></div>'
|
|
+ '<div class="stat"><b>' + VBB.n(t.prizePayouts) + '</b><span>weekly prize payouts</span></div>'
|
|
+ '<div class="stat"><b>0</b><span>withdrawals needed: every purchase pays out in the same transaction</span></div>';
|
|
const body = document.querySelector('#rows tbody');
|
|
if (!d.items.length) { body.innerHTML = '<tr><td colspan="4" class="muted">No purchases yet. The first one will show here within a minute of its transaction.</td></tr>'; return; }
|
|
body.innerHTML = d.items.map(r => {
|
|
const link = '<a href="' + esc(ex) + '/tx/' + esc(r.tx) + '" target="_blank" rel="noopener">Polygonscan</a>';
|
|
if (r.kind === 'prize') {
|
|
const place = ['1st', '2nd', '3rd'][r.place - 1] || '#' + r.place;
|
|
return '<tr><td class="small">' + when(r.at) + '</td><td><span class="pill cycled">Prize</span><br>' + esc(r.name) + ', ' + place + ' place, ' + (r.board === 'sources' ? 'most traffic sources' : 'most verified visitors') + ' (week of ' + esc(r.week) + ')</td>'
|
|
+ '<td class="small">' + esc(r.pol) + ' POL ($' + Number(r.usd).toFixed(2) + ') from the prize wallet' + (r.confirmed ? '' : ' <span class="muted">(confirming)</span>') + '</td><td>' + link + '</td></tr>';
|
|
}
|
|
const pays = (r.pays || []).map(p => esc(ROLE[p.role] || p.role) + ': ' + pol(p.wei) + (p.role === 'sponsor' ? ' to ' + who(p.to, p.name) : '') + (p.failed ? ' <span class="muted">(bounced, waiting in the contract for them to claim)</span>' : '')).join('<br>');
|
|
return '<tr><td class="small">' + when(r.at) + '</td><td><span class="pill loop">Purchase</span><br>' + who(r.buyer, r.buyerName) + ' bought ' + esc(r.what) + ' for ' + usd(r.usdCents) + '</td><td class="small">' + pays + '</td><td>' + link + '</td></tr>';
|
|
}).join('');
|
|
}
|
|
load(); setInterval(load, 30000);
|
|
})();
|