@@ -39,11 +39,7 @@ contract MinimalAccountTest is Test {
3939 assertEq (usdc.balanceOf (address (minimalAccount)), 0 );
4040 address dest = address (usdc);
4141 uint256 value = 0 ;
42- bytes memory functionData = abi.encodeWithSelector (
43- ERC20Mock .mint.selector ,
44- address (minimalAccount),
45- AMOUNT
46- );
42+ bytes memory functionData = abi.encodeWithSelector (ERC20Mock .mint.selector , address (minimalAccount), AMOUNT);
4743
4844 vm.startPrank (minimalAccount.owner ());
4945 // vm.deal(minimalAccount.owner(), 10e18);
@@ -57,16 +53,10 @@ contract MinimalAccountTest is Test {
5753 assertEq (usdc.balanceOf (address (minimalAccount)), 0 );
5854 address dest = address (usdc);
5955 uint256 value = 0 ;
60- bytes memory functionData = abi.encodeWithSelector (
61- ERC20Mock .mint.selector ,
62- address (minimalAccount),
63- AMOUNT
64- );
56+ bytes memory functionData = abi.encodeWithSelector (ERC20Mock .mint.selector , address (minimalAccount), AMOUNT);
6557
6658 vm.prank (randomUser);
67- vm.expectRevert (
68- MinimalAccount.MinimalAccount_NotFromEntryPointOrOwner.selector
69- );
59+ vm.expectRevert (MinimalAccount.MinimalAccount_NotFromEntryPointOrOwner.selector );
7060 minimalAccount.execute (dest, value, functionData);
7161 }
7262
@@ -92,32 +82,16 @@ contract MinimalAccountTest is Test {
9282 assertEq (usdc.balanceOf (address (minimalAccount)), 0 );
9383 address dest = address (usdc);
9484 uint256 value = 0 ;
95- bytes memory functionData = abi.encodeWithSelector (
96- ERC20Mock .mint.selector ,
97- address (minimalAccount),
98- AMOUNT
99- );
100-
101- bytes memory executeCallData = abi.encodeWithSelector (
102- MinimalAccount.execute.selector ,
103- dest,
104- value,
105- functionData
106- );
107-
108- (PackedUserOperation memory packedUserOperation , ) = sendPackedUserOp
109- .generateSignedUserOperation (
110- executeCallData,
111- helperConfig.getConfig ()
112- );
113- bytes32 userOperationHash = IEntryPoint (
114- helperConfig.getConfig ().entryPoint
115- ).getUserOpHash (packedUserOperation);
116-
117- address actualSigner = ECDSA.recover (
118- userOperationHash.toEthSignedMessageHash (),
119- packedUserOperation.signature
120- );
85+ bytes memory functionData = abi.encodeWithSelector (ERC20Mock .mint.selector , address (minimalAccount), AMOUNT);
86+
87+ bytes memory executeCallData =
88+ abi.encodeWithSelector (MinimalAccount.execute.selector , dest, value, functionData);
89+
90+ (PackedUserOperation memory packedUserOperation ,) =
91+ sendPackedUserOp.generateSignedUserOperation (executeCallData, helperConfig.getConfig ());
92+ bytes32 userOperationHash = IEntryPoint (helperConfig.getConfig ().entryPoint).getUserOpHash (packedUserOperation);
93+
94+ address actualSigner = ECDSA.recover (userOperationHash.toEthSignedMessageHash (), packedUserOperation.signature);
12195
12296 assertEq (actualSigner, minimalAccount.owner ());
12397 }
0 commit comments