PresetMultipleActions.sol
PresetMultipleActions.sol is an executive law that enables the execution of multiple predefined actions from a configurable set. It provides a mechanism to execute selected actions from a predefined list with fixed parameters.
Overview
This law provides a mechanism to:
Execute multiple function calls from a predefined set
Select which actions to execute using boolean flags
Use predefined target contracts and functions
Pass fixed parameters to the functions
Track execution history
Enforce execution rules
Configuration
When adopting a PresetMultipleActions instance, four parameters must be provided:
descriptions
(string[]): Array of human-readable descriptions for each actiontargets
(address[]): Array of target contract addressesvalues
(uint256[]): Array of ETH values to send with each callcalldatas
(bytes[]): Array of encoded function call data
Usage
Proposing an Action
When calling the law, an array of boolean values must be provided. Each boolean corresponds to a predefined action - if set to true
, that action will be executed.
Execution Flow
Configuration Validation
Verifies target addresses
Validates calldata formats
Checks execution conditions
Action Selection
Processes boolean array to determine which actions to execute
Filters out actions marked as
false
Prepares execution data for selected actions
Function Execution
Executes each selected function call in sequence
Sends ETH if values > 0
Maintains execution order
State Management
Records execution history
Updates execution state
Tracks function calls
Technical Specifications
State Variables
struct Data {
string[] descriptions; // Array of human-readable descriptions
address[] targets; // Array of target contracts
uint256[] values; // Array of ETH values
bytes[] calldatas; // Array of function call data
}
mapping(bytes32 lawHash => Data) public data;
Functions
initializeLaw
initializeLaw
function initializeLaw(
uint16 index,
string memory nameDescription,
bytes memory inputParams,
bytes memory config
) public override
Initializes law with configuration parameters
Sets up target contracts and functions
Stores execution parameters
Creates boolean input parameters for each action
handleRequest
handleRequest
function handleRequest(
address caller,
address powers,
uint16 lawId,
bytes memory lawCalldata,
uint256 nonce
) public view virtual override returns (
uint256 actionId,
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas
)
Processes the execution request
Decodes boolean array to determine selected actions
Filters and prepares function calls for selected actions
Returns execution data
Error Conditions
Function Call Errors
"Invalid target"
"Invalid calldata"
"Function call failed"
Parameter Errors
"Invalid value"
"Invalid calldata format"
"Array length mismatch"
Validation Errors
Zero address target
Invalid calldata
Invalid value amount
Current Deployments
421614
Arbitrum Sepolia
0x81Bb430DF6ab37466270ECFE6f7c29B3D3e44A35
11155420
Optimism Sepolia
0x81Bb430DF6ab37466270ECFE6f7c29B3D3e44A35
11155111
Ethereum Sepolia
0x81Bb430DF6ab37466270ECFE6f7c29B3D3e44A35
Last updated