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 Transact To Evm Function

Was this helpful?

  1. Tasks

Transact to EVM Function

Submit a Transaction to an EVM Chain.

Transact to EVM Function is used to submit a transaction to a contract on a Testnet or Mainnet chain. Transact to EVM Function is useful for any midpoint that has a requirement to submit some sort of external data back on-chain, whenever you want to trigger your contract in response to an on-chain event, or when you need to call your contract at an interval.

There are two types of Transact to EVM Function tasks: Testnet and Mainnet. Testnet submits transactions to Testnet chains, and Mainnet submits transactions to Mainnet chains.

Definition

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

chainId: String. The Chain ID of the chain to submit the transaction to. 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 Transact to EVM Function submits a transaction to. This contract address should exist on the chain you are calling.

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

arguments: This specifies both the signature of your on-chain function, and the values that are going to be submitted by the Transact to 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 that will be submitted. 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.value: String. This defines the value that will be submitted on-chain when your Transact to EVM Function submits a transaction. 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.

  • Timestamp Unixtime of execution.

  • Unit_Price_In_USD The unit price of the native token on the chain you submitted on. E.g. $1500 for Ethereum.

  • Cumulative_Gas_Used The cumulative amount of gas used by the transaction.

  • Txn_Hash The Transaction Hash of the transaction.

  • Contract_Address The contract address that contained the EVM function.

  • Gas_Used The gas that was used by the transaction.

  • Block_Number The block number of the transaction.;

  • TaskDefinition The complete definition of this task at runtime.

  • ComposedResponseData The complete set of data that will be posted on-chain

  • Txn_Hash The transaction hash and chainId of the submitted response

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

Examples

This section is incomplete.

Tips for Using Transact To 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.

PreviousCall EVM FunctionNextSecurity

Last updated 2 years ago

Was this helpful?

extracts: See . Legal values:

excludeLogs: See . Legal values:

extracts
exclude logs