Skip to content
Lattice

AccountFactory6900

Git Source

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

NameTypeDescription
<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

NameTypeDescription
__blueprintFacetCut[]The facet cuts (Add) wiring a complete ERC-6900 account.
_accountInitaddressInitializer 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

NameTypeDescription
owneraddressThe initial signing owner of the account.
saltbytes32Caller-chosen salt; distinct salts yield distinct accounts for the same owner.

Returns

NameTypeDescription
accountaddressThe 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

NameTypeDescription
owneraddressThe prospective owner.
saltbytes32The prospective salt.

Returns

NameTypeDescription
accountaddressThe 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

NameTypeDescription
owneraddress
saltbytes32

Returns

NameTypeDescription
<none>bytes32

_predict

Standard CREATE2 address derivation for the ModularAccount6900 proxy.

function _predict(bytes32 s) private view returns (address);

Parameters

NameTypeDescription
sbytes32

Returns

NameTypeDescription
<none>address