The Subvault contract represents a modular, permissioned vault component designed to manage delegated asset strategies within a parent Vault. It enables curated logic for permissioned calls and asset management without exposing external deposit or redemption interfaces.
This contract combines callable and verifiable logic to serve as a secure, controlled execution unit within a system.
This indicates that both modules rely on deterministic storage and versioned deployment identifiers via SlotLibrary.
Constructor
constructor(stringmemoryname_,uint256version_)
Parameters:
name_: A unique string identifier for the deployment (e.g., “Mellow”).
version_: A version number used to derive storage slots and allow upgradeable logic.
Behavior:
Passes the name_ and version_ arguments into the constructors of VerifierModule and SubvaultModule.
External Functions
initialize
Initializes the subvault contract. This function can only be called once due to the initializer modifier.
Parameters:
initParams: ABI-encoded as (address verifier_, address vault_)
Initialization Steps:
Decodes verifier_ and vault_ from the calldata.
Calls __VerifierModule_init(verifier_) to link the external verifier (used for strategy proof or access control).
Calls __SubvaultModule_init(vault_) to register this subvault with the parent vault.
Emits the Initialized(initParams) event for transparency.
Design Notes
Modular Strategy Execution: The CallModule enables arbitrary external calls, useful for delegating assets into other protocols or yield strategies.
Trust-Minimized Calls: External strategy actions are gated via a VerifierModule, which can enforce logic like off-chain signatures or time-based constraints.
Parent Vault Registration: Initialization ensures the vault address is securely set once and governs access and lifecycle.
Upgradeable Architecture: Follows the shared pattern of using deterministic storage slots (via SlotLibrary) to remain safely upgradeable and composable.
Events
Initialized(bytes data)
Emitted once after a successful initialize call. Contains the raw ABI-encoded input for auditing or debugging.