EVM Event Emitted

EVM Event Emitted is used to trigger a midpoint whenever an on-chain event is emitted. Unlike startpoint sources, EVM Event Emitted sources can be used for existing production contracts - without contract modification.

When configuring an EVM Event Emitted source, specify the event signature through arguments along with any filters to apply to indexed topics. EVM Event Emitted can be usd when creating alerts, notifications, and listeners.

Definition

chainId: string # required
contractAddress: string # required
eventName: string # required
arguments: [
    {
        name: string
        datatype: string
        indexed: boolean
        value: string
    }
]
extracts: [
    {
        name: string
        from: string
    }
]
excludeLogs: [string]

chainId: String. The Chain ID of the chain to listen for an event from. For a complete list of Chain Ids that we currently support, take a look at Chain IDs.

contractAddress: String. The address of the contract that the event is emitted from.

eventName: String. This is name of the event that you are listening for.

arguments: This specifies the signature of the event, and the data that is picked out from your event to be used in later tasks.

arguments.name: String. This is the name of an argument that the event emits. This is a human-readable name that you set: for clarity, it might be best to set this name to the name of the parameter you are calling.

arguments.datatype: String. This defines the solidity datatype of the value that is emitted from the on-chain event. This datatype must match the datatype of your on-chain event exactly, in the same order as they are defined in the on-chain event.

arguments.indexed: Boolean. This determines whether or not your particular argument is indexed, or not. An indexed parameter can be further filtered by specifying the value below.

arguments.value: String This is the value of the indexed parameter. This is not necessary to define if the particular argument is or is not indexed. You only need to define a value for this argument if you only want to listen to events that emit a particular indexed value, for example, a contract address.

extracts: See extracts. Legal values:

  • Timestamp Unixtime of execution.

excludeLogs: See exclude logs. Legal values:

  • TaskDefinition The complete definition of this task at runtime.

  • TaskOutputData The complete set of returned values from this task

Returned Values

The EVM Event Emitted source returns each of the arguments listed under the arguments field for use in future tasks - in addition to each field specified in extracts.

Examples

Let's say you want to listen to a particular event.

// Sample Event
event ReturnValue(address indexed _from, int256 _value);

A correctly configured Evm Event Emitted source would be:

{
    "evmEventEmittedSource": {
        "chainId": "1",
        "contractAddress": "0x5B39558897Bb0047803F9E498D238fB5811E6050",
        "eventName": "ReturnValue",
        "arguments": [
            {
                "name": "_from",
                "datatype": "address",
                "indexed": true,
                "value": "0xC05f817a17bC0c505E48AC9CC52b5cb556F7B296"
            },
            {
                "name": "_value",
                "datatype": "int256",
                "indexed": false
            }
        ]
    }
}

The above EVM Event Emitted Source would listen for events emitted from the contract 0x5B39558897Bb0047803F9E498D238fB5811E6050 on Ethereum mainnet. It will only pick out events that emit a value of 0xC05f817a17bC0c505E48AC9CC52b5cb556F7B296 for the _from parameter.

Tips on Using EVM Event Emitted

This section is incomplete.

Last updated