Purpose
TheSubvaultModule represents an isolated child vault within a modular vault system. It is tightly controlled by its parent vault (typically a VaultModule) and is responsible for securely holding and releasing assets upon authenticated requests.
Responsibilities
- Store and isolate a portion of vault assets
- Allow trusted actor (curator) to delegate liquidity from the Subvault to external protocol based on the
Verifiersetup for this specific subvault - Respond to
pullAssetscalls from the parent vault only
Storage Layout (SubvaultModuleStorage)
vault: Address of the root vault that controls this subvault. Only this address can request asset withdrawals.
View Functions
vault() → address
Returns the address of the parent vault that instantiated this subvault.
Mutable Functions
pullAssets(asset: address, value: uint256)
Allows the parent vault to withdraw a specified amount of an asset.
- Access Control: Can only be called by the
vault()address - Reverts: With
NotVault()if the caller is not the vault - Transfer Behavior: Uses
TransferLibrary.sendAssets()to forward tokens or native ETH to theVault.soladdress - Emits:
AssetsPulled(asset, vault, value)
Internal Initialization
__SubvaultModule_init(address vault_)
Internal setup method to be called during construction or proxy initialization.
Events
event AssetsPulled(address indexed asset, address indexed to, uint256 value)
Triggered when assets are withdrawn by the parent vault.
asset: Address of the ERC20 token or native ETHto: Always equals thevault()addressvalue: Amount of the asset transferred
Error Handling
NotVault(): Raised when a non-vault caller attempts to callpullAssets()