import json,requests
NR="https://bsc-mainnet.nodereal.io/v1/64a9df0874fb4a93b9d0a3849de012d3"
FJ="0x90c8889f428F9Ebb77BB8f15CAD3a50a9aC680df"; TRE="0x7C34E9e21eE28A49Ff0b84B61774119E6633359f"
TR="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
d=json.load(open("day.json"))
topic_from="0x"+"0"*24+TRE[2:].lower()
logs=[]
s=d["first"]
while s<=d["last"]:
    e=min(s+4999,d["last"])
    j=requests.post(NR,json={"jsonrpc":"2.0","id":1,"method":"eth_getLogs","params":[{"address":FJ,"topics":[TR,topic_from],"fromBlock":hex(s),"toBlock":hex(e)}]},timeout=60).json()
    logs+=j["result"]; s=e+1
print(len(logs))
json.dump(logs,open("logs.json","w"))
