Trust pack (Marty 2026-11-14): contract proof, live ledger, proof toasts, Telegram sale cards, legal pages, network footer.
- proof.js: /api/ledger (each VBBShop purchase with its split read from the receipt's Paid/PaymentFailed events, else the contract's fixed 30/10/60 math; weekly prize transfers with their transactions), /api/contract (owner, prize wallet, company, keeper, paused, orders, balance and owed, read live and cached 5 min; Sourcify exact match, Polygonscan pending).
- Telegram (CTB Rewards bot, payments topic, TG_TOKEN/TG_CHAT/TG_PAY_TOPIC same as Downline Banners): one photo card per purchase (prebuilt VBB proof image rotated, buyer, sponsor/prize/company split in POL, this week's purchases + prize pot, Polygonscan + ledger links) and one line per confirmed prize payout. Hooks: shop.setHook (newly credited purchases only) and prize.setHook (confirmed transfers); once per tx via an in-process guard plus docstore.claim; nothing older than 2 hours.
- Pages /contract, /ledger, /terms, /disclaimer (Earnings Disclaimer), /privacy (TrustClickz, real mechanics: advertising not income, same-transaction split, prize wallet holds the 10% until Monday, no refunds on-chain, one-time purchases, crypto risk, data incl. hashed visit checks and the network hub); sitemap.
- Footer: Terms, Earnings Disclaimer, Privacy, Contract, Ledger, Support, company line, 'Part of the network' from the hub (netsites.js, /api/network-sites, fallback list), VBB marked current. Toasts add purchases and prize payouts.
- tools/proof-art.mjs renders public/art/proof/vbb-proof-{pink,blue,yellow}.png. common.js?v=5, vbb.css?v=6.
chain.mjs 49/49 (real contract on anvil + stand-in Telegram: exact split, 2 cards, no repost on rescans, 6 prize lines). smoke 241/241.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,8 @@ const ADDR_RE = /^0x[0-9a-fA-F]{40}$/;
|
||||
const BOARDS = ['visitors', 'sources'];
|
||||
const COMPANY = '0x7627fc78876948ac9d95c1c9eb061e7d6d647b70';
|
||||
let C = null, key = null, D = null, busy = false, timer = null;
|
||||
let onConfirmed = null; // proof.js: one Telegram line per confirmed prize transfer (2026-11-14); this module still posts nothing itself
|
||||
function setHook(fn) { onConfirmed = typeof fn === 'function' ? fn : null; }
|
||||
const st = { prepared: 0, paid: 0, lastError: null };
|
||||
const FILE = () => path.join(C.dataDir, 'prizes.json');
|
||||
|
||||
@@ -166,7 +168,7 @@ function watchReceipts(week) {
|
||||
const plan = D.weeks[week]; if (!plan) { watching.delete(week); return; }
|
||||
for (const t of plan.transfers) {
|
||||
if (t.status !== 'sent' || !t.tx) continue;
|
||||
try { const r = await shop.receipt(t.tx); if (r.found) { t.status = r.status === '0x1' ? 'confirmed' : 'reverted'; t.block = parseInt(r.blockNumber, 16); save(); } } catch (e) {}
|
||||
try { const r = await shop.receipt(t.tx); if (r.found) { t.status = r.status === '0x1' ? 'confirmed' : 'reverted'; t.block = parseInt(r.blockNumber, 16); save(); if (t.status === 'confirmed' && onConfirmed) { try { onConfirmed(plan, t); } catch (e) {} } } } catch (e) {}
|
||||
}
|
||||
const open = plan.transfers.some(t => t.status === 'sent');
|
||||
if (!open && (plan.status === 'sent' || plan.status === 'paying')) { plan.status = plan.transfers.every(t => t.status === 'confirmed') ? 'paid' : 'partial'; plan.payment.doneAt = Date.now(); save(); }
|
||||
@@ -184,4 +186,4 @@ function history(n) {
|
||||
function plans() { return Object.values(D.weeks).sort((a, b) => b.week.localeCompare(a.week)); }
|
||||
function view() { return Object.assign({ keyOn: !!key, keyAddress: key ? key.address.toLowerCase() : null, prizeWallet: C.prizePot.wallet, weeks: Object.keys(D.weeks).length }, st); }
|
||||
|
||||
module.exports = { init, pot, prepare, pay, quotePlan, history, plans, view, prevWeek, auto };
|
||||
module.exports = { setHook, init, pot, prepare, pay, quotePlan, history, plans, view, prevWeek, auto };
|
||||
|
||||
Reference in New Issue
Block a user