Requests
Everything that's automated in Autonomy is in the form of a Request - users register Requests in the Registry, and executors monitor the Registry for Requests that can be executed, then execute them when the conditions for execution are true. Having a single Registry that is fully generalised to be able to automate any on-chain action makes Autonomy the only automation solution that can be used off-the-shelf and doesn't need manual support to be added for novel use cases.
A Request details everything needed for some action to be taken on behalf of the user. It's made up of the following components:
user- the user (i.e.msg.sender) who made theRequesttarget- the contract address that needs to be called when executedreferer- the dapp that integrated Autonomy (to be rewarded in tokens for every successfully executedRequest)callData- the details of the function that the user wants to be called, along with the function inputsinitEthSent- the amount of ETH sent when theRequestwas made (for both paying for the eventual execution of theRequest, and also for any ETH that needs to be sent along with the function call that is being requested, such as an eth-to-token Uniswap trade)ethForCall- the amount of ETH that should be sent in the requested function callverifyUser- whether or not the 1st input to the function call being requested is the address of the user registering the currentRequest(if true, the call will be routed through a separateForwardercontract with a different address, meaning that if a contract receives a call withmsg.senderthat is thatForwarder, it's guaranteed that the 1st input to the function is the originaluserwho made theRequest. This enables authentication, allowing them to safely calltransferFrometc to move user funds)insertFeeAmount- whether the fee being charged for execution of theRequestshould be forwarded along with the call, so that the receiving contract can pay it, for example in the case of a limit order, the fee can be taken out of the output token. IfverifyUserisfalse, then the fee will be inserted into the 2nd input parameter of the call. IfverifyUserisfalse, then the fee will be inserted into the 1st input parameter of the callpayWithAUTO- whether the gas cost for execution + fee should be paid in AUTO (iftrue, the fee is only an extra 10% of the gas cost of execution, whereas iffalse, the fee in ETH is an extra 30% of the gas cost of execution). Paying with AUTO also allows you to keep funds in your wallet and only pay when the execution takes place (because oftransferFrom), rather than paying upfrontisAlive- whether theRequestshould be deleted after executing, i.e. whether it's recurring or not
A Request is executed by an executor who calls executeHashedReq. This essentially:
Calls the desired function with
target.call{value: ethForCall}(callData)Measures the gas spent doing so
Charges the user for that gas + fee and sends it to the executor
Since Autonomy is a staked system for executing, any execution attempt also checks that the executor is the current executor for that epoch. If the executor of this epoch hasn't been 'set' yet, then before any execution begins, the StakeManager will calculate which executor can execute for this epoch, set that for the whole epoch, then check whether the current executing executor is the selected executor for this epoch.
Last updated
Was this helpful?