Sponsored jobs

Jobs can be sponsored, meaning that someone else than the owner pays the execution fee. By default, if a job is created without a sponsor, the owner is set as the sponsor, thus as the payer of execution fees. To sponsor a job, an EIP-712 signature over a specific JobSpecification has to be provided ias an argument to the createJob function in the JobRegistry contract:

struct JobSpecification {
    uint256 nonce;
    uint256 deadline;
    IApplication application;
    uint32 executionWindow;
    bytes1 executionModule;
    bytes1 feeModule;
    bytes executionModuleInput;
    bytes feeModuleInput;
    bytes applicationInput;
}

The createJob function verifies the signature against the provided values, ensuring the sponsor that only a job with the agreed upon specification can be sponsored. Note that the parameter applicationInput is part of the signed struct. This is the same input data which is provided to the executable upon creation, which means that the sponsor is also guaranteed that even inputs to the application is a agreed upon.

The sponsor or owner of a job can at any time revoke the sponsorship, hereby setting the owner as the sponsor. Changing the fee module data in by calling updateFeeModuleData or migrating to a new fee module calling migrateFeeModule will automatically revoke the sponsorship, but a new sponsor can be set given a new signature signing a FeeModuleInput struct:

struct FeeModuleInput {
    uint256 nonce;
    uint256 deadline;
    uint256 index;
    bytes1 feeModule;
    bytes feeModuleInput;
}

Note: Signing a EIP-712 signature is a completely off-chain operation and will not incur gas cost.

Note: Signatures of JobSpecification and FeeModuleInput share the same nonces, so make sure to always use unused nonces.

Last updated