How to integrate the Registry into a smart account
Smart accounts can integrate the Module Registry natively in order to give their users security guarantees that they can only install attested modules. This guide is aimed at smart account builders and will show you how to integrate the Module Registry directly into your smart account.
Add the Module Registry to storage
In your smart account or in a separate contract that is inherited by the smart account, add the following code:
For the IERC7484
interface, see the Module Registry source code.
Add a setter for the Module Registry
Add a setter for the Module Registry so that the user can enable it:
Note that this setter should have access control, in this case using onlyEntryPointOrSelf
. Further, this setter will also store the users’ trusted attesters in the registry.
Add a modifier
Add a modifier to check if the module is attested:
Use the modifier
The modifier should be used in two different places: when installing a module and when executing a module: