Files
banner-line/public/assets/contract.js
T

25 lines
2.0 KiB
JavaScript

// 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>';
BL.zone($('zContract'), 'contract');
$('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('');
})();