From b749bcb87f489d98035b65950a3c790caf621bab Mon Sep 17 00:00:00 2001 From: livingrockrises <90545960+livingrockrises@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:45:49 +0400 Subject: [PATCH 1/2] feaT:update token paymaster postop --- contracts/samples/TokenPaymaster.sol | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/contracts/samples/TokenPaymaster.sol b/contracts/samples/TokenPaymaster.sol index 632f1e37..e8b37eb8 100644 --- a/contracts/samples/TokenPaymaster.sol +++ b/contracts/samples/TokenPaymaster.sol @@ -42,8 +42,6 @@ contract TokenPaymaster is BasePaymaster, UniswapHelper, OracleHelper { event UserOperationSponsored(address indexed user, uint256 actualTokenCharge, uint256 actualGasCost, uint256 actualTokenPrice); - event PostOpReverted(address indexed user, uint256 preCharge); - event Received(address indexed sender, uint256 value); /// @notice All 'price' variables are multiplied by this value to avoid rounding up @@ -151,7 +149,12 @@ contract TokenPaymaster is BasePaymaster, UniswapHelper, OracleHelper { /// @dev This function is called after a user operation has been executed or reverted. /// @param context The context containing the token amount and user sender address. /// @param actualGasCost The actual gas cost of the transaction. - function _postOp(PostOpMode, bytes calldata context, uint256 actualGasCost) internal override { + function _postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) internal override { + // Marked for removal when using with next EP version + if (mode == PostOpMode.postOpReverted) { + return; // Do nothing here to not revert the whole bundle and harm reputation + } + unchecked { uint256 priceMarkup = tokenPaymasterConfig.priceMarkup; ( From 88a78581ce2c5ecf26433ea41efab3f128fe6939 Mon Sep 17 00:00:00 2001 From: livingrockrises <90545960+livingrockrises@users.noreply.github.com> Date: Tue, 12 Dec 2023 18:38:36 +0400 Subject: [PATCH 2/2] update as per PR discussion --- contracts/samples/TokenPaymaster.sol | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/contracts/samples/TokenPaymaster.sol b/contracts/samples/TokenPaymaster.sol index e8b37eb8..48c08559 100644 --- a/contracts/samples/TokenPaymaster.sol +++ b/contracts/samples/TokenPaymaster.sol @@ -149,12 +149,7 @@ contract TokenPaymaster is BasePaymaster, UniswapHelper, OracleHelper { /// @dev This function is called after a user operation has been executed or reverted. /// @param context The context containing the token amount and user sender address. /// @param actualGasCost The actual gas cost of the transaction. - function _postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) internal override { - // Marked for removal when using with next EP version - if (mode == PostOpMode.postOpReverted) { - return; // Do nothing here to not revert the whole bundle and harm reputation - } - + function _postOp(PostOpMode, bytes calldata context, uint256 actualGasCost) internal override { unchecked { uint256 priceMarkup = tokenPaymasterConfig.priceMarkup; (