Fee Subsidies
Objective
Solution
contract MyPaymaster is IPaymaster {
function validatePaymasterUserOp(
PackedUserOperation calldata userOp,
bytes32 userOpHash,
uint256 maxCost
) external view override returns (bytes memory context, uint256 validationData) {
if (msg.sender != address(entryPoint)) {
revert InvalidEntryPoint();
}
// check if the sender use a whitelisted account implementation
if (userOp.sender.codehash != keccak256(abi.encodePacked(bytes3(0xef0100), allowedSmartAccountImpl))) {
revert InvalidAccountCodeHash();
}
// check if userOp.callData targets the whitelisted contract
checkUserOpCallData(userOp.callData);
// check if userOp.gasFees are within limits
checkUserOpGasFees(userOp.gasFees);
return ("", _packValidationData(false, 0, 0)); // accept paying gas
}
}Last updated

