Skip to content

Commit

Permalink
explain impact on totalAssets
Browse files Browse the repository at this point in the history
  • Loading branch information
danoctavian committed Sep 2, 2024
1 parent 9fc06f4 commit e4ed642
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/StakingNodesManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,13 @@ contract StakingNodesManager is
// If there is an amount of rewards specified, handle that
if (rewardsAmount > 0) {

// IMPORTANT: Impact on totalAssets()
// After charging the rewards fee, the totalAssets() of the system may decrease.
// Steps:
// 1. The full rewardsAmount is removed from the staking node's balance (which is part of totalAssets).
// 2. Only the remainingRewards (after fees) are reinvested back to the system.
// 3. The fees are sent to a separate fee receiver and are no longer part of the system's totalAssets.

(bool sent, ) = address(rewardsDistributor.consensusLayerReceiver()).call{value: rewardsAmount}("");
if (!sent) {
revert TransferFailed();
Expand Down

0 comments on commit e4ed642

Please sign in to comment.