Skip to content

Commit

Permalink
event to emit userOpHash
Browse files Browse the repository at this point in the history
  • Loading branch information
livingrockrises committed Nov 9, 2023
1 parent 827877c commit b55d847
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ interface IVerifyingSingletonPaymaster {
);
event GasBalanceDeducted(
address indexed _paymasterId,
uint256 indexed _charge
uint256 indexed _charge,
bytes32 indexed userOpHash
);
event PremiumCollected(
address indexed _paymasterId,
Expand Down
12 changes: 7 additions & 5 deletions contracts/verifying/VerifyingSingletonPaymasterV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ contract VerifyingSingletonPaymasterV2 is
*/
function _validatePaymasterUserOp(
UserOperation calldata userOp,
bytes32 /*userOpHash*/,
bytes32 userOpHash,
uint256 requiredPreFund
) internal override returns (bytes memory context, uint256 validationData) {
(
Expand Down Expand Up @@ -281,7 +281,8 @@ contract VerifyingSingletonPaymasterV2 is
paymasterId,
dynamicMarkup,
userOp.maxFeePerGas,
userOp.maxPriorityFeePerGas
userOp.maxPriorityFeePerGas,
userOpHash
);

return (context, _packValidationData(false, validUntil, validAfter));
Expand Down Expand Up @@ -323,8 +324,9 @@ contract VerifyingSingletonPaymasterV2 is
address paymasterId,
uint32 dynamicMarkup,
uint256 maxFeePerGas,
uint256 maxPriorityFeePerGas
) = abi.decode(context, (address, uint32, uint256, uint256));
uint256 maxPriorityFeePerGas,
bytes32 userOpHash
) = abi.decode(context, (address, uint32, uint256, uint256, bytes32));

uint256 effectiveGasPrice = getGasPrice(
maxFeePerGas,
Expand All @@ -345,7 +347,7 @@ contract VerifyingSingletonPaymasterV2 is
// "collect" premium
paymasterIdBalances[feeCollector] += actualPremium;

emit GasBalanceDeducted(paymasterId, costIncludingPremium);
emit GasBalanceDeducted(paymasterId, costIncludingPremium, userOpHash);
emit PremiumCollected(paymasterId, actualPremium);
}
}
Loading

0 comments on commit b55d847

Please sign in to comment.