LogoLogo
MidpointContact UsThe Docs are Wrong!
  • What is Midpoint
  • What actually is a midpoint?
  • Midpoint FAQs
  • Get Started
    • Sample Midpoints
      • Filecoin Filrep Oracle: Obtain miner reputations on-chain
      • Oracle: Call any API from a smart contract
      • Listener: Subscribe an internal service to any event
      • Data Feed: Stream a data feed on-chain at regular intervals
      • Data Bridge: Pass arbitrary messages between chains
      • Automation: Ensure a function is called at regular intervals
    • Videos
  • Using Midpoint
    • API Key
    • Midpoint CLI
    • GraphQL API
    • Dashboard
  • Core Concepts
    • Midpoints
      • Midpoint ID
      • Sources
      • Tasks
      • Source and Task Definitions
        • Secrets
        • Variables
        • Exclude Logs
        • Extracts
    • Requests
      • Request ID
      • Events
    • Credits and Payment
  • Sources
    • Startpoint Called
    • EVM Event Emitted
    • Cron Job Triggered
  • Tasks
    • Make HTTP Request
      • OAuth and Multi-Step Authentication
    • Call EVM Function
    • Transact to EVM Function
      • Security
    • Shift Decimal
  • More Reading
    • Chain IDs
    • Startpoints
    • Midpoint EOAs
  • Get in Touch
    • Contact Links
Powered by GitBook
On this page
  • Returned Values
  • Examples
  • Tips on Using EVM Event Emitted

Was this helpful?

  1. Sources

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.

  • Timestamp Unixtime of execution.

  • 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.

PreviousStartpoint CalledNextCron Job Triggered

Last updated 2 years ago

Was this helpful?

extracts: See . Legal values:

excludeLogs: See . Legal values:

extracts
exclude logs