// Live ledger (trust pack): every Boost with every level paid in the same transaction (and its place in the buyer's line), who was // passed over, the company share and the Boost's delivery, from /api/ledger, refreshed every 30 seconds. (function () { VAB.renderNav('/ledger'); VAB.renderFooter(); VAB.wire('other').catch(() => {}); const esc = VAB.esc; const pol = w => VAB.polOf(w) + ' POL'; const usd = c => '$' + (Number(c || 0) / 100).toFixed(2); const who = (a, nm) => nm ? '@' + esc(nm) : '' + esc(VAB.short(a || '')) + ''; async function load() { let d; try { d = await VAB.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 = '
' + VAB.n(t.boosts) + 'Boosts on-chain
' + '
' + pol(t.levelsWei) + 'paid to sponsor levels, same transaction
' + '
' + usd(t.usdCents) + 'in Boosts, at the price when bought
' + '
0withdrawals needed: every Boost pays out in the same transaction
'; const body = document.querySelector('#rows tbody'); if (!d.items.length) { body.innerHTML = 'No Boosts yet. The first one shows here within a minute of its transaction.'; return; } body.innerHTML = d.items.map(r => { const link = 'verify'; const pays = (r.pays || []).map(p => p.level === 0 ? 'ViralAdBlitz: ' + pol(p.wei) : 'Level ' + p.level + ': ' + pol(p.wei) + ' to ' + (p.to ? who(p.to, p.name) : 'sponsor') + (p.depth && p.depth !== p.level ? ' (place ' + p.depth + ')' : '') + (p.failed ? ' (bounced, waiting in the contract for them to claim)' : '')).join('
'); const over = (r.passedOver || []).length ? '
Passed over (no Boost yet): ' + r.passedOver.map(o => (o.name ? '@' + esc(o.name) : esc(VAB.short(o.who))) + ' at place ' + o.depth).join(', ') + '' : ''; const dv = r.delivery ? '
Views delivered: ' + VAB.n(r.delivery.delivered) + ' of ' + VAB.n(r.delivery.views) + '' : ''; return '' + VAB.when(r.at) + 'Boost
' + who(r.buyer, r.buyerName) + ' bought ' + esc(r.what) + ' for ' + usd(r.usdCents) + (r.ad ? '
"' + esc(r.ad.headline) + '"' : '') + dv + '' + pays + over + '' + link + ''; }).join(''); } load(); setInterval(load, 30000); })();