How hooks are called
- Every hook implements
IHook.callHook(address asset, uint256 assets). - Queues trigger hooks through
ShareModule.callHook(assets). The vault resolves the hook for the calling queue and runs it withdelegatecall, so the hook code executes in the vault’s context. - Each queue uses its custom hook if one is set with
setCustomHook(queue, hook). Otherwise it falls back todefaultDepositHookordefaultRedeemHook. Changing hooks requiresSET_HOOK_ROLE. - For redeem queues, the vault transfers
assetsto the queue after the hook returns, or straight away if the queue has no hook.
Redeem hooks
Redeem hooks also implementIRedeemHook.getLiquidAssets(address asset). Redeem queues call ShareModule.getLiquidAssets() to find out how much they can pay out, and the vault answers with the hook’s getLiquidAssets. Without a redeem hook, only the vault’s own balance counts as liquid.