lido
Installation
SKILL.md
Lido
Lido is the largest liquid staking protocol on Ethereum. Users deposit ETH and receive stETH, a rebasing token whose balance increases daily as staking rewards accrue. wstETH is the non-rebasing wrapper used in DeFi. The protocol manages a validator set, an oracle-reported share rate, and an on-chain withdrawal queue.
What You Probably Got Wrong
- stETH is a rebasing token — Your stETH balance changes every day when the oracle reports. If you store a balance in a variable and check it later, it will differ. This breaks naive accounting in smart contracts. Use wstETH or track shares, not balances.
- wstETH is NOT stETH — wstETH is a non-rebasing ERC-20 wrapper around stETH shares. 1 wstETH != 1 stETH. The exchange rate drifts upward over time as rewards accumulate. Always convert via
stETH.getPooledEthByShares()orwstETH.stEthPerToken(). - stETH/ETH is NOT 1:1 — There is a market rate on secondary markets (Curve, Uniswap) that can deviate from the protocol's internal rate, especially during high withdrawal demand or market stress. The 2022 depeg hit ~0.93.
- stETH transfers lose 1-2 wei — Due to shares-to-balance rounding, transferring your full
balanceOfmay leave 1-2 wei behind. The recipient may receive 1 wei less thanamount. This is by design, not a bug. Never assert exact equality on stETH transfers. - Withdrawals are NOT instant — The withdrawal queue processes requests in order. Finalization depends on validator exits and oracle reports. Typical wait: 1-5 days, but can be longer during high demand. You must request, wait for finalization, then claim in a separate tx.
- Shares are the canonical unit — stETH balances are derived from shares.
balanceOf(account) = shares[account] * totalPooledEther / totalShares. All internal accounting uses shares. When integrating, think in shares. submit()requires the referral address parameter — The staking function issubmit(address _referral)payable, not just a payable fallback. Passaddress(0)if you have no referral.