Jobs and registry
A job is an on-chain specification of the details of the execution. The JobRegistry
contract stores them as Job
structs inside a public array jobs
:
The owner
is the creator of the job and has the ability to cancel the job. sponsor
is the address paying execution fees. If the job is created without a sponsor, the owner will be set as sponsor, more on that here. The executable
is the contract to be called upon execution. Finally, the executionModule
specifies which execution module is used for the job.
Jobs can be expired. Whether a job is expired or not is determined by its execution module by the jobIsExpired
function. If a job is expired, it can be deleted by anyone and not just the owner of the job.
Note: A job that is expired cannot be executed. Deleting a job simply means deleting the struct and calling onDeleteJob
on its execution module, fee module and application.
When a job is canceled, its index in the jobs
array is freed up and can be taken by another newly created job. This effectively makes the slots in the jobs
array reusable and helps maintaing the size of the array and this minimizing the memory footprint on the chain. Because it is cheaper gas wise to cancel an expired job than extending the array, there is incentivement to do so.
Careful: If you are storing indices off-chain, be sure to check that the jobs are still the ones you expect and that they have not been canceled and replaced. Listening for events can help updating these automatically.
Last updated