
Safe7579 Adapter
As ERC-7579 is a superset of ERC-4337, the Safe7579 Adapter ensures full compliance with ERC-4337. The Safe7579 Adapter is both a Safe Module and a Fallback Handler.- Safe Module: It extends the functionality of a Safe account, allowing it to utilize ERC-7579 modules.
- Fallback Handler: It is a fallback handler because certain functions, such as validateUserOp in ERC-7579, are not natively supported by Safe.
Creation of new Safes compatible with ERC-7579
The launchpad contract works around the 4337 limitations, which allows the deployment of exactly one contract whose address matches the sender of the user operation. The creation of new Safes occurs in the following three high-level steps.Creation by Factory
- Bundler informs
EntrypointtohandleUserOps. - Entrypoint calls
SenderCreatorto callSafeProxyFactory. SenderCreatorrequestssafeProxycreation fromSafeProxyFactoryusingcreateProxyWithNonce.SafeProxyFactorycreates a newSafeProxyusingcreate2.SafeProxyis created with a singleton address set toLaunchpad.initHashis stored in theSafeProxystorage.
Validation Phase
Entrypointvalidates user operations inSafeProxyviavalidateUserOp.SafeProxydelegates validation toLaunchpad.Launchpadensures the presence ofinitHashfrom phase one and callsSafe7579.launchpadValidators.ValidatorModulegets installed byLaunchpad.ValidatorModulevalidates user operations and returnspackedValidationData.Launchpadreturns packedValidationData toSafeProxy,SafeProxyreturns toEntrypoint.
Execution Phase
Entrypointtriggerslaunchpad.setupSafe()inSafeProxy.SafeProxydelegates the setup toLaunchpad.LaunchPadupgradesSafeStorage.singletontoSafeSingleton.LaunchPadcallsSafeProxy.setup()to initializeSafeSingleton.- Setup function in
SafeProxy.setup()delegatecalls tolauchpad.initSafe7579. initSafe7579()initializesSafe7579with executors, fallbacks, hooks,IERC7484registry.