// Contract page: live facts from /api/contract (read from Polygon, cached 5 minutes), or the proposed rules before it is deployed. (async function () { const el = VAS.$('facts'); const esc = VAS.esc; const d = await VAS.getJSON('/api/contract').catch(() => ({})); const ex = d.explorer || 'https://polygonscan.com'; const addr = (a, note) => (a ? '' + esc(a) + '' : 'not deployed yet') + (note ? '
' + note + '' : ''); const sp = d.split || {}; const lv = (sp.levelBps || []).map(VAS.pct).join(' / '); const rows = [ ['Contract', addr(d.address, 'VASShop on Polygon' + (d.proposal ? '. Not deployed: the numbers below are proposals.' : ''))], ['Owner', addr(d.owner, 'Marty\'s Tangem hardware wallet. It can pause, set future prices and percentages, and change the keeper. It cannot take the reward pot.')], ['Split of each Boost', 'Resharer ' + VAS.pct(sp.resharerBps) + ' · reward pot ' + VAS.pct(sp.potBps) + ' · sponsor levels ' + esc(lv) + ' · company the rest'], ['Sign-up reward', VAS.usd(d.reward && d.reward.cents) + ' in POL, up to ' + esc(d.reward && d.reward.dailyCap) + ' a day per wallet' + (d.reward && !d.reward.payouts ? ' (payouts switched off for now)' : '')], ['Reward pot', d.live && d.pot ? VAS.polOf(d.pot.balanceWei) + ' POL now · ' + VAS.polOf(d.pot.fundedWei) + ' POL in · ' + VAS.polOf(d.pot.paidWei) + ' POL paid out' : '' + esc(d.error || 'not deployed yet') + ''], ['Sales', d.live ? (d.paused ? 'Paused' : 'Open') + ' · ' + VAS.n(d.orderCount) + ' orders' : 'not open yet'] ]; el.innerHTML = rows.map(r => '' + r[0] + '' + r[1] + '').join(''); })();