@@ -198,26 +198,20 @@ contract ERC20Paymaster is BasePaymaster {
198198 validationResult = 0 ;
199199 } else if (mode == uint8 (2 )) {
200200 address guarantor = address (bytes20 (paymasterConfig[0 :20 ]));
201- uint48 validUntil = uint48 (bytes6 (paymasterConfig[20 :26 ]));
202- uint48 validAfter = uint48 (bytes6 (paymasterConfig[26 :32 ]));
203-
204- if (
205- ! SignatureChecker.isValidSignatureNow (
206- guarantor, getHash (userOp, validUntil, validAfter, 0 ), paymasterConfig[32 :]
207- )
208- ) {
209- // do not revert on signature failure
210- validationResult = _packValidationData (true , validUntil, validAfter);
211- return ("" , validationResult);
212- }
201+
202+ bool signatureValid = SignatureChecker.isValidSignatureNow (
203+ guarantor,
204+ getHash (userOp, uint48 (bytes6 (paymasterConfig[20 :26 ])), uint48 (bytes6 (paymasterConfig[26 :32 ])), 0 ),
205+ paymasterConfig[32 :]
206+ );
213207
214208 SafeTransferLib.safeTransferFrom (address (token), guarantor, address (this ), tokenAmount);
215209 context = abi.encodePacked (tokenAmount, tokenPrice, userOp.sender, userOpHash, guarantor);
216- validationResult = _packValidationData (false , validUntil, validAfter);
210+ validationResult = _packValidationData (
211+ ! signatureValid, uint48 (bytes6 (paymasterConfig[20 :26 ])), uint48 (bytes6 (paymasterConfig[26 :32 ]))
212+ );
217213 } else {
218214 address guarantor = address (bytes20 (paymasterConfig[32 :52 ]));
219- uint48 validUntil = uint48 (bytes6 (paymasterConfig[52 :58 ]));
220- uint48 validAfter = uint48 (bytes6 (paymasterConfig[58 :64 ]));
221215
222216 if (uint256 (bytes32 (paymasterConfig[0 :32 ])) == 0 ) {
223217 revert TokenLimitZero ();
@@ -226,21 +220,22 @@ contract ERC20Paymaster is BasePaymaster {
226220 revert TokenAmountTooHigh ();
227221 }
228222
229- if (
230- ! SignatureChecker.isValidSignatureNow (
231- guarantor,
232- getHash (userOp, validUntil, validAfter, uint256 (bytes32 (paymasterConfig[0 :32 ]))),
233- paymasterConfig[64 :]
234- )
235- ) {
236- // do not revert on signature failure
237- validationResult = _packValidationData (true , validUntil, validAfter);
238- return ("" , validationResult);
239- }
223+ bool signatureValid = SignatureChecker.isValidSignatureNow (
224+ guarantor,
225+ getHash (
226+ userOp,
227+ uint48 (bytes6 (paymasterConfig[52 :58 ])),
228+ uint48 (bytes6 (paymasterConfig[58 :64 ])),
229+ uint256 (bytes32 (paymasterConfig[0 :32 ]))
230+ ),
231+ paymasterConfig[64 :]
232+ );
240233
241234 SafeTransferLib.safeTransferFrom (address (token), guarantor, address (this ), tokenAmount);
242235 context = abi.encodePacked (tokenAmount, tokenPrice, userOp.sender, userOpHash, guarantor);
243- validationResult = _packValidationData (false , validUntil, validAfter);
236+ validationResult = _packValidationData (
237+ ! signatureValid, uint48 (bytes6 (paymasterConfig[52 :58 ])), uint48 (bytes6 (paymasterConfig[58 :64 ]))
238+ );
244239 }
245240 }
246241
0 commit comments