@@ -28,8 +28,7 @@ contract ERC7821 is Receiver {
2828 /* EXECUTION OPERATIONS */
2929 /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
3030
31- /// @dev Executes the `calls` in `executionData` and returns the results.
32- /// The `results` are the returned data from each call.
31+ /// @dev Executes the calls in `executionData`.
3332 /// Reverts and bubbles up error if any call fails.
3433 ///
3534 /// `executionData` encoding:
@@ -49,12 +48,7 @@ contract ERC7821 is Receiver {
4948 ///
5049 /// `opData` may be used to store additional data for authentication,
5150 /// paymaster data, gas limits, etc.
52- function execute (bytes32 mode , bytes calldata executionData )
53- public
54- payable
55- virtual
56- returns (bytes [] memory )
57- {
51+ function execute (bytes32 mode , bytes calldata executionData ) public payable virtual {
5852 uint256 id = _executionModeId (mode);
5953 Call[] calldata calls;
6054 bytes calldata opData;
@@ -64,7 +58,7 @@ contract ERC7821 is Receiver {
6458 mstore (0x00 , 0x7f181275 ) // `UnsupportedExecutionMode()`.
6559 revert (0x1c , 0x04 )
6660 }
67- // Use inline assembly to extract the ` calls` and optional `opData` efficiently.
61+ // Use inline assembly to extract the calls and optional `opData` efficiently.
6862 opData.length := 0
6963 let o := add (executionData.offset, calldataload (executionData.offset))
7064 calls.offset := add (o, 0x20 )
@@ -76,7 +70,7 @@ contract ERC7821 is Receiver {
7670 opData.length := calldataload (q)
7771 }
7872 }
79- return _execute (mode, executionData, calls, opData);
73+ _execute (mode, executionData, calls, opData);
8074 }
8175
8276 /// @dev Provided for execution mode support detection.
@@ -105,15 +99,15 @@ contract ERC7821 is Receiver {
10599 }
106100 }
107101
108- /// @dev Executes the ` calls` and returns the results .
102+ /// @dev Executes the calls.
109103 /// Reverts and bubbles up error if any call fails.
110104 /// The `mode` and `executionData` are passed along in case there's a need to use them.
111105 function _execute (
112106 bytes32 mode ,
113107 bytes calldata executionData ,
114108 Call[] calldata calls ,
115109 bytes calldata opData
116- ) internal virtual returns ( bytes [] memory ) {
110+ ) internal virtual {
117111 // Silence compiler warning on unused variables.
118112 mode = mode;
119113 executionData = executionData;
@@ -127,20 +121,10 @@ contract ERC7821 is Receiver {
127121 revert (); // In your override, replace this with logic to operate on `opData`.
128122 }
129123
130- /// @dev Executes the ` calls` and returns the results .
124+ /// @dev Executes the calls.
131125 /// Reverts and bubbles up error if any call fails.
132126 /// `extraData` can be any supplementary data (e.g. a memory pointer, some hash).
133- function _execute (Call[] calldata calls , bytes32 extraData )
134- internal
135- virtual
136- returns (bytes [] memory results )
137- {
138- /// @solidity memory-safe-assembly
139- assembly {
140- results := mload (0x40 ) // Grab the free memory pointer.
141- mstore (results, calls.length ) // Store the length of results.
142- mstore (0x40 , add (add (results, 0x20 ), shl (5 , calls.length ))) // Allocate memory.
143- }
127+ function _execute (Call[] calldata calls , bytes32 extraData ) internal virtual {
144128 uint256 n = calls.length << 5 ;
145129 for (uint256 j; j != n;) {
146130 address target;
@@ -158,36 +142,27 @@ contract ERC7821 is Receiver {
158142 data.length := calldataload (o)
159143 j := add (j, 0x20 )
160144 }
161- bytes memory r = _execute (target, value, data, extraData);
162- /// @solidity memory-safe-assembly
163- assembly {
164- mstore (add (results, j), r) // Set `results[i]` to `r`.
165- }
145+ _execute (target, value, data, extraData);
166146 }
167147 }
168148
169- /// @dev Executes the `calls` and returns the result .
149+ /// @dev Executes the call .
170150 /// Reverts and bubbles up error if any call fails.
171151 /// `extraData` can be any supplementary data (e.g. a memory pointer, some hash).
172152 function _execute (address target , uint256 value , bytes calldata data , bytes32 extraData )
173153 internal
174154 virtual
175- returns (bytes memory result )
176155 {
177156 /// @solidity memory-safe-assembly
178157 assembly {
179- result := mload (0x40 ) // Grab the free memory pointer.
180- calldatacopy (result, data.offset, data.length )
181- if iszero (call (gas (), target, value, result, data.length , codesize (), 0x00 )) {
158+ extraData := extraData // Silence unused variable compiler warning.
159+ let m := mload (0x40 ) // Grab the free memory pointer.
160+ calldatacopy (m, data.offset, data.length )
161+ if iszero (call (gas (), target, value, m, data.length , codesize (), 0x00 )) {
182162 // Bubble up the revert if the call reverts.
183- returndatacopy (result , 0x00 , returndatasize ())
184- revert (result , returndatasize ())
163+ returndatacopy (m , 0x00 , returndatasize ())
164+ revert (m , returndatasize ())
185165 }
186- mstore (result, returndatasize ()) // Store the length.
187- let o := add (result, 0x20 )
188- returndatacopy (o, 0x00 , returndatasize ()) // Copy the returndata.
189- mstore (0x40 , add (o, returndatasize ())) // Allocate the memory.
190- extraData := extraData // Silence unused variable compiler warning.
191166 }
192167 }
193168}
0 commit comments