IDataValidator

Git Source

Author: Flydexo - @Flydex0

This can be used for example to track the amount of granted ERC20 spent / swapped, etc...

The DataValidator contract must respect ERC-4337 storage rules. That means the only storage accessible must have the userOp.sender as key.

see https://eips.ethereum.org/EIPS/eip-4337#simulation

Functions

isValidData

isValidData is called in the validateUserOp function of the PermissionVerifier contract

userOp is formatted as integration agnostic, that means that if the SA (eg. Zerodev) requires a special field in the signature to determine which plugin to use, it is removed. Then the PermissionVerifier is called.

function isValidData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)
    external
    returns (bool success);

Parameters

NameTypeDescription
userOpUserOperationThe userOp
userOpHashbytes32The userOp hash
missingAccountFundsuint256The funds the sender needs to pay to the EntryPoint

Returns

NameTypeDescription
successboolCan revert to add additional logs and returns true if the userOp is considered valid