BespokeAction_OnReturnValue
BespokeAction_OnReturnValue is an executive mandate that chains actions together. It retrieves the return data from a previously executed mandate and uses it as a parameter for a new function call.
Overview
Section titled “Overview”This mandate enables sequential workflows where the output of one action is required as the input for the next. For example, deploying a contract and then immediately calling a function on its new address. It constructs a call by sandwiching the retrieved return data between two static parameter blocks.
Configuration
Section titled “Configuration”When adopting a BespokeAction_OnReturnValue instance, the following parameters are required:
TargetContract(address): The address of the contract to call.FunctionSelector(bytes4): The function selector to call.paramsBefore(bytes): Encoded data to place before the return value.Params(string[]): UI hints describing the input parameters (used to locate the parent action).parentMandateId(uint16): The ID of the mandate whose action output will be used.paramsAfter(bytes): Encoded data to place after the return value.
Proposing an Action
Section titled “Proposing an Action”When calling the mandate, the input (mandateCalldata) must match the input used for the parent action. This is because the mandate locates the previous action’s result by re-computing its Action ID, which is derived from the mandate ID, calldata, and nonce.
Execution Flow
Section titled “Execution Flow”-
Data Retrieval
- Computes the
parentActionIdusing the configuredparentMandateIdand the currentmandateCalldataandnonce. - Queries the Powers contract to retrieve the
returnDataassociated with thatparentActionId.
- Computes the
-
Parameter Assembly
- Concatenates the components:
FunctionSelector + paramsBefore + returnData + paramsAfter.
- Concatenates the components:
-
Execution
- Calls the
TargetContractwith the assembled data.
- Calls the
Technical Specifications
Section titled “Technical Specifications”Functions
Section titled “Functions”initializeMandate
Section titled “initializeMandate”function initializeMandate(...) public override- Initializes the chaining configuration.
- Sets input parameters.
handleRequest
Section titled “handleRequest”function handleRequest(...) public view virtual override returns (...)- Retrieves the return data.
- Assembles the new call.
Current Deployments
Section titled “Current Deployments”| Chain ID | Chain Name | Address |
|---|---|---|