ERC4337 Validation is a Solidity library that can be installed in different ways. Below, you will find instructions for using it together with Foundry.
To use this library, simply import the Simulator
and set it up as follows:
If the userOp breaks any of the rules, the function will revert with a message indicating which rule was broken.
Note that the entryPointAddress
needs to be the address of the EntryPointSimulations
contract if you are using v0.7 of ERC-4337. For an example see the Simulator test, the Simulator test v0.6 and the relevant test bases.