Build an executor bot
This page will go over some concepts which are important when building an EES executor bot, whether it be for profit or to ensure processing of jobs related to your own application.
Execution module specific logic
Execution modules determine crucial information such as:
When the job can be executed
Who can execute the job
How much the execution fee will be
The execution fee token
All of these are necessary to avoid failed or unprofitable transactions. Since each execution module contains its own rules, it is important to implement custom logic to each of those you wish to support.
Off-chain computation
All information necessary to determine if a job is profitable and can be executed is stored inside the job's execution module. Execution module data is stored as Param
structs inside the params
mapping. To avoid unnecessary RPC calls it can be advantateous to query the state once and update it locally by listening for events.
Listen for events
Events emitted from the JobManager
will tell when a job is created, executed or deleted. It is also beneficial to listen for execution module specific events such as if the fee function has changed.
Parallelisation
Since all jobs are stored in the public jobs
array, execution can easy be parallelised. The array can simply be split into even sections that each executor bot takes care of.
The BatchExecutor contract
BatchExecutor
is a contract which enables executing multiple jobs in a single batch. Even if one of the jobs fails to be executed, the transaction as a whole will not revert. This protects against someone executing a job just before you, reverting the whole batch. Furthermore, it returns a receipt for each successful payments processed containing information about the fee received.
Correct for protocol fee
The JobManager
contract splits the execution fee calculated by the execution module in two: one part to the protocol and one part to the executor. It is therefore crucual to implement into your calculations to know when a job is profitable to execute or not. Read more about this and how to calculate it here.
Strict gas price monitoring
Strict gas price monitoring is crucial to implementing a profitable executor bot. The profit you can make on executing a specific job is primarily depending on the current gas price together with how large the received execution fee is. Having live gas monitoring will give you an edge over other executor bots.
Last updated