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.
The interface declares two functions, namely beforeTasksubmission and afterTaskSubmission. As the name suggests, developers can implement their AVS logic in this contract.
These functions are called by the AttestationCenter inside the submitTask function which is called by the aggregator.
After deploying, you need to call the setAvsLogic function on the AttestationCenter and pass in the address of the AvsLogic as the parameter. 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 they’re completed. 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 can be fetched by other contracts 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 are already 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.