0

Python Version: 3.9.6

Web3.py Version: 5.21.0

Used Geth and Infura (HTTPS and Web Sockets)

Tested on Ethereum Mainnet and Kovan

I have tried this before about a month ago with the exact same code and it worked as intended. However, for some reason it is returning an empty array.

from web3.auto import w3
contract = w3.eth.contract(address=uniswap_factory, abi=uniswap_factory_abi)
event_filter = contract.events.PairCreated.createFilter(fromBlock='latest')
print(event_filter.get_all_entries())

1 Answer 1

0

You are asking the filter to return the events in the latest block.

Likely, there are zero events in the latest block.

Try a random block number in the past instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.