Skip to content

Commit

Permalink
fix(7821): replace call struct with execution
Browse files Browse the repository at this point in the history
  • Loading branch information
McOso committed Feb 3, 2025
1 parent 33bbbc7 commit fb7a2c8
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions ERCS/erc-7821.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ The minimal batch executor interface is defined as follows:
```solidity
/// @dev Interface for minimal batch executor.
interface IERC7821 {
/// @dev Call struct for the `execute` function.
struct Call {
/// @dev Execution struct for the `execute` function.
struct Execution {
address target; // Replaced with `address(this)` if `address(0)`.
uint256 value; // Amount of native currency (i.e. Ether) to send.
bytes data; // Calldata to send with the call.
bytes callData; // Calldata to send with the call.
}
/// @dev Executes the calls in `executionData`.
Expand Down Expand Up @@ -77,7 +77,7 @@ interface IERC7821 {
/// `opData` may be used to store additional data for authentication,
/// paymaster data, gas limits, etc.
///
/// For calldata compression efficiency, if a Call.target is `address(0)`,
/// For calldata compression efficiency, if a Execution.target is `address(0)`,
/// it will be replaced with `address(this)`.
function execute(bytes32 mode, bytes calldata executionData)
external
Expand Down Expand Up @@ -142,11 +142,11 @@ abstract contract ERC7821 {
/* STRUCTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Call struct for the `execute` function.
struct Call {
/// @dev Execution struct for the `execute` function.
struct Execution {
address target; // Replaced with `address(this)` if `address(0)`.
uint256 value; // Amount of native currency (i.e. Ether) to send.
bytes data; // Calldata to send with the call.
bytes callData; // Calldata to send with the call.
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
Expand Down Expand Up @@ -192,7 +192,7 @@ abstract contract ERC7821 {
/// `opData` may be used to store additional data for authentication,
/// paymaster data, gas limits, etc.
///
/// For calldata compression efficiency, if a Call.target is `address(0)`,
/// For calldata compression efficiency, if a Execution.target is `address(0)`,
/// it will be replaced with `address(this)`.
function execute(bytes32 mode, bytes memory executionData)
public
Expand All @@ -216,12 +216,12 @@ abstract contract ERC7821 {
let executionDataLength := mload(executionData)
tryWithOpData := and(eq(id, 2), and(gt(executionDataLength, 0x3f), t))
}
Call[] memory calls;
Execution[] memory calls;
bytes memory opData;
if (tryWithOpData) {
(calls, opData) = abi.decode(executionData, (Call[], bytes));
(calls, opData) = abi.decode(executionData, (Execution[], bytes));
} else {
calls = abi.decode(executionData, (Call[]));
calls = abi.decode(executionData, (Execution[]));
}
_execute(calls, opData);
}
Expand Down Expand Up @@ -257,7 +257,7 @@ abstract contract ERC7821 {
/// @dev Executes the calls and returns the results.
/// Reverts and bubbles up error if any call fails.
function _execute(Call[] memory calls, bytes memory opData)
function _execute(Execution[] memory calls, bytes memory opData)
internal
virtual
{
Expand All @@ -273,11 +273,11 @@ abstract contract ERC7821 {
/// @dev Executes the calls.
/// Reverts and bubbles up error if any call fails.
function _execute(Call[] memory calls) internal virtual {
function _execute(Execution[] memory calls) internal virtual {
for (uint256 i; i < calls.length; ++i) {
Call memory c = calls[i];
Execution memory c = calls[i];
address target = c.target == address(0) ? address(this) : c.target;
_execute(target, c.value, c.data);
_execute(target, c.value, c.callData);
}
}
Expand Down

0 comments on commit fb7a2c8

Please sign in to comment.