A sample contract and brownie script to listen for events emitted by a contract.
The two parts to this repo are the example contract which contains a single function which emits an event and the pyton listener script which deploys the contracts and simulates some transactions being sent to it, it also includes a simple listener for printing the events it listens to.
Intall the python dependencies with pip pip install -r requirements.txt
(it is recommended to use a virtual environment for this).
For my testing I also used the hardhat network which can be install with npm npm install hardhat
.
To run the script and see the messages printed to the console use
brownie run scripts/listener.py --network hardhat
.
You can ask me questions in the Avax build guild #dev channel, my handle is jumbo.