// Front page: the ticker, today's numbers, "Top ads this week" by verified clicks, the live ledger and the contract box. (async function () { VAB.renderNav('/'); VAB.renderFooter(); const $ = VAB.$, esc = VAB.esc; const d = await VAB.wire('front').catch(() => ({})); const t = d.today || {}; $('stViews').textContent = VAB.n(t.views); $('stClicks').textContent = VAB.n(t.vclicks); $('stBoosts').textContent = VAB.n(t.boosts); $('stAds').textContent = VAB.n(t.ads); const items = (d.board && d.board.items) || []; $('boardCards').innerHTML = items.length ? items.map(x => VAB.paper(x, 'No. ' + x.rank + ' · ' + VAB.n(x.clicks) + ' verified click' + (x.clicks === 1 ? '' : 's'), 'board')).join('') : '

No verified clicks yet this week. The first ad clicked by a verified visitor takes No. 1.

'; // the ledger: the newest Boost rows and their payouts const L = await VAB.getJSON('/api/ledger?n=6').catch(() => ({})); const ex = L.explorer || 'https://polygonscan.com'; const who = (a, nm) => nm ? '@' + esc(nm) : esc(VAB.short(a || '')); const rows = []; for (const r of (L.items || [])) { const link = 'verify'; rows.push('' + VAB.when(r.at) + 'Boost bought' + who(r.buyer, r.buyerName) + '' + VAB.polOf(r.weiPaid) + '' + link + ''); for (const p of r.pays || []) if (p.level > 0) rows.push('Paid level ' + p.level + (p.failed ? ' (waiting to be claimed)' : '') + '' + (p.to ? who(p.to, p.name) : 'sponsor') + '' + VAB.polOf(p.wei) + '' + link + ''); } $('ledgerMini').querySelector('tbody').innerHTML = rows.length ? rows.slice(0, 12).join('') : 'No Boosts yet. The first one shows here within a minute of its transaction.'; if (L.contract) { $('cAddr').textContent = 'Polygon · ' + L.contract + ' · read it live'; $('cLink').textContent = 'View the contract proof'; } })();