RedirectingDepositHook
Overview​
RedirectingDepositHook is a deposit time liquidity allocation hook implementing the IHook interface. It is designed to redirect newly deposited assets from a vault into its underlying subvaults, based on per-subvault risk and capacity constraints defined by a RiskManager.
This hook helps distribute liquidity optimally during deposit flows.
Purpose​
- Automatically forwards newly deposited assets from the main vault into eligible subvaults.
- Delegates decision-making to the vault's configured
RiskManager, which determines per-subvault deposit limits. - Ensures that subvaults do not exceed their capacity constraints.
Key Function​
callHook(address asset, uint256 assets)​
Distributes a given amount of asset across available subvaults based on their individual deposit capacity.
Execution Logic:
- Retrieves active
vaultcontext viaIVaultModule(address(this)), configuredRiskManagerviavault.riskManager(), and the number of subvaults viavault.subvaults(). - Iterates over each subvault and fetches max allowed deposit via
riskManager.maxDeposit(subvault, asset). If allowed amount is zero, skip. Otherwise, pushesmin(assets, allowed)viavault.hookPushAssets(), decrementsassetsaccordingly, and stops early if the full amount has been distributed.
Components and Assumptions​
- Vault must implement
IVaultModuleand supportsubvaults(),subvaultAt(index),hookPushAssets(subvault, asset, amount), andriskManager(). - Risk Manager must implement
maxDeposit(subvault, asset)to return max allowed deposit into that subvault.