AccountFactory6900
Inherits: IAccountFactory
Title: AccountFactory6900
Author: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80)
Deterministic factory for ERC-6900 modular Diamond smart accounts, suitable for ERC-4337
counterfactual initCode onboarding. Mirrors AccountFactory but CREATE2-deploys a
ModularAccount6900 proxy (the 6900 fallback that dispatches installed execution modules) instead of
the ERC-7579 AccountDiamond, and wires it with the 6900 facet blueprint + AccountInit6900.
The proxy has no constructor args, so its initcode hash is constant and the CREATE2 address depends only
on (factory, keccak256(owner, salt)). A different blueprint ⇒ a different factory ⇒ a different address
set. Not a Diamond facet — a standalone singleton with its own storage.
Constants
accountInit
The initializer contract delegatecalled during each account's diamondCut initialization.
address public immutable accountInit;Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
_proxyInitCodeHash
keccak256(type(ModularAccount6900).creationCode) — the CREATE2 initcode hash, fixed at construction.
bytes32 private immutable _proxyInitCodeHash;State Variables
_blueprint
The facet cuts applied to every account. Fixed at construction.
FacetCut[] private _blueprint;Functions
constructor
constructor(FacetCut[] memory __blueprint, address _accountInit);Parameters
| Name | Type | Description |
|---|---|---|
| __blueprint | FacetCut[] | The facet cuts (Add) wiring a complete ERC-6900 account. |
| _accountInit | address | Initializer delegatecalled during diamondCut; MUST expose init(address owner). |
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. |
_saltFor
Binds the account address to its owner: keccak256(owner, salt).
function _saltFor(address owner, bytes32 salt) private pure returns (bytes32);Parameters
| Name | Type | Description |
|---|---|---|
| owner | address | |
| salt | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes32 |
_predict
Standard CREATE2 address derivation for the ModularAccount6900 proxy.
function _predict(bytes32 s) private view returns (address);Parameters
| Name | Type | Description |
|---|---|---|
| s | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |