IWstETH
Inherits: IERC20
Title: IWstETH
Author: Vendored minimal subset of Lido wstETH (https://github.com/lidofinance/lido-dao/blob/master/contracts/0.6.12/WstETH.sol).
Upstream license: GPL-3.0.
Minimal vendored subset of Lido wrapped stETH (wstETH), a non-rebasing wrapper around the
rebasing stETH. The Lido adapter holds its staked position as wstETH so its share balance
is constant and yield accrues through the rising getStETHByWstETH exchange rate.
Extends IERC20 for balanceOf/approve/transfer. wrap/unwrap move between stETH and
wstETH (the adapter approves stETH to the wstETH contract before wrap). The two get*
views are the exchange-rate readers used to value the position in ETH/WETH units.
Functions
wrap
Wraps stETHAmount of stETH (pulled from the caller) into wstETH minted to the caller.
function wrap(uint256 stETHAmount) external returns (uint256 wstETHAmount);Parameters
| Name | Type | Description |
|---|---|---|
| stETHAmount | uint256 | The amount of stETH to wrap. |
Returns
| Name | Type | Description |
|---|---|---|
| wstETHAmount | uint256 | The amount of wstETH minted to the caller. |
unwrap
Unwraps wstETHAmount of wstETH (burned from the caller) into stETH sent to the caller.
function unwrap(uint256 wstETHAmount) external returns (uint256 stETHAmount);Parameters
| Name | Type | Description |
|---|---|---|
| wstETHAmount | uint256 | The amount of wstETH to unwrap. |
Returns
| Name | Type | Description |
|---|---|---|
| stETHAmount | uint256 | The amount of stETH returned to the caller. |
getStETHByWstETH
Returns the amount of stETH wstETHAmount of wstETH is currently worth (WAD-rate).
Monotonically non-decreasing as Lido accrues staking rewards, so the adapter values its wstETH balance in stETH (== ETH ~1:1) units via this reader.
function getStETHByWstETH(uint256 wstETHAmount) external view returns (uint256 stETHAmount);Parameters
| Name | Type | Description |
|---|---|---|
| wstETHAmount | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| stETHAmount | uint256 |
getWstETHByStETH
Returns the amount of wstETH stETHAmount of stETH is currently worth.
function getWstETHByStETH(uint256 stETHAmount) external view returns (uint256 wstETHAmount);Parameters
| Name | Type | Description |
|---|---|---|
| stETHAmount | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| wstETHAmount | uint256 |