Safe_ExecTransaction_OnReturnValue
Safe_ExecTransaction_OnReturnValue is an advanced integration mandate that executes a transaction on a Gnosis Safe, dynamically constructing the call data using the return value of a previous action.
Overview
Section titled “Overview”This mandate allows for complex, multi-step workflows where the output of one action (e.g., a deployed contract address or a calculated value) becomes a parameter in a subsequent Safe transaction. It “sandwiches” the dynamic return data between static byte arrays to form the complete function call.
It assumes that the Powers contract is an owner of the target Safe, allowing it to authorize transactions directly.
Configuration
Section titled “Configuration”When adopting a Safe_ExecTransaction_OnReturnValue instance, the following parameters are required:
TargetContract(address): The destination address for the internal Safe transaction.FunctionSelector(bytes4): The function selector of the call to be made.paramsBefore(bytes): Static bytes to append before the dynamic return data.Params(string[]): The description of input parameters required by the parent mandate.parentMandateId(uint16): The ID of the parent mandate that generates the dynamic data.paramsAfter(bytes): Static bytes to append after the dynamic return data.
Proposing an Action
Section titled “Proposing an Action”When calling the mandate, the inputs provided must match the inputs expected by the parent parentMandateId. These inputs are used to re-compute the parent’s Action ID to look up its result.
Execution Flow
Section titled “Execution Flow”-
Data Retrieval
- Computes the
parentActionIdusing the provided calldata. - Retrieves the
returnDatafrom the executed parent action.
- Computes the
-
Transaction Construction
- Assembles the full transaction data:
FunctionSelector + paramsBefore + returnData + paramsAfter. - Constructs a signature (
v=1) authorizing the transaction as the Powers contract (owner).
- Assembles the full transaction data:
-
Safe Execution
- Identifies the Safe Treasury address.
- Generates a call to
Safe.execTransaction. - The Safe executes the internal call to
TargetContractwith the assembled data.
Technical Specifications
Section titled “Technical Specifications”Functions
Section titled “Functions”initializeMandate
Section titled “initializeMandate”function initializeMandate(...) public override- Initializes the mandate configuration.
- Sets the input parameter descriptions.
handleRequest
Section titled “handleRequest”function handleRequest(...) public view override returns (...)- Retrieves dynamic data.
- Constructs the composite call data.
- Generates the Safe transaction.
Current Deployments
Section titled “Current Deployments”| Chain ID | Chain Name | Address |
|---|---|---|