-
Notifications
You must be signed in to change notification settings - Fork 1
BiconomyMetaFactory
Inherits: Stakeable
Manages the creation of Modular Smart Accounts compliant with ERC-7579 and ERC-4337 using a factory pattern.
Utilizes the Stakeable
for staking requirements. This contract serves as a 'Meta' factory to generate new Nexus instances using specific chosen and approved factories.
Can whitelist factories, deploy accounts with chosen factory and required data for that factory. The factories could possibly enshrine specific modules to avoid arbitrary execution and prevent griefing.
Stores the factory addresses that are whitelisted.
mapping(address => bool) public factoryWhitelist;
Constructor to set the owner of the contract.
constructor(address owner_) Stakeable(owner_);
Parameters
Name | Type | Description |
---|---|---|
owner_ |
address |
The address of the owner. |
Adds an address to the factory whitelist.
function addFactoryToWhitelist(address factory) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
factory |
address |
The address to be whitelisted. |
Removes an address from the factory whitelist.
function removeFactoryFromWhitelist(address factory) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
factory |
address |
The address to be removed from the whitelist. |
Deploys a new Nexus with a specific factory and initialization data.
Uses factory.call(factoryData) to post the encoded data for the method to be called on the Factory. These factories could enshrine specific modules to avoid arbitrary execution and prevent griefing. Another benefit of this pattern is that the factory can be upgraded without changing this contract.
function deployWithFactory(address factory, bytes calldata factoryData) external payable returns (address payable createdAccount);
Parameters
Name | Type | Description |
---|---|---|
factory |
address |
The address of the factory to be used for deployment. |
factoryData |
bytes |
The encoded data for the method to be called on the Factory. |
Returns
Name | Type | Description |
---|---|---|
createdAccount |
address payable |
The address of the newly created Nexus account. |
Important
Ensure the factory address is whitelisted before attempting deployment. Unauthorized factories can lead to security vulnerabilities.
Checks if an address is whitelisted.
function isFactoryWhitelisted(address factory) public view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
factory |
address |
The address to check. |
Returns
Name | Type | Description |
---|---|---|
<none> |
bool |
True if the factory is whitelisted, false otherwise. |
Error thrown when the factory is not whitelisted.
error FactoryNotWhitelisted();
Error thrown when the factory address is zero.
error InvalidFactoryAddress();
Error thrown when the owner address is zero.
error ZeroAddressNotAllowed();
Error thrown when the call to deploy with factory failed.
error CallToDeployWithFactoryFailed();
- 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