Developers
Blueprint SDK Event Listeners
EVM Contract Listeners

EVM Contract Listeners

EVM Contract Listeners are a powerful feature in the Gadget SDK that allow your blueprint to react to events emitted by smart contracts on EVM-compatible chains. These listeners use the alloy crate, which provides a robust and efficient way to interact with EVM chains.

Overview

EVM Contract Listeners enable your blueprint to:

  1. Monitor specific smart contracts for events
  2. React to these events in real-time
  3. Trigger custom logic based on the event data

EvmContractEventListener

The EvmContractEventListener is a type that listens to the Ethereum Virtual Machine (EVM) for events.

Like the TangleEventListener, the EvmContractEventListener is already implemented and ready to use. Simply register it in the job macro, and your application will automatically work with the EVM.

Pre-processor

EVM Contract events benefit from a simple pre-processor that extracts the parameters you need from the raw event data. An example of this is shown below: