Weekly prize pot (Marty 2026-11-13): 10% of the week's sales, $20 floor topped up by the company, $50 cap kept internal; half per leaderboard, split 50/30/20; leaderboard page shows the live pot, never the cap; smoke 100/100

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-13 15:42:03 -06:00
parent 832395daa4
commit cb77582926
6 changed files with 22 additions and 9 deletions
+8 -2
View File
@@ -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 },