Skip to main content

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:

View Methods

getWstETHByStETH()

Returns amount of wstETH for a given amount of stETH

function getWstETHByStETH(uint256 _stETHAmount) returns (uint256)

Parameters

NameTypeDescription
_stETHAmountuint256amount of stETH

getStETHByWstETH()

Returns amount of stETH for a given amount of wstETH

function getStETHByWstETH(uint256 _wstETHAmount) returns (uint256)

Parameters

Parameter NameTypeDescription
_wstETHAmountuint256amount 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)
note

Requirements:

  • _stETHAmount must be non-zero
  • msg.sender must approve at least _stETHAmount stETH to this contract.
  • msg.sender must have at least _stETHAmount of stETH.

Parameters

Parameter NameTypeDescription
_stETHAmountuint256amount 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)
note

Requirements:

  • _wstETHAmount must be non-zero
  • msg.sender must have at least _wstETHAmount wstETH.

Parameters

Parameter NameTypeDescription
_wstETHAmountuint256amount 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