I am trying to listen to events emitted from a contract using eth-brownie. More specifically I am attempting to use EventWatcher. My contract
emit has an event
eventI in it. My
run.py file looks like,
from brownie.network.event import EventWatcher from brownie import Contract, emit def run(): # get contract emit = Contract.from_abi( emit, [contract adress], [contract abi]) # start watcher EventWatcher._start_watch # define callback function def watched(): print('watched') # use add_event_callback EventWatcher.add_event_callback( event=emit.events["eventI"], callback=watched, delay=2.0, repeat=True) def main(): run()
I have two questions; 1) am I implementing the above arguments correctly? 2) when I run it I get the error,
EventWatcher.add_event_callback() missing 1 required positional argument: 'self'
inspect.signature(EventWatcher.add_event_callback) I know
self should be the first input, but I don't know what the form of it should be. I tried things like
emit.self if that makes any sense...