2222
2323import json
2424import os
25+ import re
2526import sys
2627import time
2728from concurrent .futures import ThreadPoolExecutor
7475FUTURE_INCENTIVES = "0x662De311f94bdbB571D95B5909e9cC6A25a6802a" # Locked
7576Y1_REWARDS = "0x3D6A1B00C830C5f278FC5dFb3f6Ff0b74Db6dfe0" # Locked
7677INVESTOR_WALLET = "0x92ba0fd39658105fac4df2b9bade998b5816b350" # Locked (temporary)
78+ PROTOCOL_GUILD = "0x25941dC771bB64514Fc8abBce970307Fb9d477e9" # Locked
7779FLUSH_REWARDER = "0x7C9a7130379F1B5dd6e7A53AF84fC0fE32267B65" # Locked (rewardsAvailable)
7880
7981MULTICALL3 = "0xcA11bde05977b3631167028862bE2a173976CA11"
@@ -317,8 +319,10 @@ def get_logs_safe(address, topics, from_block=None):
317319 except Exception as e :
318320 print (f" get_logs full range failed ({ e } ), falling back to chunking..." )
319321 latest = get_block_info ()[0 ] if isinstance (BLOCK_ID , int ) else retry (lambda : w3 .eth .block_number )
322+ # Respect the RPC's advertised max range if it tells us; else start broad.
323+ m = re .search (r"maxAllowedRange['\"]?\s*:\s*(\d+)" , str (e ))
324+ chunk_size = int (m .group (1 )) if m else 2_000_000
320325 all_logs = []
321- chunk_size = 2_000_000
322326 current = start_block
323327 while current <= latest :
324328 params ["fromBlock" ] = hex (current )
@@ -328,8 +332,8 @@ def get_logs_safe(address, topics, from_block=None):
328332 all_logs .extend (chunk_logs )
329333 current += chunk_size
330334 except Exception :
331- chunk_size = chunk_size // 4
332- if chunk_size < 10_000 :
335+ chunk_size = chunk_size // 2
336+ if chunk_size < 1_000 :
333337 raise
334338 return all_logs
335339
@@ -400,8 +404,8 @@ def fetch_data(atps, contract_addrs):
400404
401405 # [...] Balances: other contracts
402406 other_start_idx = len (calls )
403- other_contracts = [FUTURE_INCENTIVES , Y1_REWARDS , INVESTOR_WALLET , UNISWAP_POOL ]
404- other_names = ["Future Incentives" , "Y1 Network Rewards" , "Investor Wallet" , "Uniswap Pool" ]
407+ other_contracts = [FUTURE_INCENTIVES , Y1_REWARDS , INVESTOR_WALLET , PROTOCOL_GUILD , UNISWAP_POOL ]
408+ other_names = ["Future Incentives" , "Y1 Network Rewards" , "Investor Wallet" , "Protocol Guild" , " Uniswap Pool" ]
405409 for addr in other_contracts :
406410 calls .append ((AZTEC_TOKEN , _encode_bal (addr )))
407411
@@ -833,6 +837,7 @@ def display(atps, data):
833837 locked_future_incentives = other_bals .get ("Future Incentives" , 0 )
834838 locked_y1_rewards = other_bals .get ("Y1 Network Rewards" , 0 )
835839 locked_investor_wallet = other_bals .get ("Investor Wallet" , 0 )
840+ locked_protocol_guild = other_bals .get ("Protocol Guild" , 0 )
836841 locked_factories = sum (factory_bals .values ())
837842
838843 # Rollup balance breakdown (sum of all historical rollup instances):
@@ -863,6 +868,7 @@ def display(atps, data):
863868 + locked_future_incentives
864869 + locked_y1_rewards
865870 + locked_investor_wallet
871+ + locked_protocol_guild
866872 + locked_factories
867873 + locked_slashed
868874 + locked_flush_rewarder
@@ -913,6 +919,11 @@ def display(atps, data):
913919 f" Investor Wallet: { fmt (locked_investor_wallet ):>27} AZTEC"
914920 f" ({ pct (locked_investor_wallet , total_supply )} )"
915921 )
922+ if locked_protocol_guild :
923+ print (
924+ f" Protocol Guild: { fmt (locked_protocol_guild ):>27} AZTEC"
925+ f" ({ pct (locked_protocol_guild , total_supply )} )"
926+ )
916927 if locked_factories :
917928 print (
918929 f" Factories: { fmt (locked_factories ):>27} AZTEC"
@@ -1261,6 +1272,7 @@ def display(atps, data):
12611272 "future_incentives" : str (locked_future_incentives ),
12621273 "y1_rewards" : str (locked_y1_rewards ),
12631274 "investor_wallet" : str (locked_investor_wallet ),
1275+ "protocol_guild" : str (locked_protocol_guild ),
12641276 "factories" : str (locked_factories ),
12651277 "slashed_funds" : str (locked_slashed ),
12661278 },
0 commit comments