-
Notifications
You must be signed in to change notification settings - Fork 1
ModuleWhitelistFactory
Inherits: AbstractNexusFactory
Factory for creating Nexus accounts with whitelisted modules. Ensures compliance with ERC-7579 and ERC-4337 standards.
Mapping to store the addresses of whitelisted modules.
mapping(address => bool) public moduleWhitelist;
Constructor to set the smart account implementation address and owner.
constructor(address implementation_, address owner_) AbstractNexusFactory(implementation_, owner_);
Parameters
Name | Type | Description |
---|---|---|
implementation_ |
address |
The address of the Nexus implementation to be used for all deployments. |
owner_ |
address |
The address of the owner of the factory. |
Important
constructor: The constructor sets critical state variables that define the behavior and ownership of the factory. Ensure that the addresses provided are accurate.
Adds an address to the module whitelist.
function addModuleToWhitelist(address module) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
module |
address |
The address to be whitelisted. |
Removes an address from the module whitelist.
function removeModuleFromWhitelist(address module) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
module |
address |
The address to be removed from the whitelist. |
Creates a new Nexus account with the provided initialization data.
function createAccount(bytes calldata initData, bytes32 salt) external payable override returns (address payable);
Parameters
Name | Type | Description |
---|---|---|
initData |
bytes |
Initialization data to be called on the new Smart Account. |
salt |
bytes32 |
Unique salt for the Smart Account creation. |
Returns
Name | Type | Description |
---|---|---|
<none> |
address payable |
The address of the newly created Nexus. |
Caution
createAccount: Ensure that the initData and salt are correctly specified to avoid deploying multiple accounts at the same address or creating unintended behavior.
Computes the expected address of a Nexus contract using the factory's deterministic deployment algorithm.
function computeAccountAddress(bytes calldata, bytes32) external view override returns (address payable expectedAddress);
Parameters
Name | Type | Description |
---|---|---|
<none> |
bytes |
N/A (read from the calldata directly from the assembly code). |
<none> |
bytes32 |
N/A (read from the calldata directly from the assembly code). |
Returns
Name | Type | Description |
---|---|---|
expectedAddress |
address payable |
The expected address at which the Nexus contract will be deployed if the provided parameters are used. |
Note
computeAccountAddress: The function reads from the calldata directly using assembly code, ensuring deterministic address computation.
Checks if a module is whitelisted.
function isModuleWhitelisted(address module) public view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
module |
address |
The address of the module to check. |
Returns
Name | Type | Description |
---|---|---|
<none> |
bool |
True if the module is whitelisted, false otherwise. |
Error thrown when a non-whitelisted module is used.
error ModuleNotWhitelisted(address module);
Parameters
Name | Type | Description |
---|---|---|
module |
address |
The module address that is not whitelisted. |
Error thrown when a zero address is provided.
error ZeroAddressNotAllowed();
- Home
- Nexus Architecture
- Access Control
- Execution Framework
- Modules
- Factories
- Migration Guide
- Testing Documentation
- Configuration and Security
- Libraries
- FAQ
- Biconomy Solidity Style Guide
- Security Considerations
- Team
-
Contracts
- Nexus
- Base
- Common
- Factory
- AbstractNexusFactory
- BiconomyMetaFactory
- K1ValidatorFactory
- ModuleWhitelistFactory
- NexusAccountFactory
- Modules
- Utils