The Othentic Stack allows developers to write an AVSLogic contract, which provides pre and post execution hooks for task submission on-chain, and enables highly configurable and customized logic.
Interface
The interface defines two functions: beforeTaskSubmission and afterTaskSubmission. As their names suggest, these functions allow developers to implement custom AVS logic before and after task submission within the contract.
After implementation, you can deploy the contract on the same L2 network as the AttestationCenter.
Make sure to deploy the Othentic contracts before deploying the AVS Logic.
After deployment, you must call the setAvsLogic function on the AttestationCenter and provide the address of the AvsLogic contract as the parameter, as shown in the example below.
Note that only the AVS Governance Multisig is authorized to call this function.
Now, the AVS contracts are set and ready to be used.
Examples
Task Management
There might be a need to manage and/or track tasks after completion. For example, you can have an array of task results such that anyone can fetch task history and data on chain.
This can be implemented using the AVS Logic. Implement the afterTaskSubmission function such that it sets the task details on-chain which other contracts can fetch via a getter function.
An example could be a random number generator. After a task is completed, the random number generated will be updated on the AvsLogic contract via the afterTaskSubmission function.
Another example could be EigenDA . The task is completed when the confirmBatch function is called which adds the batch details into a mapping stored in the contract.
Note that the function also checks the quorum and emits an event, but these steps have already been executed in the submitTask function.
Updating arbitrary contracts
According to your design, your AVS might have an IFTTT architecture where you might need to do post execution tasks on-chain.
For example, the AVS might be an Oracle service that fetches the latest data of a query. After the operators submit the final result and the task is submitted, you might need to update the latest data on a separate Oracle contract.
The AvsLogic can implement this functionality by calling the contract and updating its state to reflect the latest task data.