Vault
Overview
The Vault
contract is the central entry point in the Flexible Vault system. It composes three foundational modules:
ACLModule
: Role-based access control.ShareModule
: Management of user-facing shares, including deposit and redemption processes.VaultModule
: Subvault management.
This contract allows secure, extensible, and upgradeable vault implementations by coordinating all external and internal interactions within the system. It is typically instantiated through Factory
or VaultConfigurator
and initialized with all the required components and role assignments in a single atomic transaction.
Inheritance Structure
contract Vault is IFactoryEntity, VaultModule, ShareModule, ACLModule
The contract inherits three modules:
ACLModule
: Admin and permission managementShareModule
: Deposits, redemptions, share managementVaultModule
: Subvault delegation control
It also implements the IFactoryEntity
interface for standard factory-based deployment patterns.
Constructor
constructor(
string memory name_,
uint256 version_,
address depositQueueFactory_,
address redeemQueueFactory_,
address subvaultFactory_,
address verifierFactory_
)
Parameters:
name_
: Unique name identifier for the vault instanceversion_
: Configuration version of the vaultdepositQueueFactory_
: Address of the factory used to deploy deposit queuesredeemQueueFactory_
: Address of the factory used to deploy redemption queuessubvaultFactory_
: Address of the factory used to deploy subvaultsverifierFactory_
: Address of the factory for deploying verifier contracts
Behavior:
Passes these arguments to the parent module constructors:
ACLModule(name_, version_)
ShareModule(name_, version_, depositQueueFactory_, redeemQueueFactory_)
VaultModule(name_, version_, subvaultFactory_, verifierFactory_)
Structs
RoleHolder
RoleHolder
struct RoleHolder {
bytes32 role;
address holder;
}
Used to batch-assign multiple roles during initialization. Each entry maps a role identifier to a designated address.
External Functions
initialize
initialize
function initialize(bytes calldata initParams) external initializer
Initializes the vault instance. Can only be called once due to the initializer
modifier.
initParams
structure (ABI-encoded):
initParams
structure (ABI-encoded):(
address admin_,
address shareManager_,
address feeManager_,
address riskManager_,
address oracle_,
address defaultDepositHook_,
address defaultRedeemHook_,
uint256 queueLimit_,
RoleHolder[] roleHolders
)
Initialization Logic:
Calls
__ACLModule_init(admin_)
to configure the default admin.Calls
__ShareModule_init(...)
to link share management and hook modules.Calls
__VaultModule_init(riskManager_)
to initialize risk management.Iterates over
roleHolders
and grants each role using_grantRole(...)
.Emits
Initialized(initParams)
.
Design Notes
Modular Composition: The vault is composed by inheriting three upgradeable modules, enabling reuse and flexible configuration.
Factory-Compatible: The contract is factory-deployable and supports atomic configuration during creation.
Centralized Control Layer: Acts as a trusted coordinator for hooks, queues, shares, and strategy logic.
Role Assignment: Enables full delegation of operational control via batched
RoleHolder
entries.Upgradeable and Isolated: Each module manages its own storage via deterministic slots (
SlotLibrary
) to support safe upgrades.
Events
Initialized(bytes data)
Initialized(bytes data)
Emitted after successful initialization. Includes all parameters passed for transparency.