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 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 morestETH
.stETH
amount has decreased. The staker starts earning a smaller portion of the rewards because he now holds lessstETH
.- The staker has transferred the
rwETH
tokens to a different address. The staker will continue earning rewards as usual but hisrwETH
balance will decrease by the amount of transferredrwETH
.
Every checkpoint stores:
rewardPerToken
- the number of earnedrwETH
tokens per everystETH
tokenreward
- the staker's totalrwETH
balance calculated based on therewardPerToken
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:where:
Last modified 2yr ago