1

How does Metamask calculate the rewards on a LIDO wallet? After depositing some ETH, the user receives an amount on stETH as a blockchain transaction. After this, LIDO assign daily rewards for users, but not as a blockchain transaction. You can see this on LIDO website. As expected, Etherscan shows only the original ETH transaction, when staking. But Metamask calculates the total amount, considering LIDO rewards. How does Metamask do this? Does Metamask uses stETH daily rebasing?

1 Answer 1

3
+50

As mentioned in this LIDO blog:

When staking Ethereum with Lido, you no longer need to “lock” your tokens away, as is the case with many other staking providers. When you stake, you receive an stETH (staked ETH) token in return, which you can send, transfer, store and sell as you would with your regular ETH. The difference between your stETH and your regular ETH however is that your stETH rebases on a daily basis.

And, according to their docs, with rebasing mechanism, the daily stETH balance of an account is calculated using this formula:

balanceOf(account) = shares[account] * totalPooledEther / totalShares

So, MetaMask calculates the same by querying each of these values from the stETH token contract using the following functions:

As, mentioned in the docs:

On each rebase totalPooledEther normally increases, indicating that there were some rewards earned by validators, that ought to be distributed, so the user balance gets increased as well automatically, despite their shares remaining as they were.

Thereby, Δ(balanceOf(account)) (i.e., the change in the balance) can be considered/calculated as the reward.

P.S., For precise results, you might need to consider the fee using the getFee() function in the calculation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.