Stack POL: ViralAdSource program (live 2026-11-17, standing rule): programs.js 'vas' (/earn/viraladsource, join via LinkSpin nwvas src=stackpol), card image vas.jpg (VAS og image), netsites list + CODES nwvas, layout ref swap for viraladsource.com, indexer VASShop rows (Paid kind 1-6 incl. 20% resharer cut, RewardPaid pot rewards unless the push failed, Claimed; company/keeper/relay excluded, cache vas-chain.json)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+25
-8
@@ -9,7 +9,7 @@
|
||||
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.
|
||||
- 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.
|
||||
/root/stackpol-indexer/vab-chain.json (ViralAdSource 2026-11-17: + resharer cut and pot rewards, vas-chain.json). These 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.
|
||||
@@ -63,6 +63,14 @@ DH_SHOP = '0xed07ad7150ecba62689cf2480729753f2fa44e90' # DownlineHydra HydraPro
|
||||
DH_START = 97364036 # deploy block (the app's SHOP_START_BLOCK)
|
||||
DH_HOUSE = {DH_SHOP, '0x7627fc78876948ac9d95c1c9eb061e7d6d647b70', '0xf2f54cf271e8942ecb02176f408cc08a2a1d5bca'} # + company (Tangem), keeper
|
||||
FX_HOUSE = {FX_SHOP, '0x7627fc78876948ac9d95c1c9eb061e7d6d647b70', '0x818daeedefbb33a1988b8b4ac76a8c1dd6e82c60', '0x196cfceb0229ee4b2f20a3350a5ec32b93b72ba8'} # + company, keeper, prize pot
|
||||
# ViralAdSource (2026-11-17): VASShop on Polygon, read-only; same Paid/Claimed events as VABShop plus the reward pot. Member payouts =
|
||||
# Paid kind 1-5 (10% level shares) and kind 6 (the 20% resharer cut), RewardPaid (a new-member reward from the pot, unless its push
|
||||
# failed in that tx: then the later Claimed counts it), and Claimed by a member. Kind 0 = company; contract, company, keeper and relay excluded.
|
||||
VAS_SHOP = '0x7efe7b6ac1e666555f70d005e2cf1637804c4f24'
|
||||
VAS_START = 97473297 # deploy block (the app's SHOP_START_BLOCK)
|
||||
VAS_HOUSE = {VAS_SHOP, '0x7627fc78876948ac9d95c1c9eb061e7d6d647b70', '0xc76ca7dd499338299c2b4bde2dc5c61bf2a97aae', '0x2fe1afedc6ba13fea4e820e7f4c67e6ea40dd9d6'} # + company (Tangem), keeper, relay
|
||||
VAS_TOPICS = {'0xd1c8a663b78b68951e43495fb4824e0454105c7043f5fa8d570d140b5a73d48e': 'RewardPaid', # RewardPaid(uint256,address,uint256,uint256,uint256)
|
||||
'0x8518389ba90468cb21477807ccd9bf28d0f41f2b3affa2f77a779786efa2cc04': 'PaymentFailed'} # PaymentFailed(uint256,address,uint256,uint8,uint8)
|
||||
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
|
||||
@@ -207,8 +215,11 @@ 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, k='vab', shop=VAB_SHOP, start=VAB_START, house=VAB_HOUSE, cachefile='vab-chain.json'):
|
||||
"""ViralAdBlitz (and, same events, 5xYourTeam) member payouts, read-only on chain (same scan as VBB, no prize wallet). Returns (rows, note)."""
|
||||
def vab_rows(dry=False, k='vab', shop=VAB_SHOP, start=VAB_START, house=VAB_HOUSE, cachefile='vab-chain.json', maxlevel=5, extra=None):
|
||||
"""ViralAdBlitz (and, same events, 5xYourTeam, DownlineHydra, ViralAdSource) member payouts, read-only on chain (same scan as VBB,
|
||||
no prize wallet). maxlevel = highest Paid level/kind counted (ViralAdSource 6 = resharer); extra = more topics (ViralAdSource
|
||||
RewardPaid + PaymentFailed). Returns (rows, note)."""
|
||||
topics = dict(VAB_TOPICS, **(extra or {}))
|
||||
cpath = os.path.join(HERE, cachefile)
|
||||
cache = load(cpath, {}) or {}
|
||||
last = int(cache.get('lastBlock') or start - 1)
|
||||
@@ -227,16 +238,18 @@ def vab_rows(dry=False, k='vab', shop=VAB_SHOP, start=VAB_START, house=VAB_HOUSE
|
||||
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': shop, 'topics': [list(VAB_TOPICS)], 'fromBlock': hex(frm), 'toBlock': hex(to)}]) or []:
|
||||
for l in rpc('eth_getLogs', [{'address': shop, 'topics': [list(topics)], 'fromBlock': hex(frm), 'toBlock': hex(to)}]) or []:
|
||||
if l.get('removed') or str(l.get('address', '')).lower() != shop:
|
||||
continue
|
||||
kind, t, data = VAB_TOPICS.get(l['topics'][0]), l['topics'], l.get('data') or '0x'
|
||||
kind, t, data = 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)}
|
||||
if kind in ('Paid', 'PaymentFailed'): # data: amount, level, depth
|
||||
x = {'ev': kind, '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)}
|
||||
elif kind == 'RewardPaid': # topics: nonce, to; data: usdCents, weiPaid, day
|
||||
x = {'ev': 'RewardPaid', 'to': '0x' + t[2][-40:].lower(), 'wei': str(int(data[66:130], 16)), 'cents': int(data[2:66], 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)})
|
||||
@@ -254,8 +267,9 @@ def vab_rows(dry=False, k='vab', shop=VAB_SHOP, start=VAB_START, house=VAB_HOUSE
|
||||
json.dump({'lastBlock': last, 'logs': logs, 'at': int(time.time())}, f)
|
||||
os.replace(tmp, cpath)
|
||||
rows = []
|
||||
failed = {(x['tx'], x['to']) for x in logs if x['ev'] == 'PaymentFailed'} # a reward whose push failed is counted when Claimed
|
||||
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 house)
|
||||
member = (x['ev'] == 'Paid' and 1 <= int(x.get('level') or 0) <= maxlevel) or (x['ev'] == 'Claimed' and x.get('who') not in house) or (x['ev'] == 'RewardPaid' and (x['tx'], x['to']) not in failed)
|
||||
if member and x['to'] not in house and int(x['wei']) > 0:
|
||||
rows.append({'k': k, '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')
|
||||
@@ -354,6 +368,9 @@ def main():
|
||||
hr, hnote = vab_rows(dry, 'dh', DH_SHOP, DH_START, DH_HOUSE, 'dh-chain.json')
|
||||
rows += hr
|
||||
print(hnote)
|
||||
sr, snote = vab_rows(dry, 'vas', VAS_SHOP, VAS_START, VAS_HOUSE, 'vas-chain.json', 6, VAS_TOPICS)
|
||||
rows += sr
|
||||
print(snote)
|
||||
# wallet -> username
|
||||
wu = iap_wallet_users()
|
||||
lsd = voldir(CHAINS['ls'])
|
||||
|
||||
Reference in New Issue
Block a user