IAccountFactory
Title: IAccountFactory
Author: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80)
Deterministic factory for EIP-2535 Diamond smart accounts. Each account address is a pure
function of (factory, owner, salt) and the fixed proxy initcode, so it can be computed
off-chain before deployment — enabling counterfactual ERC-4337 initCode onboarding.
The owner is folded into the CREATE2 salt, so a given counterfactual address can only ever be
realized with the owner it was derived from (no third party can pre-deploy your address under a
different owner). Deployment is idempotent: re-running createAccount for an already-deployed
(owner, salt) returns the existing account instead of reverting.
Functions
createAccount
Deploys (or returns the existing) Diamond account for (owner, salt) and initializes it
with the factory's fixed facet blueprint and the owner.
function createAccount(address owner, bytes32 salt) external returns (address account);Parameters
| Name | Type | Description |
|---|---|---|
| owner | address | The initial signing owner of the account. |
| salt | bytes32 | Caller-chosen salt; distinct salts yield distinct accounts for the same owner. |
Returns
| Name | Type | Description |
|---|---|---|
| account | address | The deterministic account address (equals getAddress). |
getAddress
The counterfactual address createAccount(owner, salt) will deploy to.
function getAddress(address owner, bytes32 salt) external view returns (address account);Parameters
| Name | Type | Description |
|---|---|---|
| owner | address | The prospective owner. |
| salt | bytes32 | The prospective salt. |
Returns
| Name | Type | Description |
|---|---|---|
| account | address | The deterministic CREATE2 address. |
accountInit
The initializer contract delegatecalled during each account's diamondCut initialization.
function accountInit() external view returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
Events
AccountCreated
Emitted once when an account is deployed (not re-emitted on idempotent re-calls).
event AccountCreated(address indexed account, address indexed owner, bytes32 salt);Parameters
| Name | Type | Description |
|---|---|---|
| account | address | The deployed Diamond account. |
| owner | address | The account's initial signing owner. |
| salt | bytes32 | The caller-chosen salt distinguishing accounts for the same owner. |
Errors
EmptyBlueprint
Thrown when constructing a factory with an empty facet blueprint (would yield accounts with no callable functions — a permanent, silent misconfiguration since the factory is immutable).
error EmptyBlueprint();