1,000-member POL drop (Marty 2026-10-10): snapshot of activated members at the milestone, 1 POL each from a dedicated wallet, notices for paid and missed

milestone.js watches the account count (site config milestoneMode off|dry|armed, milestoneTarget 1000, milestonePol 1). At the target it freezes the eligibility list: wallet activated on chain (member record with activated flag), not on the no-payout list, not suspended, one payment per wallet. Payments go one at a time from IAP_MILESTONE_KEY with tx hashes per row and never twice; the Telegram start post waits for the wallet to hold the full amount. Paid members get an in-app notice + email with their Polygonscan link; everyone else gets the missed-it nudge (link a wallet / switch on payouts), email only with the newsletter opt-in. One start and one finish Telegram post (Discord mirrored), the total logged in the P&L as a rewards cost against Receiver A. Admin: /api/admin/milestone (view, mode, snapshot, recheck, pay, settle, notify-missed, reset-before-payment).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-10 09:35:50 -05:00
parent 4b7b1c5d95
commit 310992e40f
2 changed files with 206 additions and 1 deletions
+22 -1
View File
@@ -27,7 +27,8 @@ const chatbot = require('./chatbot');
const fraud = require('./fraud');
const coach = require('./coach'); // coaching view, nudges, digest, prospects, link stats
const tank = require('./tank');
const walletnudge = require('./walletnudge'); // players with POL waiting in the games and no wallet (2026-10-07) // holding tank: unsponsored free members, adoptions, pay-it-forward
const walletnudge = require('./walletnudge');
const milestone = require('./milestone'); // players with POL waiting in the games and no wallet (2026-10-07) // holding tank: unsponsored free members, adoptions, pay-it-forward
const legacy = require('./legacy'); // Faucet Wave / Tier One Ads bridge: welcome-back credits for listed emails
const traffic = require('./traffic'); // public page views by referring domain (admin Traffic tab)
const promos = require('./promos');
@@ -551,6 +552,12 @@ async function boot() {
message: async (to, subject, html) => { await messages.deliver(1, ADMIN_EMAIL || 'house@instantadpay.com', [to], subject, html, 'notice'); } });
setTimeout(() => walletnudge.tick().catch(e => console.error('walletnudge', e.message)), 3 * 60 * 1000); // past the deploy overlap window
setInterval(() => walletnudge.tick().catch(e => console.error('walletnudge', e.message)), 60 * 60 * 1000);
// 1,000-member POL drop (Marty 2026-10-10): watches the account count every 2 minutes while milestoneMode is dry or armed
milestone.init({ dataDir: DATA_DIR, accounts, chain, mailer, ledger, optedIn: updates.optedIn, site: 'https://instantadpay.com', siteConfig, noPayoutSet,
message: async (to, subject, html) => { await messages.deliver(1, ADMIN_EMAIL || 'house@instantadpay.com', [to], subject, html, 'notice'); },
telegram: async html => { const sc = siteConfig(); if (sc.telegramChatId) await telegramSend(sc.telegramChatId, html, sc.telegramTopicId); if (sc.telegramEchoChatId && String(sc.telegramEchoEvents || 'payouts') !== 'none') await telegramSend(sc.telegramEchoChatId, html, sc.telegramEchoTopicId); } });
setTimeout(() => milestone.tick().catch(e => console.error('milestone', e.message)), 4 * 60 * 1000);
setInterval(() => milestone.tick().catch(e => console.error('milestone', e.message)), 2 * 60 * 1000);
await fraud.init({ dataDir: DATA_DIR });
{ // a suspended account is signed out everywhere: every member route sees no session
const realFrom = auth.fromRequest.bind(auth);
@@ -4399,6 +4406,20 @@ const server = http.createServer(async (req, res) => {
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
const r = await snapshot.post(); return json(res, r.error ? 400 : 200, r);
}
// -- 1,000-member drop: view, mode (off|dry|armed via site config), snapshot now, pay now, resend the missed-it notices, reset (only before any payment)
if (p === '/api/admin/milestone') {
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
if (req.method === 'GET') return json(res, 200, await milestone.view());
const b = await readBody(req); const act = String(b.action || '');
if (act === 'mode') { const m = ['off', 'dry', 'armed'].includes(b.mode) ? b.mode : 'off'; const cur = siteConfig(); fs.writeFileSync(SITE_FILE, JSON.stringify(Object.assign(cur, { milestoneMode: m }, b.target ? { milestoneTarget: Number(b.target) } : {}, b.pol ? { milestonePol: Number(b.pol) } : {}), null, 2)); return json(res, 200, await milestone.view()); }
if (act === 'snapshot') { await milestone.snapshot(!!b.force); return json(res, 200, await milestone.view()); }
if (act === 'recheck') { await milestone.recheck(); return json(res, 200, await milestone.view()); }
if (act === 'pay') { const r = await milestone.pay(); return json(res, 200, Object.assign({ result: r }, await milestone.view())); }
if (act === 'settle') { await milestone.settle(); return json(res, 200, await milestone.view()); }
if (act === 'notify-missed') { const r = await milestone.notifyMissed(); return json(res, 200, Object.assign({ result: r }, await milestone.view())); }
if (act === 'reset') { const v = await milestone.view(); if (v.paid || v.sent) return json(res, 400, { error: 'Payments exist; the record stays.' }); milestone.reset(); return json(res, 200, await milestone.view()); }
return json(res, 400, { error: 'Unknown action.' });
}
if (p === '/api/admin/site' && req.method === 'GET') {
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
return json(res, 200, { site: siteConfig() });