0

I am trying to filter out transactions from BSC and read their input data (specifically borrows from venus), however I am having trouble getting my event filter to work properly.

I have already tried to search around for an answer, and found this but it doesn't seem to help me as there is no longer a contract.eventFilter() function.

Here is my code:

import json
from web3 import Web3
from time import sleep

abi = json.load(open('abi.json', 'r'))
# I got the abi from https://bscscan.com/address/0xcf6bb5389c92bdda8a3747ddb454cb7a64626c63#code

w3 = Web3(Web3.HTTPProvider("https://bsc-dataseed.binance.org/"))

contract = w3.eth.contract(address="0xd4CB328A82bDf5f03eB737f37Fa6B370aef3e888", abi=abi)

transfer_filter = contract.events.Transfer.createFilter(fromBlock="0x0", argument_filters={'from': '0xd4CB328A82bDf5f03eB737f37Fa6B370aef3e888'})

while True:
  print(transfer_filter.get_new_entries())
  sleep(2)

I'm not really too sure where I am going wrong, as I don't know if I have the right from address for transfer_filter as the only output I am getting is [].

Thanks for any help in advance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.