StakeWise
Search…
RewardEthToken
StakeWise RewardEthToken smart contract details.
The RewardEthToken is an ERC-20 contract. It reflects the rewards accumulated by the stakers in the form of rwETH tokens. The tokens are mapped 1 to 1 to ETH.
The total supply of rwETH is the amount that is above the effective balance of all the validators registered for the StakeWise Pool.

# Checkpoints

Checkpoints are used to keep track of the staker's previously accumulated rewards and calculate the current reward. The checkpoint is updated in the following scenarios:
• stETH amount has increased. The staker starts earning a bigger portion of the rewards because he now holds more stETH.
• stETH amount has decreased. The staker starts earning a smaller portion of the rewards because he now holds less stETH.
• The staker has transferred the rwETH tokens to a different address. The staker will continue earning rewards as usual but his rwETH balance will decrease by the amount of transferred rwETH.
Every checkpoint stores:
• rewardPerToken - the number of earned rwETH tokens per every stETH token
• reward - the staker's total rwETH balance calculated based on the rewardPerToken

# Emission

The Pool's rewards are updated periodically by the BalanceReporters contract using the updateTotalRewards function. When the total rewards are updated, the new value of rewardPerToken is calculated.
If the rewardPerToken is smaller than the previous value, it means that the Pool's validators have received a penalty. Every staker's current reward gets reduced proportionally to their share of the total supply of stETH. If the staker's rwETH amount drops below 0, the negative value gets deducted from their stETH balance. Once the staker's rwETH amount grows above 0, the stETH balance gets restored to its initial value (see example here).
If the rewardPerToken is greater than the previous value, it means that the Pool's rewards have increased. The amount of rwETH tokens of every stETH holder is then increased based on their share of the total supply of stETH.
The total amount of rwETH tokens for each individual staker is calculated based on the following formula when calling the rewardOf function:
$r_{t} = r_{p} + r_{c}\\ r_{c} = b_{c} * (rate_{c} - rate_{p})\\$
where:
$r_{t} - staker's\;total\;amount\;of\;rwETH\\ r_{p} - staker's\;rwETH\;at\;the\;last\;checkpoint\\ r_{c} - accumulated\;rwETH\;since\;the\;last\;checkpoint\\ b_{c} - staker's\;current\;stETH\;balance\\ rate_{c} - current\;reward\;rate\;per\;stETH\;token\\ rate_{p} - staker's\;checkpoint\;reward\;rate\;per\;stETH\;token\\$