Skip to content

ExecutionHelper

aboudjem edited this page Jun 7, 2024 · 1 revision

Table of Contents


ExecutionHelper

Git Source

Inherits: IExecutionHelperEventsAndErrors

Implements execution management within the Nexus suite, facilitating transaction execution strategies and error handling.

Provides mechanisms for direct and batched transactions with both committed and tentative execution strategies as per ERC-4337 and ERC-7579 standards.


Functions

_execute

Executes a call to a target address with specified value and data.

function _execute(address target, uint256 value, bytes calldata callData) internal virtual returns (bytes memory result);

Parameters

Name Type Description
target address The address to execute the call on.
value uint256 The amount of wei to send with the call.
callData bytes The calldata to send.

Returns

Name Type Description
result bytes The bytes returned from the execution.

_tryExecute

Tries to execute a call and captures if it was successful or not.

Similar to _execute but returns a success boolean and catches reverts instead of propagating them.

function _tryExecute(address target, uint256 value, bytes calldata callData) internal virtual returns (bool success, bytes memory result);

Parameters

Name Type Description
target address The address to execute the call on.
value uint256 The amount of wei to send with the call.
callData bytes The calldata to send.

Returns

Name Type Description
success bool True if the execution was successful, false otherwise.
result bytes The bytes returned from the execution.

Caution

_tryExecute: This function captures reverts and returns a success boolean, ensuring the transaction status is known without propagating the revert, which is critical for error handling in complex systems.

_executeBatch

Executes a batch of calls.

function _executeBatch(Execution[] calldata executions) internal returns (bytes[] memory result);

Parameters

Name Type Description
executions Execution[] An array of Execution structs each containing target, value, and calldata.

Returns

Name Type Description
result bytes[] An array of results from each executed call.

_tryExecuteBatch

Tries to execute a batch of calls and emits an event for each unsuccessful call.

function _tryExecuteBatch(Execution[] calldata executions) internal returns (bytes[] memory result);

Parameters

Name Type Description
executions Execution[] An array of Execution structs.

Returns

Name Type Description
result bytes[] An array of results, with unsuccessful calls marked by events.

Important

_tryExecuteBatch: This function ensures that all calls in a batch are attempted, and emits events for unsuccessful calls, which is crucial for monitoring and debugging batch transactions.