Files
vbb/.env.example
martbost aee1ccc36a VBB purchases live + weekly prize payouts (Marty 2026-11-14: "why does it say 'coming soon' on all the stuff in it? Shouldn't it all be live already?")
Buying (VBBShop 0x36F6...07D7): Packages page has live Buy buttons for the 10 and 40 credit packs (USD price + live POL from quoteWei, SafePal or any other crypto wallet, one-time, never a subscription, where the payment goes); My Banners has "Add the banner look ($2)" on each waiting or in-loop banner (SKU 3, ref = banner id) and a 40-character teaser editor once it has the look. POST /api/my/order builds the member's buy() call on the server (fresh keeper voucher when the hub knows their sponsor, else no sponsor); the page checks the connected wallet is the member's VBB account (explains how to switch if not), checks the balance, sends with Polygon's fee floor (/api/gas), waits on /api/tx, nudges the watcher (/api/my/paid) and polls until the credits or the look arrive. Public: /api/quote, /api/gas, /api/tx/<hash>; /api/config has shop {live, contract} + explorer. The banner look on the loop: double border + star, hover teaser (always shown on touch screens; default = the link's site). Only Tokens still says coming soon. wallet.js gains sendTx/waitTx/balance (DLB flow).

Weekly prize payouts (prize.js): each Central-time week's pot = 10% of its VBBShop sales (usdCents of Purchase events by block time), $20 floor (company top-up shown to admin), $50 cap internal, half per board, 50/30/20. Every Monday the app prepares last week's plan (winners, wallets, USD; POL quoted live from the Chainlink feed the contract uses). /admin "Approve and pay" (two clicks): refuses unless PRIZE_KEY is the contract's prizeWallet(), the feed is fresh and the wallet holds the POL + gas (says how much more to send); then once per week (docstore.claim in MySQL + plan status), consecutive nonces, each hash saved as sent, stops at the first unclear send (never auto-retried), receipts watched. Ties: earlier to reach the count wins (leaderboards use the same rule). A winner that cannot be paid (the prize or company wallet) is skipped and the rest move up; an unfilled place stays in the prize wallet. /leaders shows past winners with transaction links. Posts nothing anywhere. Compose passes PRIZE_KEY.

Tests: smoke 192/192 (stand-in chain answers quoteWei + receipts: quote, order calldata + voucher, look purchase, teaser, prizes API, UI Buy buttons). New qa/chain.mjs on a local anvil with the real VBBShop + mock feed: buy -> Purchase -> credits, voucher binds sponsor, 30/10/60 split, overpay refunded, banner look; prize prepare -> short refusal -> pay 6 transfers exact POL -> paid once: 29/29. common.js?v=3, vbb.css?v=4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:47:58 -06:00

42 lines
3.2 KiB
Bash

# Viral Banner Blitz app env (Coolify later). Never commit real values. v1 takes no payments in the UI (packages: coming soon).
DOCSTORE_URL= # mysql://user:pass@host:3306/vbb REQUIRED for any real launch (files are local prototype only)
SITE_HOST=viralbannerblitz.com
SESSION_SECRET= # random hex; default = generated into DATA_DIR/.secret
ADMIN_TOKEN= # x-admin-token for /api/admin/status and /api/admin/ledger (8+ characters)
NETWORK_SSO_SECRET= # same value as InstantAdPay + LinkSpin (network sign-in); they must also list vbb under wallets
WALLETCONNECT_PROJECT_ID= # Reown id (IAP project); add the VBB domain to its allowlist first
LOOP_SIZE=50 # banners in the loop
VISITORS_PER_SHIFT=10 # verified unique visitors per shift
VIEWS_PER_CYCLE=150 # network ad views recorded per completed cycle
VISIT_SECONDS=6 # page visible this long before a visit counts
VISITS_PER_IP_DAY=3 # browsers counted per connection per 24 h
FREE_CREDITS_PER_DAY=1
FREE_CREDIT_CAP=7 # free credits bank up to this many
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 # display only; the real split is fixed in VBBShop (sponsor 30, prize 10, company 60)
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
# VBBShop (../contracts). All empty = inert. Vouchers need KEEPER_KEY + CONTRACT_ADDRESS; the watcher needs CONTRACT_ADDRESS + CHAIN_RPC.
CONTRACT_ADDRESS= # the deployed VBBShop (not deployed yet)
CHAIN_RPC= # server-side Polygon RPC for the purchase watcher
SHOP_START_BLOCK= # the deploy block; the first scan starts here
SHOP_CONFIRMATIONS=10 # credit only this many blocks behind the head
SHOP_POLL_MS=30000
KEEPER_KEY= # private key of the contract's keeper (signs sponsor vouchers). Coolify secret only, never in git
PRIZE_KEY= # private key of the prize wallet (weekly payouts, sent only when an admin approves). Coolify secret only, never in git
PRIZE_WALLET= # default 0x167315726Fe50CFF97b8F4c91c8C606489397907; must equal VBBShop.prizeWallet()
VOUCHER_SECONDS=1800 # a voucher is good for 30 minutes
# Network hub report (hubreport.js): every VBBShop purchase reported by wallet (bind, then spend). Off unless HUB_ENABLED=1.
HUB_URL= # https://hub.saasy.top
HUB_SECRET= # this site's secret in the hub's HUB_SITES (32+ chars)
HUB_SITE=vbb
HUB_ENABLED=0
RPC_URLS= # kept for parity with Downline Banners; the watcher reads CHAIN_RPC