Stack POL: ViralAdBlitz program (Marty 2026-11-15 standing rule: every rebuilt network site joins Stack POL when it goes live)

- programs.js: 'vab' entry (slug viraladblitz, royal blue #0a2fa8, Viral text ads), join via the LinkSpin network link nwvab?src=stackpol&s1=<member>; facts from the VAB app and VABShop contract only
- /earn/viraladblitz + sitemap entry (automatic from the registry); card image public/img/vab.jpg (VAB og image, 800x420)
- netsites.js: same file as ViralAdBlitz (CODES viraladblitz: nwvab, fallback list entry)
- layout.js: Pro personalization also swaps ?ref=martbost on viraladblitz.com links
- tools/indexer.py: VAB member payouts read-only from Polygon (VABShop Paid level 1-5 + Claimed, eth_getLogs from deploy block 97324419, cache vab-chain.json); level 0 (company), contract, company and keeper wallets excluded. Dry run on core: scanned to head, 0 logs (no Boost sold yet)
- README: sources

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-15 08:04:37 -06:00
parent 349fa79643
commit 0805c1bcb4
6 changed files with 81 additions and 6 deletions
+70 -1
View File
@@ -7,7 +7,9 @@
- opt-in: /root/stackpol-indexer/optin.txt (one username per line) plus IAP's stack-optin.json when present
- Viral Banner Blitz (2026-11-15): VBBShop Paid (role 0, sponsor) and Claimed logs read from Polygon with eth_getLogs, plus the
weekly prize transfers listed in VBB's prizes.json, each checked on chain (sent by the prize wallet, to that winner, succeeded).
The scan position and the checked prize transfers are cached in /root/stackpol-indexer/vbb-chain.json (the only file it writes).
The scan position and the checked prize transfers are cached in /root/stackpol-indexer/vbb-chain.json.
- ViralAdBlitz (2026-11-15): VABShop Paid (level 1-5 shares) and Claimed logs read from Polygon the same way, cached in
/root/stackpol-indexer/vab-chain.json. These two caches are the only files it writes.
It builds one snapshot (network totals, per-program totals, last 7 days, latest 300 payouts, a stack per opted-in member) and
POSTs it to https://stackpol.com/api/ingest with the key in /root/.stackpol-ingest-key. Nothing is written anywhere else.
The ledger shows each payout's username (Marty 2026-11-09); only opted-in members get a public stack page.
@@ -45,6 +47,14 @@ VBB_HOUSE = {VBB_SHOP, VBB_PRIZE, '0x7627fc78876948ac9d95c1c9eb061e7d6d647b70',
VBB_RPC = os.environ.get('VBB_RPC', 'https://polygon-bor-rpc.publicnode.com')
VBB_TOPICS = {'0x5cd81500d7f34f31cd8d8bd61c8cc1dd873c5ea0a46cd1c00ce014f1781f91d5': 'Paid', # Paid(uint256,address,uint256,uint8)
'0xf7a40077ff7a04c7e61f6f26fb13774259ddf1b6bce9ecf26a8276cdd3992683': 'Claimed'} # Claimed(address,address,uint256)
# ViralAdBlitz (2026-11-15): VABShop on Polygon, read-only. Member payouts = Paid with level 1-5 (the 10% level shares pushed in the
# Boost tx) + Claimed (a share whose push failed, pulled later). Level 0 is the company share; anything to the contract, the company
# (Tangem) or the keeper is not a member payout.
VAB_SHOP = '0xb58447b0ce9a38ad0e7d41a074febee696452905'
VAB_START = 97324419 # deploy block (the app's SHOP_START_BLOCK)
VAB_HOUSE = {VAB_SHOP, '0x7627fc78876948ac9d95c1c9eb061e7d6d647b70', '0xf0b9deee7d9768b1d89d30f30e095def2a9cf1db'} # + company (Tangem), keeper
VAB_TOPICS = {'0x2932f3f87f2814df80b5152511ba1fed7a451f5fb3703cd5dd406de6e684dfcc': 'Paid', # Paid(uint256,address,uint256,uint8,uint8)
'0xf7a40077ff7a04c7e61f6f26fb13774259ddf1b6bce9ecf26a8276cdd3992683': 'Claimed'} # Claimed(address,address,uint256)
VBB_CONFIRM = 30 # blocks behind head
VBB_SPAN = 1000 # blocks per eth_getLogs (public RPC limit)
VBB_MAX_SPANS = 400 # per run; a long gap catches up over a few runs
@@ -189,6 +199,62 @@ def vbb_rows(dry=False):
last, len(logs), allwei / 1e18, len(prizes), len(rows), sum(r['pol'] for r in rows), ('; ' + note) if note else '')
def vab_rows(dry=False):
"""ViralAdBlitz member payouts, read-only on chain (same scan as VBB, no prize wallet). Returns (rows, note)."""
cpath = os.path.join(HERE, 'vab-chain.json')
cache = load(cpath, {}) or {}
last = int(cache.get('lastBlock') or VAB_START - 1)
logs = cache.get('logs') or [] # every Paid/Claimed log seen (all levels), so the counting rule can change without a rescan
bts = {}
def btime(n):
if n not in bts:
b = rpc('eth_getBlockByNumber', [hex(n), False])
bts[n] = int(b['timestamp'], 16) if b and b.get('timestamp') else 0
return bts[n]
note = ''
try:
head = int(rpc('eth_blockNumber', []), 16) - VBB_CONFIRM
seen = {(x['tx'], x['li']) for x in logs}
spans = 0
while last < head and spans < VBB_MAX_SPANS:
frm, to = last + 1, min(head, last + VBB_SPAN)
for l in rpc('eth_getLogs', [{'address': VAB_SHOP, 'topics': [list(VAB_TOPICS)], 'fromBlock': hex(frm), 'toBlock': hex(to)}]) or []:
if l.get('removed') or str(l.get('address', '')).lower() != VAB_SHOP:
continue
kind, t, data = VAB_TOPICS.get(l['topics'][0]), l['topics'], l.get('data') or '0x'
key = (l['transactionHash'].lower(), int(l['logIndex'], 16))
if not kind or key in seen:
continue
n = int(l['blockNumber'], 16)
if kind == 'Paid': # data: amount, level, depth
x = {'ev': 'Paid', 'to': '0x' + t[2][-40:].lower(), 'wei': str(int(data[2:66], 16)), 'level': int(data[66:130], 16), 'depth': int(data[130:194], 16)}
else:
x = {'ev': 'Claimed', 'who': '0x' + t[1][-40:].lower(), 'to': '0x' + t[2][-40:].lower(), 'wei': str(int(data[2:66], 16))}
x.update({'tx': key[0], 'li': key[1], 'block': n, 'ts': btime(n)})
logs.append(x)
seen.add(key)
last = to
spans += 1
if last < head:
note = 'catching up, %d blocks to go' % (head - last)
except Exception as e:
note = 'chain read failed (kept the cached logs): %s' % e
if not dry:
tmp = cpath + '.tmp'
with open(tmp, 'w', encoding='utf-8', newline='\n') as f:
json.dump({'lastBlock': last, 'logs': logs, 'at': int(time.time())}, f)
os.replace(tmp, cpath)
rows = []
for x in logs:
member = (x['ev'] == 'Paid' and 1 <= int(x.get('level') or 0) <= 5) or (x['ev'] == 'Claimed' and x.get('who') not in VAB_HOUSE)
if member and x['to'] not in VAB_HOUSE and int(x['wei']) > 0:
rows.append({'k': 'vab', 'pol': int(x['wei']) / 1e18, 'tx': x['tx'], 'ts': ms(x['ts']), 'w': x['to'], 'gu': ''})
allwei = sum(int(x['wei']) for x in logs if x['ev'] == 'Paid')
return rows, 'vab: scanned to block %d, %d contract logs (%.4f POL in all Paid events), %d member payouts %.4f POL%s' % (
last, len(logs), allwei / 1e18, len(rows), sum(r['pol'] for r in rows), ('; ' + note) if note else '')
def iap_wallet_users():
"""{address_lower: username} from IAP accounts + positions, via the IAP container (its DATABASE_URL never leaves it)."""
c = subprocess.run(['docker', 'ps', '--format', '{{.Names}}'], capture_output=True, text=True).stdout.split()
@@ -271,6 +337,9 @@ def main():
vr, vnote = vbb_rows(dry)
rows += vr
print(vnote)
ar, anote = vab_rows(dry)
rows += ar
print(anote)
# wallet -> username
wu = iap_wallet_users()
lsd = voldir(CHAINS['ls'])