JobRegistry
This page covers technical information on the JobRegistry contract.
Events
JobCreated
event JobCreated(uint256 indexed index, address indexed owner, address indexed application, bool initialExecution)Emitted when a job is created via createJob.
JobDeleted
event JobDeleted(uint256 indexed index, address indexed owner, address indexed application, bool applicationRevertedOnDelete)Emitted when a job is deleted via deleteJob.
JobDeactivated
event JobDeactivated(uint256 indexed index, address indexed owner, address indexed application);Emitted when a job is deactivated via deactivateJob.
JobExecuted
event JobExecuted(uint256 indexed index, address indexed owner, address indexed application, bool success, uint48 executionNumber, uint256 executionFee, address executionFeeToken, bool inZeroFeeWindow);Emitted when a job is executed via execute.
FeeModuleUpdate
Emitted when the fee module data is updated or a migration to a new fee module for a job via updateFeeModule.
SponsorshipRevoked
Emitted when the sponsor of a job revokes the sponsorship via revokeSponsorship.
State-changing functions
createJob
Creates a new job according to the _specification. This call will make external onCreateJob calls to the specified execution module, fee module and application. Both _sponsorSignature and _ownerSignature are EIP-712 signatures of the _specification. The function supports ERC-1271 and ERC-6492 verification of signatures.
Arguments
_specification
JobSpecification calldata
Specification of the job containing, execution module, fee module, application and initialization data to these, as well as general job settings.
_sponsor
address
Address of the sponsor. The zero address means no sponsor set.
_sponsorSignature
bytes calldata
An EIP-712 signature of the _specification, signed by _sponsor.
_ownerSignature
bytes calldata
An EIP-712 signature of _specification, signed by _specification.owner.
_index
uint256
Index in the jobs array where the job is intended to be created.
Notes
If
_indexis greater or equal to the current length of thejobsarray, then the job will be created at the last index expanding thejobsarray. Otherwise it will try to reuse the existing slot at_indexsucceeding if the current job at that index is expired or has been deleted. Otherwise, it falls back to expanding the array.If the caller is the
ownerof the_specificationthen the_ownerSignatureis not considered.If the
_sponsoris the zero address, then the_sponsorSignatureis not considered.The sponsor will be set as the payer of execution fees and should thus have approved fee tokens to the
JobRegistrycontract.The job may execute immediately as decided by the execution module and
_specification.executionModuleInput. In this case the application will be executed and the execution counter is incremented. If the application call reverts, then thecreateJobcall also reverts.Having both
_specification.sponsorFallbackToOwnerand_specification.sponsorCanUpdateFeeModuletrue at the same time should be prevented as the sponsor can update the fee module setting an exceedingly large fee and then withdraw their sponsorship, falling back to the owner.
Emits JobCreated and possibly JobExecuted.
execute
Executes a job, making external onExecuteJob calls to the execution module, fee module and application associated with the job. It also handles transferring of execution fees.
Arguments
_index
uint256
The index of the job to be executed in the jobs array.
_feeRecipient
address
Address that execution fees are transferred to.
Return data
executionFee
uint256
Number of executionFeeToken that are transferred to _recipient.
executionFeeToken
address
Address of the ERC-20 token the execution fee is transferred in.
executionModule
uint8
Identifier of the executed job's execution module.
feeModule
uint8
Identifier of the executed job's fee module.
inZeroFeeWindow
bool
A flag telling if the job is in zero fee window.
Notes
Can only be called by
coordinator.If the
sponsorFallbackToOwnerfield of the job is true, it will try to transfer the fee from the owner if transferring from the sponsor fails. If the owner transfer succeeds, the owner is set as sponsor.May deactivate the job if application reverted and the
ignoreAppRevertproperty of the job is false or ifmaxExecutionsof the job is reached.Only increments the job's
executionCounterupon successful execution of application (even whenignoreAppRevertis true).
Emits JobExecuted.
deleteJob
Deletes the job from the jobs array and externally calls onDeleteJob on the associated execution module, fee module and application.
Arguments
_index
uint256
Index in the jobs array of the job to be deleted.
Notes
Can only be called by the owner of the job.
Will not revert of application's
onDeleteJobcall reverts.
Emits JobDeleted.
deactivateJob
Deactivates a job, preventing it from being executed, but keeps the job in storage.
Arguments
_index
uint256
Index in the jobs array of the job to be deactivated.
Notes
Can only be called by the owner of the job.
Sets
activatefield of the job to false.Does not perform any external calls to modules or application.
Emits JobDeactivated.
revokeSponsorship
Revokes sponsorship of a job, alternating the sponsor field of the job.
Arguments
_index
uint256
Index in the jobs array of the job to revoke sponsorship for.
Notes
Can only be called by the owner or the sponsor of the job.
If called by the owner, the owner is set as the new sponsor.
If called by the sponsor, the owner is set as sponsor if the
sponsorFallbackToOwnerof the job is set to true, otherwise it sets the zero address as sponsor. Note that in this case, if the job owner does not find a new sponsor or chose to sponsor themselves before the next execution window is over, then the job will expire.
Emits SponsorshipRevoked.
updateFeeModule
Updates current fee module data or migrates to a different fee module. This function supports EIP-1271 and EIP-6492.
Arguments
_feeModuleInput
FeeModuleInput calldata
Contains information about the new fee module as well as input data to the module.
_sponsor
address
Address of the new sponsor of the job.
_sponsorSignature
bytes calldata
EIP-712 signature of the _feeModuleInput.
Notes
Can only be called by the owner of the job, unless the
sponsorCanUpdateFeeModulefield of the job is true, then the sponsor can also call this function.Cannot be called while the job is in execution window.
If the fee module code is the same as the current one, the fee module data is updated calling
onUpdateDataon the existing fee module.If the fee module code differs from the current one, a migration to the new fee module happens. Here,
onDeleteJobis called on the old fee module andonCreateJobis called on the new fee module.
Emits FeeModuleUpdate.
Read-only functions
getJobsArrayLength
Returns the length of the jobs array.
Return data
length
uint256
Length of the jobs array.
Last updated