VBBShop hooks (inert until configured, nothing deployed): GET /api/my/voucher signs an EIP-712 sponsor voucher with KEEPER_KEY when the hub lookup names the member's network sponsor (new optional sponsor field; none or self = no voucher); shop.js watcher reads Purchase logs (CONTRACT_ADDRESS + CHAIN_RPC, confirmed blocks, 1,000-block ranges) and credits packs once per txHash:logIndex, dedupe marks saved in vbb.json with the credits; admin status shows the watcher, never the key. Packages page stays coming soon. Smoke 117/117 (fake chain + voucher checks)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-13 16:20:24 -06:00
parent 471fefacf0
commit 07cc1944e6
6 changed files with 186 additions and 13 deletions
+9 -1
View File
@@ -1,5 +1,6 @@
// All runtime config comes from env (Coolify sets these). Read once.
// VBB v1 is off-chain: no contract, no payments. Planned prices are shown as "coming soon"; rewards are recorded, not credited yet.
// VBB v1 takes no payments in the UI: planned prices show as "coming soon"; rewards are recorded, not credited yet. The VBBShop
// contract hooks (shop.js: sponsor vouchers + purchase watcher) stay inert until CONTRACT_ADDRESS / CHAIN_RPC / KEEPER_KEY are set.
const path = require('path');
let cfg = null;
@@ -39,6 +40,13 @@ function get() {
// 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) },
// VBBShop (../contracts). KEEPER_KEY is read by shop.js only, never kept here.
contractAddress: /^0x[0-9a-fA-F]{40}$/.test(String(e.CONTRACT_ADDRESS || '').trim()) ? require('ethers').getAddress(String(e.CONTRACT_ADDRESS).trim()) : '',
chainRpc: String(e.CHAIN_RPC || '').trim(), // the watcher's RPC (server side); '' = watcher off
shopStartBlock: num(e.SHOP_START_BLOCK, 0, 0, 1e12), // the deploy block (first scan starts here)
shopConfirmations: num(e.SHOP_CONFIRMATIONS, 10, 0, 1000), // credit only this many blocks behind the head
shopPollMs: num(e.SHOP_POLL_MS, 30000, 200, 3600000),
voucherSeconds: num(e.VOUCHER_SECONDS, 1800, 60, 86400), // a sponsor voucher is good for 30 minutes
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(/\/+$/, ''),