f26ac15712
$10 one-time DraftPosition purchases (sponsor 25%, L2-5 5%, 10% Best Coach pot, 45% company) with keeper-signed hub-line vouchers; pure draft engine with a mocked clock; no contact data anywhere; Telegram to an outbox unless TG_LIVE=1. Unit 60/60, smoke 156/156 (Playwright 1280/390). Not deployed. 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): every position with every share paid in the same transaction (sponsor 25%, levels 2-5 5%, with each
|
|
// person's place in the buyer's line), who was passed over, the Best Coach pot and the company, plus every Best Coach payout, from
|
|
// /api/ledger, refreshed every 30 seconds.
|
|
(function () {
|
|
FX.renderNav('/ledger'); FX.renderFooter();
|
|
const esc = FX.esc;
|
|
const pol = w => FX.polOf(w) + ' POL';
|
|
const usd = c => '$' + (Number(c || 0) / 100).toFixed(2);
|
|
const who = (a, nm) => nm ? '@' + esc(nm) : '<span class="small">' + esc(FX.short(a || '')) + '</span>';
|
|
async function load() {
|
|
let d; try { d = await FX.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"><span>Positions on-chain</span><b>' + FX.n(t.positions) + '</b></div>'
|
|
+ '<div class="stat"><span>To the Best Coach pot</span><b>' + pol(t.potWei) + '</b><em>10% of every position</em></div>'
|
|
+ '<div class="stat"><span>In positions</span><b>' + usd(t.usdCents) + '</b><em>at the price when bought</em></div>'
|
|
+ '<div class="stat"><span>Withdrawals needed</span><b>0</b><em>every share is paid in the same transaction</em></div>';
|
|
const body = document.querySelector('#rows tbody');
|
|
if (!d.items.length) body.innerHTML = '<tr><td colspan="4" class="muted">No positions yet. The first one shows here within a minute of its transaction.</td></tr>';
|
|
else body.innerHTML = d.items.map(r => {
|
|
const link = '<a href="' + esc(ex) + '/tx/' + esc(r.tx) + '" target="_blank" rel="noopener">verify</a>';
|
|
const pays = (r.pays || []).map(p => p.level === 0 ? '5xYourTeam: ' + pol(p.wei) : p.level === 6 ? 'Best Coach pot: ' + pol(p.wei)
|
|
: (p.level === 1 ? 'Sponsor 25%' : 'Level ' + p.level + ' 5%') + ': ' + pol(p.wei) + ' to ' + (p.to ? who(p.to, p.name) : 'sponsor') + (p.depth && p.depth !== p.level ? ' <span class="small">(place ' + p.depth + ')</span>' : '') + (p.failed ? ' <span class="small">(bounced, waiting in the contract for them to claim)</span>' : '')).join('<br>');
|
|
const over = (r.passedOver || []).length ? '<br><span class="small">Passed over (no position yet): ' + r.passedOver.map(o => (o.name ? '@' + esc(o.name) : esc(FX.short(o.who))) + ' at place ' + o.depth).join(', ') + '</span>' : '';
|
|
return '<tr><td class="small">' + FX.when(r.at) + '</td><td>' + who(r.buyer, r.buyerName) + ' bought ' + esc(r.what) + ' for ' + usd(r.usdCents) + '</td><td class="small">' + pays + over + '</td><td>' + link + '</td></tr>';
|
|
}).join('');
|
|
const pb = document.querySelector('#payouts tbody');
|
|
pb.innerHTML = (d.payouts || []).length ? d.payouts.map(p => '<tr><td>' + esc(p.week) + '</td><td>#' + esc(p.rank) + ' ' + who(p.coach, p.username) + '</td><td>' + pol(p.wei) + '</td><td><a href="' + esc(ex) + '/tx/' + esc(p.tx) + '" target="_blank" rel="noopener">verify</a></td></tr>').join('')
|
|
: '<tr><td colspan="4" class="muted">No Best Coach payouts yet. Each one is listed here with its transaction.</td></tr>';
|
|
}
|
|
load(); setInterval(load, 30000);
|
|
})();
|