diff --git a/.env.example b/.env.example
index c931a79..e1f66ee 100644
--- a/.env.example
+++ b/.env.example
@@ -16,8 +16,10 @@ MAX_QUEUED_PER_MEMBER=3
CREDIT_PACKS=10:3,40:10 # credits:usd, shown as coming soon
LOOK_USD=2 # banner look, shown as coming soon
SPONSOR_PCT=30 # planned on-chain split (company gets the rest); not used in v1
-PRIZES_VISITORS=15,7,3 # weekly prizes in USD (paid in POL), displayed only
-PRIZES_SOURCES=15,7,3
+PRIZE_PCT=10 # weekly prize pot = this % of the week's sales
+PRIZE_FLOOR_USD=20 # never less (company tops it up)
+PRIZE_CAP_USD=50 # never more (internal, not shown)
+PRIZE_PLACES=50,30,20 # % of each board's half, 1st/2nd/3rd
LINK_PROBE=1 # 0 skips the target-link frame check (local tests only)
CF_PROXIED=0 # 1 only if Cloudflare proxies the domain (then cf-connecting-ip is trusted)
NETWORK_LOOKUP_URL= # default InstantAdPay /api/network/member; empty = off
diff --git a/config.js b/config.js
index 4d4c088..ac4bde2 100644
--- a/config.js
+++ b/config.js
@@ -35,7 +35,10 @@ function get() {
packs: list(e.CREDIT_PACKS, '10:3,40:10').map(x => { const [credits, usd] = x.split(':').map(Number); return { credits, usd }; }).filter(x => x.credits > 0 && x.usd > 0),
lookUsd: Number(e.LOOK_USD || 2), // banner look (border + hover teaser), per banner, one-time
split: { sponsorPct: num(e.SPONSOR_PCT, 30, 0, 100), companyPct: 100 - num(e.SPONSOR_PCT, 30, 0, 100) }, // on-chain later, no line
- prizes: { visitors: list(e.PRIZES_VISITORS, '15,7,3').map(Number).filter(x => x >= 0), sources: list(e.PRIZES_SOURCES, '15,7,3').map(Number).filter(x => x >= 0) }, // USD per place, paid in POL
+ // weekly prize pot (Marty 2026-11-13): 10% of the week's sales, never under the floor (the company tops it up), capped at $50.
+ // Half the pot per leaderboard, split 50/30/20 across the top three. The cap is internal: the public page never shows it.
+ prizePot: { pct: num(e.PRIZE_PCT, 10, 0, 100), floorUsd: num(e.PRIZE_FLOOR_USD, 20, 0, 100000), capUsd: num(e.PRIZE_CAP_USD, 50, 0, 100000),
+ places: list(e.PRIZE_PLACES, '50,30,20').map(Number).filter(x => x >= 0) },
linkProbe: e.LINK_PROBE !== '0', // check the target link answers and allows frames (off in the local smoke test)
iapBase: String(e.IAP_URL || 'https://instantadpay.com').replace(/\/+$/, ''),
lsBase: String(e.LS_URL || 'https://linkspin.app').replace(/\/+$/, ''),
diff --git a/public/assets/leaders.js b/public/assets/leaders.js
index fb77fea..869957c 100644
--- a/public/assets/leaders.js
+++ b/public/assets/leaders.js
@@ -2,12 +2,13 @@
(async function () {
VBB.renderNav('/leaders'); VBB.renderFooter();
const $ = VBB.$, esc = VBB.esc;
- // weekly prizes from config (Marty 2026-11-13): displayed only, no payout code yet
+ // weekly prize pot (Marty 2026-11-13): grows with sales from a floor; displayed only, no payout code yet
const c = await VBB.getConfig().catch(() => ({}));
const pz = c.prizes || {}; const place = ['1st', '2nd', '3rd', '4th', '5th', '6th', '7th', '8th', '9th', '10th'];
const plist = (title, arr) => '
' + title + '
' + arr.map((v, i) => '- ' + place[i] + ': $' + VBB.n(v) + ' in POL
').join('') + '
';
if ((pz.visitors || []).length || (pz.sources || []).length) {
$('pz').innerHTML = ((pz.visitors || []).length ? plist('Most visitors sent', pz.visitors) : '') + ((pz.sources || []).length ? plist('Most traffic sources', pz.sources) : '');
+ if (pz.pot) $('potLbl').textContent = 'Prize pot this week: ' + (pz.atFloor ? 'at least ' : '') + '$' + VBB.n(pz.pot) + ', and it grows with sales. Half goes to each leaderboard, paid in POL to the top three (dollar value, converted to POL).';
$('prizes').hidden = false;
}
const d = await VBB.getJSON('/api/leaders');
diff --git a/public/leaders.html b/public/leaders.html
index 7610400..ff053ad 100644
--- a/public/leaders.html
+++ b/public/leaders.html
@@ -27,7 +27,7 @@
This week
Weekly leaderboards
Monday to Sunday, Central time. Only verified visitors count: a real browser, on the page a few seconds, once a day per visitor.
- Weekly prizes
Paid in POL to the top three on each leaderboard for the week (dollar value, converted to POL).
+ Weekly prizes
Paid in POL to the top three on each leaderboard for the week (dollar value, converted to POL).
Most traffic sources
Different websites your visitors came from (the referring site), so spreading your link widely counts.
diff --git a/qa/smoke.mjs b/qa/smoke.mjs
index c94cf01..974223d 100644
--- a/qa/smoke.mjs
+++ b/qa/smoke.mjs
@@ -102,7 +102,8 @@ async function main() {
ok(cfg.loopSize === 5 && cfg.perShift === 3 && cfg.viewsPerCycle === 150 && cfg.visitSeconds === 2, 'config from env', cfg);
ok(fs.readFileSync(path.join(OUT, 'server.log'), 'utf8').includes('files (prototype mode)'), 'server says prototype mode (no DOCSTORE_URL)');
ok(JSON.stringify(cfg.packs) === '[{"credits":10,"usd":3},{"credits":40,"usd":10}]' && cfg.lookUsd === 2 && cfg.freeCreditsPerDay === 1, 'approved defaults: packs 10 for $3 + 40 for $10, look $2, 1 free credit a day', cfg);
- ok(JSON.stringify(cfg.prizes) === '{"visitors":[15,7,3],"sources":[15,7,3]}', 'approved weekly prizes: $15/$7/$3 per leaderboard', cfg.prizes);
+ ok(cfg.prizes && cfg.prizes.pot === 20 && JSON.stringify(cfg.prizes.visitors) === '[5,3,2]' && JSON.stringify(cfg.prizes.sources) === '[5,3,2]', 'prize pot: $20 floor with no sales, $5/$3/$2 per board', cfg.prizes);
+ ok(!JSON.stringify(cfg).includes('capUsd') && !JSON.stringify(cfg).includes('"cap'), 'public config never shows the prize cap', cfg);
console.log('3. splash');
const anon = client();
@@ -261,7 +262,7 @@ async function main() {
await pg.goto(BASE + '/leaders', { waitUntil: 'domcontentloaded' }); await pg.waitForSelector('#lbVisitors table', { timeout: 8000 });
ok((await pg.textContent('#lbVisitors')).includes('@smokeleader'), name + ': leaderboard page shows the leader');
await pg.screenshot({ path: path.join(OUT, 'leaders-' + name + '.png'), fullPage: true });
- ok(/1st: \$15 in POL/.test(await pg.textContent('#pz')), name + ': leaderboard page shows the weekly prizes');
+ ok(/1st: \$5 in POL/.test(await pg.textContent('#pz')) && /at least \$20, and it grows with sales/.test(await pg.textContent('#prizes')) && !/50/.test(await pg.textContent('#prizes')), name + ': leaderboard page shows the pot, never the cap');
await pg.goto(BASE + '/packages', { waitUntil: 'domcontentloaded' }); await pg.waitForTimeout(400);
const pk = await pg.textContent('#pk');
ok(/10 post credits for \$3/.test(pk) && /40 post credits for \$10/.test(pk) && /\$2 per banner/.test(pk) && /Coming soon/i.test(pk), name + ': packages page shows the planned prices as coming soon', pk.slice(0, 200));
diff --git a/server.js b/server.js
index 42d8363..aa36e1b 100644
--- a/server.js
+++ b/server.js
@@ -199,11 +199,17 @@ const server = http.createServer(async (req, res) => {
}
}
+ // this week's prize pot. v1 takes no payments, so week sales are 0 and the pot sits at the floor until the contract step.
+ function prizes(weekSalesUsd = 0) {
+ const z = C.prizePot; const pot = Math.min(z.capUsd, Math.max(z.floorUsd, weekSalesUsd * z.pct / 100));
+ const board = pot / 2, r2 = x => Math.round(x * 100) / 100, per = z.places.map(x => r2(board * x / 100));
+ return { pot: r2(pot), atFloor: pot <= z.floorUsd, visitors: per, sources: per };
+ }
// -- public API
if (p === '/api/config' && req.method === 'GET') {
return json(res, 200, { site: C.site, siteName: C.siteName, chainId: C.chainId, chainName: C.chainName, rpc: C.publicRpc, walletConnectProjectId: C.walletConnectProjectId,
loopSize: C.loopSize, perShift: C.perShift, viewsPerCycle: C.viewsPerCycle, visitSeconds: C.visitSeconds, freeCreditCap: C.freeCreditCap, maxQueued: C.maxQueuedPerMember,
- freeCreditsPerDay: C.freeCreditsPerDay, packs: C.packs, lookUsd: C.lookUsd, prizes: C.prizes, sso: networksso.enabled() });
+ freeCreditsPerDay: C.freeCreditsPerDay, packs: C.packs, lookUsd: C.lookUsd, prizes: prizes(), sso: networksso.enabled() });
}
if (p === '/api/splash' && req.method === 'GET') return json(res, 200, loop.view(24), { 'Cache-Control': 'no-store' });
if (p === '/api/leaders' && req.method === 'GET') {
@@ -313,7 +319,7 @@ const server = http.createServer(async (req, res) => {
if (p === '/api/admin/status' && req.method === 'GET') {
const S = store.state(); const L = store.ledger(); const t = store.today();
const byStatus = {}; for (const e of L) byStatus[e.status] = (byStatus[e.status] || 0) + e.views;
- return json(res, 200, { day: store.ctDay(), week: store.ctWeek(), config: { split: C.split, packs: C.packs, lookUsd: C.lookUsd, prizes: C.prizes, freeCreditsPerDay: C.freeCreditsPerDay, loopSize: C.loopSize, perShift: C.perShift, viewsPerCycle: C.viewsPerCycle, visitSeconds: C.visitSeconds, perIpDay: C.perIpDay, freeCreditCap: C.freeCreditCap, maxQueued: C.maxQueuedPerMember },
+ return json(res, 200, { day: store.ctDay(), week: store.ctWeek(), config: { split: C.split, packs: C.packs, lookUsd: C.lookUsd, prizePot: C.prizePot, prizes: prizes(), freeCreditsPerDay: C.freeCreditsPerDay, loopSize: C.loopSize, perShift: C.perShift, viewsPerCycle: C.viewsPerCycle, visitSeconds: C.visitSeconds, perIpDay: C.perIpDay, freeCreditCap: C.freeCreditCap, maxQueued: C.maxQueuedPerMember },
loop: { filled: S.loop.length, size: C.loopSize, ids: S.loop, nextOut: S.loop.length ? S.loop[S.loop.length - 1] : null },
queue: { length: S.queue.length, next: S.queue.slice(0, 20) }, progress: S.progress, held: S.progress >= C.perShift && !S.queue.length,
today: { visits: t.visits || 0, shifts: t.shifts || 0, cycles: t.cycles || 0, posts: t.posts || 0, clicks: t.clicks || 0 },