Automations Framework

Last updated 5 months ago

Get Started

Introducing Unit

Deep Dive

Products

Use Cases

Deep Dive

workflow.yaml Structure

Technical specification of workflow.yaml , the workflow definition file

Overview

Unit workflows serve as a primitive element for automating on-chain processes across diverse blockchain networks. These workflows are composed of a series of sequential steps and triggers, enabling developers to create powerful automation solutions that can be customized by users to suit specific use cases. By facilitating the automation of decentralized operations, from DeFi transactions to automated trading strategies, Unit workflows offer the flexibility and scalability needed for various blockchain applications.

This page focuses on the technical specifications of the workflow.yaml file, which defines the workflow process. For a general overview, please visit the Working with Workflows page.

Workflow.yaml structure

Workflows in Unit represent a collection of tasks that are logically grouped and executed in a defined sequence. Each workflow can interact with multiple smart contracts and blockchain networks, making them highly versatile tools for on-chain automation. The modular design of Unit workflows allows each step to be executed based on specific conditions or triggers, enabling efficient and dynamic automation.

The workflow.yaml file defines workflows in a structured format, allowing for easy management of complex automated tasks. Below is a breakdown of the key fields in the file:

Attribute

Description

name

A unique identifier for the workflow.

version

Specifies the version of the workflow.

wallet

Defines wallet-related information, such as wallet type (EOA or smart wallet) and address. The workflow interacts with this wallet.

Steps

Each workflow consists of a series of steps, which are discrete operations executed either sequentially or conditionally based on triggers. The fields for defining a step are:

Attribute

Description

name

A human-readable name for the step.

module

The module to be used (optional), allowing for extended functionality.

method

The method to be called within the module, representing the action to be performed.

arguments

Specific arguments required for the method execution, such as contract addresses or parameters for blockchain interaction.

Triggers

Triggers determine when a step is executed, adding flexibility by allowing the workflow to react to various conditions. The fields for defining a trigger are:

Attribute

Description

name

A unique name for the trigger.

type

Defines the type of trigger (e.g., periodic, event-based).

interval

Specifies how often the trigger should activate (used for periodic triggers).

value

Additional values or data points related to the trigger (e.g., block numbers or timestamps).

condition

Specifies the condition for trigger activation, including:

op

The operation to evaluate (e.g., lessThan, greaterThan).

value

The value used for comparison in the condition (e.g., a threshold for a price-based operation).

This structured approach allows for clear and manageable definitions of complex automated tasks.

Previous

Client Integration

Next

Under the Hood

Overview

Workflow.yaml structure

Steps

Triggers