How to work with Automate7579

Overview how to enhance programmable smart accounts utilizing erc7579.

  1. Install the Automate7579 module on account abstraction using the installModule function.

function installModule(
    uint256 moduleTypeId,
    address module, 
    bytes calldata initData
) external;
NameDescription

moduleTypeId

Type of module to install. In our case, the value is 2.

module

The address of the contract that the module.

initData

Initialization data. See more details in the tests.

  1. Add automation via the addWorkflow function. During the workflow addition process, you can initialize the checker. The request to the checker will be executed before the execution of the main action on the target contract. Initialization of checker is optional. If there is no need for checks, then the _inits array can be left empty.

function addWorkflow(
    Execution[] memory _inits,
    Execution[] memory _actions,
    uint256 _maxGasPrice,
    uint256 _maxGasLimit,
    uint88 _count
) external;
NameDescription

_inits

Data for calls that are made at the stage of adding Workflow.

_actions

Data for Workflow execution.

_maxGasPrice

The maximum gas price at which the Workflow will be executed, otherwise revert

_maxGasLimit

The maximum amount of gas that will be spent on Workflow execution.

_count

The number of times Workflow can be called. If 0 is passed, then the number of calls is unlimited.

  1. At the last stage, DittoEntryPoint makes a call to Automate7579. Now Automate7579 makes a call to account abstraction so that it makes a call to target contract.

The tests show an example of how the Automate7579 contract works, as well as installing the Automate7579 module on account abstraction as an executor.

Last updated