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
  • Definition
  • Returned Values
  • Examples
  • Tips for Using Call Evm Function

Was this helpful?

  1. Tasks

Call EVM Function

Retrieve data from an on-chain public view function through an RPC call.

The Call EVM Function task allows you to obtain any on-chain data to your midpoint by doing a direct RPC call to an on-chain view function. This task is used in a wide variety of workflows, such as cross-chain data bridging and retrieving values from any other chain back onto the chain your application lives on.

Definition

chainId: string # required
contractAddress: string # required
functionName: string # required
arguments: [
    {
        name: string
        datatype: string
        value: string
    }
]
returnValues: [ # at least one value is required
    {
        name: string
        datatype: string
    }
]
extracts: [
    {
        name: string
        from: string
    }
]
excludeLogs: [string]

chainId: String. The Chain ID of the chain to request data 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 Call EVM Function calls. This contract address should exist on the chain you are calling.

functionName: String. This is name of the function you are calling from the Call EVM Function task.

arguments: This specifies both the signature of your on-chain function, and any values that are going to be submitted by the Call EVM Function task.

arguments.name: String. This is the name of the argument that you are passing in. 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 passed into the on-chain function. This datatype must match the datatype of your on-chain function exactly, in the same order as they are defined in the on-chain function.

arguments.from: String. This defines the value that will be submitted on-chain when your Call EVM Function does a call. If you directly put in a value, it will be a constant that is always submitted. We recommend entering a variable name that will be interpolated during runtime after it is extracted from a previous source or task.

returnValues: StringThis specifies the return values that will be returned after you call your EVM function. These values will be automatically extracted as a variable to be used by downstream tasks.

returnValues.name: String. This is the name of the argument that is being returned in. This is a human-readable name that you set, which will be the name of the variable that is generated.

returnValues.datatype: String. This defines the solidity datatype of the value that is returned by the on-chain function. This datatype must match the datatype of your on-chain function's return values exactly, in the same order as they are defined in the on-chain function.

  • 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

This task returns any values extracted using the extracts which are outlined above. Additionally, this task returns any values defined in returnValues, where the name of the variable created is the name specified by the user.

Examples

This section is incomplete.

Tips for Using Call Evm Function

  • Use a variable from a source or a previous task for the value of an argument. This makes the values that you submit back on-chain dynamic.

  • Use your Midpoint ID as your first argument to ensure your smart contracts Security.

  • Use a variable for your chainId, and have it originate from on-chain. If you use the implicit Chain_ID from your Startpoint Calledsource, you can have a chain-agnostic data bridge that uses the same midpoint.

PreviousOAuth and Multi-Step AuthenticationNextTransact to EVM Function

Last updated 2 years ago

Was this helpful?

extracts: See . Legal values:

excludeLogs: See . Legal values:

extracts
exclude logs