Payment proof + transparency (Marty 2026-11-13): every spot sale posts ONE message to the group's payments topic (tgproof.js: buyer, each member paid with POL and $ at the contract's price, company + fund line, Polygonscan verify + live ledger links; once across app copies via docstore.claim; never older than 2 h). New /ledger (every sale and payout, live, verify links) and /contract (verified source, owner, keeper, fee wallets, price feed, live reads, fixed split, how to check). Live sale toasts bottom-left on every page (real ledger rows only, newest 30 min). Nav + footer links. common.js?v=3, line.css?v=5. Smoke 76/76.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-13 10:35:08 -06:00
parent c6ca40a241
commit 87354e29b6
14 changed files with 259 additions and 15 deletions
+26
View File
@@ -0,0 +1,26 @@
// Live ledger (Marty 2026-11-13): /api/ledger, refreshed every 20 s. One row per spot sale: buyer, every member paid, company + fund.
(async () => {
BL.renderNav('/ledger'); BL.renderFooter();
const { $, esc, fmtPol, short } = BL;
const who = (name, addr) => name ? '@' + esc(name) : '<span class="mono">' + esc(short(addr)) + '</span>';
const usd = (wei, rate) => rate ? ' <span class="muted">($' + (Number(BigInt(wei) / 10n ** 12n) / 1e6 * rate).toFixed(2) + ')</span>' : '';
const KIND = { 0: 'bought by', 1: 'bought for', 2: 'gifted by the momentum fund to', 3: 'kept by the momentum fund' };
async function load() {
const d = await BL.getJSON('/api/ledger?n=100'); if (d.error) return;
const t = d.totals || {};
$('totals').innerHTML = [['Spots sold', t.spots || 0], ['Members', t.members || 0], ['POL paid out', fmtPol(t.paidOutWei || '0', 2)], ['Momentum fund', t.fundWei ? fmtPol(t.fundWei, 2) + ' POL' : '-']]
.map(x => '<div class="stat"><b>' + esc(x[1]) + '</b><span>' + esc(x[0]) + '</span></div>').join('');
$('rows').innerHTML = d.items.length ? d.items.map(it => {
const when = it.at ? new Date(it.at).toLocaleString() : '';
const pays = it.pays.map(p => '<li>' + (p.failed ? 'Bounced (to the fund): ' : '') + (p.role === 'sponsor' ? 'Sponsor' : 'Line ' + p.level + ' (spot #' + (it.spotId - p.level) + ')')
+ ': <b>' + fmtPol(p.wei) + ' POL</b>' + usd(p.wei, it.usd) + ' to ' + who(p.name, p.to) + '</li>').join('');
return '<div class="ledger-row"><div class="row" style="justify-content:space-between"><div><b>Spot #' + it.spotId + '</b> ' + esc(KIND[it.kind] || '') + ' ' + who(it.ownerName, it.owner)
+ ' <span class="muted">$5 = ' + fmtPol(it.valueWei) + ' POL</span></div><span class="muted small">' + esc(when) + '</span></div>'
+ (pays ? '<ul class="pays">' + pays + '</ul>' : '<p class="muted small">No earlier spots or sponsor to pay yet.</p>')
+ '<p class="small muted">Company + momentum fund: ' + fmtPol(it.houseWei) + ' POL' + usd(it.houseWei, it.usd)
+ ' &middot; <a target="_blank" rel="noopener" href="' + esc(d.explorer + '/tx/' + it.tx) + '">Verify on Polygonscan</a></p></div>';
}).join('') : '<p class="muted">No spot sales yet.</p>';
$('upd').textContent = 'Updated ' + new Date().toLocaleTimeString();
}
await load(); setInterval(load, 20000);
})();