#!/usr/bin/env python3 """Read-only saved requests. No keys, signatures, transactions or state overrides. Default RPC: https://rpc.pulsechain.com (public). Override with --rpc. Use --print-requests for fully offline inspection. """ import argparse,datetime,json,urllib.request CALLS = [{'label': 'aaveV3.code', 'request': {'jsonrpc': '2.0', 'id': 6, 'method': 'eth_getCode', 'params': ['0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', '0x1a8a1da']}}, {'label': 'aaveV3.provider', 'request': {'jsonrpc': '2.0', 'id': 4, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0xfe65acfe'}, '0x1a8a1da']}}, {'label': 'aaveV3.reservesList', 'request': {'jsonrpc': '2.0', 'id': 1, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0xd1946dbc'}, '0x1a8a1da']}}, {'label': 'aaveV3.provider', 'request': {'jsonrpc': '2.0', 'id': 2, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x0542975c'}, '0x1a8a1da']}}, {'label': 'pWETH.reserve', 'request': {'jsonrpc': '2.0', 'id': 1, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a75000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'}, '0x1a8a1da']}}, {'label': 'wstETH.reserve', 'request': {'jsonrpc': '2.0', 'id': 3, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a750000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0'}, '0x1a8a1da']}}, {'label': 'WBTC.reserve', 'request': {'jsonrpc': '2.0', 'id': 5, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a750000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599'}, '0x1a8a1da']}}, {'label': 'pUSDC.reserve', 'request': {'jsonrpc': '2.0', 'id': 7, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a75000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'}, '0x1a8a1da']}}, {'label': 'pDAI.reserve', 'request': {'jsonrpc': '2.0', 'id': 9, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a750000000000000000000000006b175474e89094c44da98b954eedeac495271d0f'}, '0x1a8a1da']}}, {'label': 'LINK.reserve', 'request': {'jsonrpc': '2.0', 'id': 11, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a75000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca'}, '0x1a8a1da']}}, {'label': 'AAVE.reserve', 'request': {'jsonrpc': '2.0', 'id': 1, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a750000000000000000000000007fc66500c84a76ad7e9c93437bfc5ac33e2ddae9'}, '0x1a8a1da']}}, {'label': 'cbETH.reserve', 'request': {'jsonrpc': '2.0', 'id': 3, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a75000000000000000000000000be9895146f7af43049ca1c1ae358b0541ea49704'}, '0x1a8a1da']}}, {'label': 'pUSDT.reserve', 'request': {'jsonrpc': '2.0', 'id': 5, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a75000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7'}, '0x1a8a1da']}}, {'label': 'rETH.reserve', 'request': {'jsonrpc': '2.0', 'id': 7, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a75000000000000000000000000ae78736cd615f374d3085123a210448e74fc6393'}, '0x1a8a1da']}}, {'label': 'LUSD.reserve', 'request': {'jsonrpc': '2.0', 'id': 9, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a750000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0'}, '0x1a8a1da']}}, {'label': 'CRV.reserve', 'request': {'jsonrpc': '2.0', 'id': 11, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a75000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd52'}, '0x1a8a1da']}}, {'label': '0x9f8f72aa.reserve', 'request': {'jsonrpc': '2.0', 'id': 1, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a750000000000000000000000009f8f72aa9304c8b593d555f12ef6589cc3a579a2'}, '0x1a8a1da']}}, {'label': 'SNX.reserve', 'request': {'jsonrpc': '2.0', 'id': 3, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a75000000000000000000000000c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f'}, '0x1a8a1da']}}, {'label': 'BAL.reserve', 'request': {'jsonrpc': '2.0', 'id': 5, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a75000000000000000000000000ba100000625a3754423978a60c9317c58a424e3d'}, '0x1a8a1da']}}, {'label': 'UNI.reserve', 'request': {'jsonrpc': '2.0', 'id': 7, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a750000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f984'}, '0x1a8a1da']}}, {'label': 'LDO.reserve', 'request': {'jsonrpc': '2.0', 'id': 9, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0x35ea6a750000000000000000000000005a98fcbea516cf06857215779fd812ca3bef1b32'}, '0x1a8a1da']}}, {'label': '86ff.account', 'request': {'jsonrpc': '2.0', 'id': 11, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0xbf92857c000000000000000000000000e6df4ca976f3fec8da89efec332dc2245f0a86ff'}, '0x1a8a1da']}}, {'label': '5996.account', 'request': {'jsonrpc': '2.0', 'id': 12, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0xbf92857c000000000000000000000000b8698cfffdaaf26ca21fe8aa560c18cc2b2f5996'}, '0x1a8a1da']}}, {'label': '2822.account', 'request': {'jsonrpc': '2.0', 'id': 1, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0xbf92857c0000000000000000000000003899e2b00fe4eda542021780039d69a583dd2822'}, '0x1a8a1da']}}, {'label': '9e6f.account', 'request': {'jsonrpc': '2.0', 'id': 2, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0xbf92857c000000000000000000000000a30190b96faee0080144aa0b7645081fcbf49e6f'}, '0x1a8a1da']}}, {'label': '1967.account', 'request': {'jsonrpc': '2.0', 'id': 3, 'method': 'eth_call', 'params': [{'to': '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2', 'data': '0xbf92857c000000000000000000000000fdbee32bcf68bb0ced033200373384a619c71967'}, '0x1a8a1da']}}] CHAIN = 369 def rpc(url,q): if q['method'] not in {'eth_chainId','eth_call','eth_getCode','eth_getStorageAt','eth_getBlockByNumber'}:raise ValueError('Read-only allowlist') req=urllib.request.Request(url,json.dumps(q).encode(),{'Content-Type':'application/json','User-Agent':'pSTABLES-readonly-check/1.0'}) with urllib.request.urlopen(req,timeout=60) as r:return json.load(r) def main(): p=argparse.ArgumentParser(description=__doc__);p.add_argument('--rpc',default='https://rpc.pulsechain.com');p.add_argument('--print-requests',action='store_true');p.add_argument('--output');a=p.parse_args() if a.print_requests:print(json.dumps(CALLS,indent=2));return chain=rpc(a.rpc,{'jsonrpc':'2.0','id':1,'method':'eth_chainId','params':[]}) if chain.get('result')!=hex(CHAIN):raise SystemExit('Wrong network: expected chain '+str(CHAIN)) out={'read_only':True,'chain_id':CHAIN,'generated_utc':datetime.datetime.now(datetime.timezone.utc).isoformat(),'reads':[]} for row in CALLS: try:response=rpc(a.rpc,row['request']) except Exception as e:response={'transport_error':str(e)} out['reads'].append(dict(label=row['label'],request=row['request'],response=response)) text=json.dumps(out,indent=2) if a.output:open(a.output,'w').write(text) else:print(text) if __name__=='__main__':main()