Step 4. Build your automation workflow
Last updated
Last updated
First, we need to configure our event-based trigger.
To do so, select Ethereum Goerli as a chain to interact with and choose the contract we added previously in Step 2 from a drop-down list.
We also need to select an event that will be triggering an automation workflow, which is event Send.
When Send
event is clicked in the Nerif App, it will display fields from the event such as chainID
, target
, payload
, gasAmount
, and sender
.
This feature enhances our automation capabilities by allowing us to trigger workflows based on specific details within the emitted events. In this example, the automation workflow will only be triggered if the receiver's chain ID specified in the event is Polygon Mumbai.
Thus, we enter the chain ID for Polygon Mumbai into the field chainId
, i.e. 80001, and click “Confirm”.
Assuming the recipient chain is Polygon Mumbai, we want the automation workflow to proceed further to receiving the data on the Polygon Mumbai chain.
To do that, we need to send a transaction to rec
function within the NerifBridge
contract deployed on the Polygon Mumbai chain.
To implement this, first, click “Add step” and select “Action”.
Assuming the recipient chain is Polygon Mumbai, we want the automation workflow to proceed further to receiving the data on the Polygon Mumbai chain. To that, we need to send a transaction to rec
function within the NerifBridge contract deployed on the Polygon Mumbai chain.
Thus, we choose “Transaction” as our action type.
Now, let’s add the needed details for the transaction, as per the example below. We specify the Polygon Mumbai chain, select the contract address in a drop-down list (Polygon NerifBridge
that we added in Step 1), and set the gas limit.
We also need to specify the rec function from a drop-down list. Again, this part of the automation workflow will only happen if the sender’s chain ID is Polygon Mumbai.
After we put in all the transaction details, click “Confirm”.
Finally, we want the automation workflow to stop if the recipient’s chain ID is not Polygon Mumbai.
We'll do that by clicking “Add step” and selecting “Exit”.
Our final workflow will look as shown below.
At the end, click “Publish” in the top right corner and confirm the transaction in your wallet to publish your workflow within Nerif Network. After that, your automation workflow is all set, congrats!