The Engine is the backbone of Free Market Protocol. It is a robust, extensible platform consisting of a set of EVM contracts that carry out the steps of a workflow.
The WorkflowRunner is the central component of the Engine, responsible for managing the execution of a workflow. Its primary responsibilities include keeping track of the assets that are currently in the workflow, as well as the current step in the workflow. The WorkflowRunner carries out each step in the workflow by delegating to an Action contract.
Steps are the building blocks of a workflow, responsible for carrying out interactions with external protocols. There are three main types of steps:
Actions are the building blocks of a workflow. They are responsible for carrying out a single step in the workflow. They do this by integrating with external protocols like Uniswap, Compound, and Aave. When the WorkflowRunner delegates to an Action, it carries out the necessary interactions with the external protocol to fulfill the goal of that step.
Branches allow the workflow to take different paths depending on the outcome of a condition. This type of step enables users to create more complex workflows that respond to changing market conditions or user input. For example, users can set up a branch that takes a different path based on how much of an asset is present in the workflow, or based on the current market price of an asset
Bridges are steps that have the super power of being able to teleport assets to a different blockchain. This allows workflows to span multiple blockchains, and enables users to take advantage of different protocols and platforms on different blockchains.
In addition to these core components, the Workflow Engine also includes other features such as error handling and event tracking. These features help to ensure that workflows execute reliably and provide users with real-time feedback on the status of their workflow.