#!/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.baseUnit', 'request': {'jsonrpc': '2.0', 'id': 1, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0x8c89b64f'}, '0x1a8a1da']}}, {'label': 'pWETH.price', 'request': {'jsonrpc': '2.0', 'id': 2, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f07000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'}, '0x1a8a1da']}}, {'label': 'wstETH.price', 'request': {'jsonrpc': '2.0', 'id': 4, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f070000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0'}, '0x1a8a1da']}}, {'label': 'WBTC.price', 'request': {'jsonrpc': '2.0', 'id': 6, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f070000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599'}, '0x1a8a1da']}}, {'label': 'pUSDC.price', 'request': {'jsonrpc': '2.0', 'id': 8, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f07000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'}, '0x1a8a1da']}}, {'label': 'pDAI.price', 'request': {'jsonrpc': '2.0', 'id': 10, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f070000000000000000000000006b175474e89094c44da98b954eedeac495271d0f'}, '0x1a8a1da']}}, {'label': 'LINK.price', 'request': {'jsonrpc': '2.0', 'id': 12, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f07000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca'}, '0x1a8a1da']}}, {'label': 'AAVE.price', 'request': {'jsonrpc': '2.0', 'id': 2, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f070000000000000000000000007fc66500c84a76ad7e9c93437bfc5ac33e2ddae9'}, '0x1a8a1da']}}, {'label': 'cbETH.price', 'request': {'jsonrpc': '2.0', 'id': 4, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f07000000000000000000000000be9895146f7af43049ca1c1ae358b0541ea49704'}, '0x1a8a1da']}}, {'label': 'pUSDT.price', 'request': {'jsonrpc': '2.0', 'id': 6, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f07000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7'}, '0x1a8a1da']}}, {'label': 'rETH.price', 'request': {'jsonrpc': '2.0', 'id': 8, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f07000000000000000000000000ae78736cd615f374d3085123a210448e74fc6393'}, '0x1a8a1da']}}, {'label': 'LUSD.price', 'request': {'jsonrpc': '2.0', 'id': 10, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f070000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0'}, '0x1a8a1da']}}, {'label': 'CRV.price', 'request': {'jsonrpc': '2.0', 'id': 12, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f07000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd52'}, '0x1a8a1da']}}, {'label': '0x9f8f72aa.price', 'request': {'jsonrpc': '2.0', 'id': 2, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f070000000000000000000000009f8f72aa9304c8b593d555f12ef6589cc3a579a2'}, '0x1a8a1da']}}, {'label': 'SNX.price', 'request': {'jsonrpc': '2.0', 'id': 4, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f07000000000000000000000000c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f'}, '0x1a8a1da']}}, {'label': 'BAL.price', 'request': {'jsonrpc': '2.0', 'id': 6, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f07000000000000000000000000ba100000625a3754423978a60c9317c58a424e3d'}, '0x1a8a1da']}}, {'label': 'UNI.price', 'request': {'jsonrpc': '2.0', 'id': 8, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f070000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f984'}, '0x1a8a1da']}}, {'label': 'LDO.price', 'request': {'jsonrpc': '2.0', 'id': 10, 'method': 'eth_call', 'params': [{'to': '0x54586be62e3c3580375ae3723c145253060ca0c2', 'data': '0xb3596f070000000000000000000000005a98fcbea516cf06857215779fd812ca3bef1b32'}, '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()