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
+27 -2
View File
@@ -17,7 +17,7 @@ window.BL = (function () {
async function renderNav(active) {
const c = await getConfig().catch(() => ({}));
const n = document.createElement('nav');
const links = [['/', 'Home'], ['/board', 'Board'], ['/how', 'How it works'], ['/join', 'Get a spot'], ['/my', 'My Spots']];
const links = [['/', 'Home'], ['/board', 'Board'], ['/how', 'How it works'], ['/ledger', 'Ledger'], ['/join', 'Get a spot'], ['/my', 'My Spots']];
n.innerHTML = '<div class="wrap"><a class="brand" href="/"><img src="/art/mark.svg" alt="" width="38" height="38"><span class="logo-wrap"><span class="logo">Downline <b>Banners</b></span>'
+ '<span class="byline">Part of the <b>Crypto Team Build</b> Network</span></span></a><div class="links">'
+ links.map(l => '<a href="' + l[0] + '"' + (l[0] === active ? ' class="active"' : '') + '>' + l[1] + '</a>').join('') + '</div></div>';
@@ -35,8 +35,9 @@ window.BL = (function () {
f.className = 'bl-foot';
f.innerHTML = '<div class="wrap"><p>Part of the Crypto Team Build Network</p>'
+ '<p class="muted small">A spot buys 300 guaranteed views on the board and a place in the line. Nothing is promised: you are paid only when spots sell after yours, and a spot can earn back less than it cost.</p>'
+ '<p class="small"><a href="/how">How it works</a> &middot; <a href="/board">Board</a> &middot; <a href="/my">My Spots</a></p></div>';
+ '<p class="small"><a href="/how">How it works</a> &middot; <a href="/board">Board</a> &middot; <a href="/ledger">Live ledger</a> &middot; <a href="/contract">Contract proof</a> &middot; <a href="/my">My Spots</a></p></div>';
document.body.appendChild(f);
toasts();
}
// one spot tile; href goes through the /go relay, which counts the click
function tile(t, opts) {
@@ -50,6 +51,30 @@ window.BL = (function () {
if (opts && opts.meta) { const m = document.createElement('span'); m.className = 'lot-meta'; m.textContent = t.t === 'spot' ? '#' + t.id : 'network'; a.appendChild(m); }
return a;
}
// live sale toasts (Marty 2026-11-13): real sales from the ledger only, bottom-left, one at a time, never older than 30 minutes
let toastsOn = false;
async function toasts() {
if (toastsOn) return; toastsOn = true;
const seen = new Set(); let first = true;
const box = document.createElement('div'); box.className = 'bl-toasts'; box.setAttribute('aria-live', 'polite'); document.body.appendChild(box);
const show = it => {
const top = it.pays.filter(p => !p.failed).sort((a, b) => (BigInt(b.wei) > BigInt(a.wei) ? 1 : -1))[0];
const name = it.ownerName ? '@' + esc(it.ownerName) : 'A member';
const el = document.createElement('a'); el.className = 'bl-toast'; el.href = '/ledger';
el.innerHTML = '<b>' + name + '</b> took spot #' + it.spotId
+ (top ? '<br><span>' + (it.pays.length > 1 ? it.pays.length + ' members paid, ' : '') + (top.name ? '@' + esc(top.name) : 'a member') + ' got ' + fmtPol(top.wei, 2) + ' POL</span>' : '<br><span>paid on-chain, $5</span>');
box.appendChild(el); requestAnimationFrame(() => el.classList.add('in'));
setTimeout(() => { el.classList.remove('in'); setTimeout(() => el.remove(), 400); }, 7000);
};
const tick = async () => {
let d; try { d = await getJSON('/api/ledger?n=5'); } catch (e) { return; } if (!d || !d.items) return;
const fresh = d.items.filter(it => !seen.has(it.tx) && (!it.at || Date.now() - it.at < 30 * 60000));
d.items.forEach(it => seen.add(it.tx));
const list = first ? fresh.slice(0, 1) : fresh.reverse(); first = false;
list.forEach((it, i) => setTimeout(() => show(it), 1500 + i * 8000));
};
tick(); setInterval(tick, 25000);
}
function withRef(href, sponsor) { if (!sponsor) return href; return href + (href.includes('?') ? '&' : '?') + 'ref=' + encodeURIComponent(sponsor); }
return { $, esc, getConfig, fmtPol, short, framed, status, getJSON, post, renderNav, renderFooter, tile, withRef };
})();
+23
View File
@@ -0,0 +1,23 @@
// Contract proof (Marty 2026-11-13): /api/contract answers straight from the live contract.
(async () => {
BL.renderNav('/contract'); BL.renderFooter();
const { $, esc, fmtPol } = BL;
const d = await BL.getJSON('/api/contract');
if (d.error) { $('facts').innerHTML = '<p class="note err">' + esc(d.error) + '</p>'; return; }
const ex = d.explorer;
const addr = (a, label) => a ? '<a class="mono" target="_blank" rel="noopener" href="' + esc(ex + '/address/' + a) + '">' + esc(a) + '</a>' + (label ? ' <span class="muted small">' + esc(label) + '</span>' : '') : '-';
const rows = [
['Contract', addr(d.address) + ' <span class="badge-ok">Verified source</span> <a class="small" target="_blank" rel="noopener" href="' + esc(ex + '/address/' + d.address + '#code') + '">read the code</a>'],
['Network', esc(d.chain) + ' (chain ' + esc(d.chainId) + ')'],
['Deployed', '<a class="mono" target="_blank" rel="noopener" href="' + esc(ex + '/tx/' + d.deployTx) + '">' + esc(d.deployTx.slice(0, 18)) + '...</a>' + (d.deployBlock ? ' block ' + esc(d.deployBlock) : '')],
['Owner', addr(d.owner, 'can pause new sales and change the keeper; cannot move funds or change the split')],
['Keeper', addr(d.keeper, 'the only wallet allowed to make momentum-fund buys')],
['Company A', addr(d.feeA)], ['Company B', addr(d.feeB)],
['Price feed', addr(d.priceFeed, 'Chainlink POL/USD')],
['Spot price now', d.quoteWei ? fmtPol(d.quoteWei) + ' POL ($5)' : '-'],
['Spots sold', esc(d.spotCount || '0')],
['Momentum fund', d.fundBalance ? fmtPol(d.fundBalance) + ' POL' : '-'],
['Sales', d.paused === 'true' ? 'paused' : 'open']];
$('facts').innerHTML = '<table class="tbl">' + rows.map(r => '<tr><th style="width:160px">' + r[0] + '</th><td style="word-break:break-all">' + r[1] + '</td></tr>').join('') + '</table>';
$('split').innerHTML = '<tr><th>Share</th><th>To</th></tr>' + d.split.map(s => '<tr><td>' + esc(s.share) + '</td><td>' + esc(s.to) + '</td></tr>').join('');
})();
+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);
})();
+11
View File
@@ -49,3 +49,14 @@ nav .links a.active{color:var(--mint-ink);background:var(--mint)}
.brand img{flex:none;filter:drop-shadow(0 4px 14px rgba(155,123,255,.35))}
.brand .logo{letter-spacing:-.02em}
.ls-pick{margin:6px 0 4px}.ls-pick .row{gap:8px}
.ledger-row{border-top:1px solid var(--line);padding:12px 0}
.ledger-row:first-child{border-top:0}
.ledger-row .pays{margin:6px 0 4px;padding-left:18px;font-size:14px}
.badge-ok{display:inline-block;font-size:11.5px;font-weight:700;padding:2px 8px;border-radius:999px;background:var(--mint-soft);color:var(--mint);border:1px solid var(--mint-line);margin-left:6px}
.bl-toasts{position:fixed;left:max(16px,env(safe-area-inset-left,0px));bottom:max(16px,env(safe-area-inset-bottom,0px));z-index:50;display:flex;flex-direction:column;gap:8px;pointer-events:none}
.bl-toast{pointer-events:auto;display:block;max-width:300px;background:var(--panel-solid);border:1px solid var(--mint-line);border-radius:14px;padding:10px 14px;color:var(--ink);font-size:13.5px;line-height:1.35;
box-shadow:0 12px 30px -12px rgba(0,0,0,.8);opacity:0;transform:translateY(10px);transition:opacity .35s ease,transform .35s ease;text-decoration:none!important}
.bl-toast.in{opacity:1;transform:none}
.bl-toast span{color:var(--muted);font-size:12.5px}
@media (prefers-reduced-motion:reduce){.bl-toast{transition:none}}
@media (max-width:520px){.bl-toast{max-width:calc(100vw - 32px)}}