Skip to content

Commit

Permalink
Use call data directly
Browse files Browse the repository at this point in the history
  • Loading branch information
ScreamingHawk committed Sep 17, 2023
1 parent 8cdc096 commit ce8904b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions contracts/hooks/EIP4337Hook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity 0.8.18;
import {IEIP4337Hook, IAccount} from './interfaces/IEIP4337Hook.sol';
import {IERC1271Wallet} from '../interfaces/IERC1271Wallet.sol';
import {IModuleCalls} from '../modules/commons/interfaces/IModuleCalls.sol';
import {LibOptim} from '../utils/LibOptim.sol';

contract EIP4337Hook is IEIP4337Hook {
address public immutable entrypoint;
Expand Down Expand Up @@ -32,14 +31,17 @@ contract EIP4337Hook is IEIP4337Hook {
*/
function eip4337SelfExecute(IModuleCalls.Transaction[] calldata txs) external payable onlyEntrypoint {
// Self execute
(bool success, ) = payable(address(this)).call{value: msg.value}(
(bool success, bytes memory returndata) = payable(address(this)).call{value: msg.value}(
abi.encodeWithSelector(IModuleCalls.selfExecute.selector, txs)
);
if (!success) {
// Bubble up revert reason
bytes memory reason = LibOptim.returnData();
if (returndata.length == 0) {
revert(); // solhint-disable-line reason-string
}
assembly {
revert(add(reason, 0x20), mload(reason))
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
}
}
Expand Down

0 comments on commit ce8904b

Please sign in to comment.