LidoDepositHook
Overview
LidoDepositHook is an implementation of the IHook interface that acts as a conversion adapter for incoming deposits. It standardizes various ETH-like assets into wstETH for use in downstream vault logic. The hook supports ETH, WETH, and stETH as input formats and ensures conversion to wstETH before optionally forwarding execution to a downstream nextHook.
Primary Purpose
Converts ETH, WETH, or stETH into
wstETHon deposit.Ensures compatibility with protocols that expect
wstETH.Provides composable hooks by chaining into a downstream
IHook(nextHook).
Constructor Parameters
wsteth_
address
Address of the wstETH token contract
weth_
address
Address of the WETH token contract
nextHook_
address
Address of the optional downstream hook to forward to after wrapping
Key Function
callHook(address asset, uint256 assets)
callHook(address asset, uint256 assets)Handles conversion of an input asset into wstETH and optionally delegates the call to a downstream hook.
Supported Input Types:
wstETH— forwarded directlystETH— wrapped intowstETHviaIWSTETH(wsteth).wrap()WETH— unwrapped into ETH viaIWETH(weth).withdraw(), then deposited intowstETHETH(i.e.address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)) — directly deposited intowstETH
Execution Steps:
If
asset == wstETH: do nothingIf
asset == stETH:Approves
wstETHto pullstETHCalls
wrap()onwstETHto convert towstETH
If
asset == WETH:Unwraps to ETH using
withdraw()Sends ETH to
wstETHcontract to mintwstETH
If
asset == ETH:Sends ETH directly to
wstETH
After conversion:
Calculates how much new
wstETHwas receivedIf
nextHookis configured, delegatescallHook(wstETH, amount)to it
Errors
UnsupportedAsset(address asset)— Thrown if the provided asset is neitherwstETH,stETH,WETH, norETH
Assumptions:
It is assumed this hook will not trigger STAKE_LIMIT or other limit-related errors in the Lido contracts. If such errors do occur, the vault admin can reconfigure the system to bypass the automated staking hook. In this case, RedirectingDepositHook can be assigned to the relevant queues, delegating staking responsibilities to the vault curator via manual liquidity management.