// Contract proof page (trust pack 2026-11-14): live facts from /api/contract (read from Polygon, cached 5 minutes on the server). (async function () { VBB.renderNav('/contract'); VBB.renderFooter(); const el = document.getElementById('facts'); const esc = VBB.esc; let d; try { d = await VBB.getJSON('/api/contract'); } catch (e) { d = {}; } const ex = d.explorer || 'https://polygonscan.com'; const addr = (a, note) => a ? '' + esc(VBB.short(a)) + '' + (note ? '
' + note + '' : '') : 'not read yet'; const pol = w => { try { const v = BigInt(w || 0); return (Number(v / 10n ** 14n) / 1e4).toFixed(4) + ' POL'; } catch (e) { return '0 POL'; } }; if (!d.address) { el.innerHTML = 'The contract address is not set on this copy of the site.'; return; } const rows = [ ['Contract', addr(d.address, 'VBBShop on ' + (d.chainId === 137 ? 'Polygon' : 'chain ' + d.chainId))], ['Source code', 'Verified on Sourcify (exact match). Polygonscan: ' + (d.verified && d.verified.polygonscan === 'done' ? 'verified' : 'pending')], ['Owner', addr(d.owner, 'A Tangem hardware wallet. It can pause new sales, set package prices, and change the keeper and the prize wallet. It cannot move anyone\'s money or change the split.')], ['Prize wallet', addr(d.prizeWallet, 'Receives the 10% prize share of each purchase and pays the weekly leaderboard winners.')], ['Company', addr(d.company, 'Viral Banner Blitz. Fixed in the contract when it was deployed.')], ['Keeper', addr(d.keeper, 'The site\'s signing key. It only signs which sponsor a buyer has, once, on their first purchase.')], ['Sales', d.live ? (d.paused ? 'Paused' : 'Open') + ' ยท ' + VBB.n(d.orderCount) + ' purchases so far' : '' + esc(d.error || 'not read yet') + ''], ['Held by the contract', d.live ? pol(d.balanceWei) + (BigInt(d.totalOwedWei || 0) > 0n ? ' (all of it owed to wallets whose payment bounced, waiting for them to claim)' : ' (nothing is kept: every purchase is paid out in the same transaction)') : 'not read yet'] ]; const psn = document.getElementById('psnote'); if (psn) psn.textContent = d.verified && d.verified.polygonscan === 'done' ? 'Its source code is verified on Polygonscan (Contract tab) and on Sourcify (exact match).' : 'Its source code is verified on Sourcify (exact match); the Polygonscan verification check is pending, so use the Sourcify link to read the source.'; el.innerHTML = '' + rows.map(r => '' + r[0] + '' + r[1] + '').join('') + ''; })();