Skip to content

Commit 96e6657

Browse files
luiz-lvjAmxx
authored andcommitted
Document postOp cost estimate tuning in PaymasterERC20 NatSpec (#6623)
1 parent be4d122 commit 96e6657

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

‎contracts/account/paymaster/extensions/PaymasterERC20.sol‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,13 @@ abstract contract PaymasterERC20 is Paymaster {
244244
bytes32 userOpHash
245245
) internal view virtual returns (uint256 validationData, IERC20 token, uint256 tokenPerNative);
246246

247-
/// @dev Over-estimates the cost of the post-operation logic.
247+
/**
248+
* @dev Over-estimates the cost of the post-operation logic, which the EntryPoint charges to the paymaster but
249+
* excludes from the `actualGasCost` reported to {_postOp}.
250+
*
251+
* NOTE: The default assumes a standard ERC-20. Override with a higher value for gas-heavier tokens; a persistent
252+
* underestimate drains the paymaster's deposit.
253+
*/
248254
function _postOpCost() internal view virtual returns (uint256) {
249255
return 30_000;
250256
}

‎contracts/account/paymaster/extensions/PaymasterERC20Guarantor.sol‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,12 @@ abstract contract PaymasterERC20Guarantor is PaymasterERC20 {
148148
*/
149149
function _fetchGuarantor(PackedUserOperation calldata userOp) internal view virtual returns (address guarantor);
150150

151-
/// @dev Over-estimates the cost of the post-operation logic. Added on top of {PaymasterERC20-_postOpCost} for guaranteed userOps.
151+
/**
152+
* @dev Over-estimates the cost of the post-operation logic. Added on top of {PaymasterERC20-_postOpCost} for
153+
* guaranteed userOps.
154+
*
155+
* NOTE: Like {PaymasterERC20-_postOpCost}, override with a higher value for gas-heavier tokens.
156+
*/
152157
function _guaranteedPostOpCost() internal view virtual returns (uint256) {
153158
return 15_000;
154159
}

0 commit comments

Comments
 (0)