P&L: Game payouts card, an all-time running total of every game wallet's payouts read from Polygon (incremental, cached); PolHunter ledger detail folded under it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4904,6 +4904,7 @@ const server = http.createServer(async (req, res) => {
|
||||
if (p === '/api/admin/pnl' && req.method === 'GET') {
|
||||
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
|
||||
const hunt = await huntLedger(); // marketing spend that never touches this contract
|
||||
let gamesAll = null; try { gamesAll = await gamestats.allTime(); } catch (e) { gamesAll = { error: e.message }; } // every game wallet's payouts, all time, from Polygon
|
||||
const days = Math.max(0, Number(u.searchParams.get('days') || 30));
|
||||
let latest = 0; try { latest = parseInt(await chain.rpc('eth_blockNumber', []), 16); } catch (e) {}
|
||||
const fromBlock = days ? latest - Math.round(days * 43200) : 0;
|
||||
@@ -4926,7 +4927,7 @@ const server = http.createServer(async (req, res) => {
|
||||
purchases: { count: purchases.length, volumeWei: sum(purchases, e => e.paidWei).toString(), usdCents: purchases.reduce((n, e) => n + (e.priceCents || 0), 0), byPackage: byPkg },
|
||||
platformWei: sum(admin, e => e.amountWei).toString(), memberPayoutsWei: sum(tier, e => e.amountWei).toString(), byTier,
|
||||
passedUp: { count: passed.length, unqualified: passed.filter(e => e.reason === 'unqualified').length, sendFailed: passed.filter(e => e.reason === 'send-failed').length },
|
||||
wallets, balances, fixedMonthlyUsd: Number(siteConfig().pnlFixedMonthlyUsd) || 0, burner: burner.status(), polhunter: hunt,
|
||||
wallets, balances, fixedMonthlyUsd: Number(siteConfig().pnlFixedMonthlyUsd) || 0, burner: burner.status(), polhunter: hunt, gamesAll,
|
||||
// hand-entered movements in and out of the receivers: draws the chain cannot explain, and
|
||||
// outside income (a ClickBaitPays withdrawal, say) that is not an AdminPaid event
|
||||
ledger: { entries: ledger.entries(), totals: ledger.totals('feeA'),
|
||||
|
||||
Reference in New Issue
Block a user