VaultFactory
Factory for deploying StakingVault + Dashboard pairs using a beacon proxy.
What is VaultFactory?​
VaultFactory creates new stVault instances:
- deploys a
PinnedBeaconProxypointing to the StakingVault beacon - deploys a
Dashboardto manage the vault - optionally connects the vault to
VaultHub
VaultHub enforces factory-based deployments upon connection by checking that the vault was created by the current factory or a previous factory in the chain.
Immutable variables​
| Variable | Description |
|---|---|
LIDO_LOCATOR | Address of the LidoLocator contract |
BEACON | Address of the StakingVault beacon contract |
DASHBOARD_IMPL | Address of the Dashboard implementation for cloning |
PREVIOUS_FACTORY | Address of the previous factory in the chain (or zero) |
Factory flows​
VaultFactory exposes two creation flows:
1. Create + connect via createVaultWithDashboard()​
- Requires
msg.value >= CONNECT_DEPOSIT(1 ETH) - Deploys StakingVault proxy and Dashboard clone
- Initializes vault with Dashboard as owner
- Initializes Dashboard with factory as temporary default admin
- Connects to VaultHub with the provided ETH
- Grants optional roles (only
_defaultAdminsub-roles) - Transfers
DEFAULT_ADMIN_ROLEto_defaultAdminand revokes from factory
2. Create without connecting via createVaultWithDashboardWithoutConnectingToVaultHub()​
- No ETH required
- Deploys StakingVault proxy and Dashboard clone
- Initializes vault with Dashboard as owner
- Initializes Dashboard with
_defaultAdminas default admin and factory as temporary NODE_OPERATOR_MANAGER - Grants optional roles (only
_nodeOperatorManagersub-roles) - Transfers
NODE_OPERATOR_MANAGER_ROLEto_nodeOperatorManagerand revokes from factory
Factory chaining​
The factory supports a PREVIOUS_FACTORY immutable reference for migration between factory versions:
- VaultHub accepts vaults deployed by the current factory or any previous factory in the chain
- When a new factory is deployed, it references the old factory via
PREVIOUS_FACTORY - Creates a linked list of valid factories for backwards compatibility
- Previously deployed vaults remain eligible for connection without redeployment
NewFactory.PREVIOUS_FACTORY → OldFactory.PREVIOUS_FACTORY → ... → address(0)
Connect deposit​
When using createVaultWithDashboard(), the caller must send at least CONNECT_DEPOSIT (1 ETH) with the transaction. This ETH is escrowed by VaultHub and returned when the vault disconnects.
Structs​
RoleAssignment​
Role assignment for Dashboard initialization (from Permissions):
struct RoleAssignment {
address account; // Account to grant role to
bytes32 role; // Role identifier
}
View methods​
deployedVaults(address _vault)​
function deployedVaults(address _vault) external view returns (bool)
Returns whether a vault was deployed by this factory or any previous factory in the chain. Recursively checks PREVIOUS_FACTORY if set.
Methods​
createVaultWithDashboard(...)​
function createVaultWithDashboard(
address _defaultAdmin,
address _nodeOperator,
address _nodeOperatorManager,
uint256 _nodeOperatorFeeBP,
uint256 _confirmExpiry,
Permissions.RoleAssignment[] calldata _roleAssignments
) external payable returns (IStakingVault vault, Dashboard dashboard)
Creates a vault + dashboard and connects to VaultHub.
Parameters:
_defaultAdmin: Address to receiveDEFAULT_ADMIN_ROLEon Dashboard_nodeOperator: Node operator address for the StakingVault_nodeOperatorManager: Address forNODE_OPERATOR_MANAGER_ROLEand fee recipient_nodeOperatorFeeBP: Node operator fee in basis points_confirmExpiry: Confirmation expiry time in seconds_roleAssignments: Optional roles to grant (only_defaultAdminsub-roles)
Requirements:
msg.value >= CONNECT_DEPOSIT
createVaultWithDashboardWithoutConnectingToVaultHub(...)​
function createVaultWithDashboardWithoutConnectingToVaultHub(
address _defaultAdmin,
address _nodeOperator,
address _nodeOperatorManager,
uint256 _nodeOperatorFeeBP,
uint256 _confirmExpiry,
Permissions.RoleAssignment[] calldata _roleAssignments
) external returns (IStakingVault vault, Dashboard dashboard)
Creates a vault + dashboard without connecting to VaultHub.
Parameters:
_defaultAdmin: Address to receiveDEFAULT_ADMIN_ROLEon Dashboard_nodeOperator: Node operator address for the StakingVault_nodeOperatorManager: Address to receiveNODE_OPERATOR_MANAGER_ROLEand fee recipient_nodeOperatorFeeBP: Node operator fee in basis points_confirmExpiry: Confirmation expiry time in seconds_roleAssignments: Optional roles to grant (only_nodeOperatorManagersub-roles)
Events​
event VaultCreated(address indexed vault);
event DashboardCreated(address indexed dashboard, address indexed vault, address indexed admin);