wstETH
What is wrapped stETH (wstETH)?
It's an ERC-20 value-accruing token
wrapper for stETH
. Its balance does not change with each oracle report, but its
value in stETH
does. Internally, it represents the user's share of the total
supply of stETH
tokens.
Why use wstETH?
wstETH
is mainly used as a layer of compatibility to integrate stETH
into other
DeFi protocols, that do not support rebasable tokens, especially bridges to L2s and
other chains, as rebases don't work for bridged assets by default.
How to use wstETH?
The contract can be used as a trustless wrapper that accepts stETH tokens and mints
wstETH in return. When the user unwraps, the contract burns the user's wstETH
,
and sends the user locked stETH
in return.
Staking shortcut
The user can send ETH with regular transfer to the address of the contract and get wstETH in return. The contract will send ETH to Lido submit method, staking it and wrapping the received stETH seamlessly under the hood.
Standards
Contract implements the following Ethereum standards:
- ERC-20: Token Standard
- ERC-2612: Permit Extension for ERC-20 Signed Approvals
- EIP-712: Typed structured data hashing and signing
View Methods
getWstETHByStETH()
Returns amount of wstETH
for a given amount of stETH
function getWstETHByStETH(uint256 _stETHAmount) returns (uint256)
Parameters
Name | Type | Description |
---|---|---|
_stETHAmount | uint256 | amount of stETH |
getStETHByWstETH()
Returns amount of stETH
for a given amount of wstETH
function getStETHByWstETH(uint256 _wstETHAmount) returns (uint256)
Parameters
Parameter Name | Type | Description |
---|---|---|
_wstETHAmount | uint256 | amount of wstETH |
stEthPerToken()
Returns the amount of stETH tokens corresponding to one wstETH
function stEthPerToken() returns (uint256)
tokensPerStEth()
Returns the number of wstETH
tokens corresponding to one stETH
function tokensPerStEth() returns (uint256)
Methods
wrap()
Exchanges stETH
to wstETH
function wrap(uint256 _stETHAmount) returns (uint256)
Requirements:
_stETHAmount
must be non-zeromsg.sender
must approve at least_stETHAmount
stETH to this contract.msg.sender
must have at least_stETHAmount
of stETH.
Parameters
Parameter Name | Type | Description |
---|---|---|
_stETHAmount | uint256 | amount of stETH to wrap in exchange for wstETH |
Returns
Amount of wstETH user receives after wrap
unwrap()
Exchanges wstETH to stETH
function unwrap(uint256 _wstETHAmount) returns (uint256)
Requirements:
_wstETHAmount
must be non-zeromsg.sender
must have at least_wstETHAmount
wstETH.
Parameters
Parameter Name | Type | Description |
---|---|---|
_wstETHAmount | uint256 | amount of wstETH to unwrap in exchange for stETH |
Returns
Amount of stETH user receives after unwrapping
receive()
Shortcut to stake ETH and auto-wrap returned stETH
receive() payable