StakedTokens

StakeWise StakedEthToken smart contract details.

The StakedTokens contract can be used to lock the supported ERC-20 tokens to allow stakers to continue accumulating rwETH when they transfer stETH to the external ERC-20 contract.

Toggling tokens support

An address with an admin role can enable/disable support for the ERC-20 contracts using the toggleTokenContract function. When the token support is enabled, stakers can lock the supported ERC-20 tokens in the StakedTokens contract. If the token support is disabled, stakers can withdraw their locked tokens and rewards, but rwETH stops accumulating for the disabled ERC-20 contract. Staking new tokens for disabled ERC-20 contract will be disallowed. The disabling functionality is added as a precaution in case the supported contract starts misbehaving.

Staking tokens

Let's assume that the staker has deposited stETH and ETH into the stETH/ETH Uniswap liquidity pool and received Uniswap LP tokens in return. In order to continue earning rwETH from the stETH deposited, the staker needs to lock his LP tokens in the StakedTokens contract by calling the stakeTokens function. While the LP tokens are locked in the StakedTokens contract, the staker is able to pull his portion of rwETH from it. The amount he can pull is calculated based on his share of the total amount of LP tokens locked in the StakedTokens contract.

Example of earning rwETH from staking while being a Uniswap LP

Withdrawing tokens

The staker can withdraw their locked tokens at any time by calling the withdrawTokens function. The accumulated rwETH will be transferred to the staker's address.

Withdrawing rewards

The accumulated rwETH is automatically withdrawn every time the staker locks or unlocks tokens. It's also possible to withdraw accumulated rwETH by calling the withdrawRewards function.