Skip to content

Commit

Permalink
fix: Lido.handleOracleReport swap steps 6 and 7
Browse files Browse the repository at this point in the history
The idea is to harden the accounting processing
Shares should be burnt BEFORE the fee distribution
  • Loading branch information
TheDZhon committed Mar 16, 2023
1 parent 2ac38c7 commit ac8b87d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions contracts/0.4.24/Lido.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1175,8 +1175,8 @@ contract Lido is Versioned, StETHPermit, AragonApp {
* 4. Pass the accounting values to sanity checker to smoothen positive token rebase
* (i.e., postpone the extra rewards to be applied during the next rounds)
* 5. Invoke finalization of the withdrawal requests
* 6. Distribute protocol fee (treasury & node operators)
* 7. Burn excess shares within the allowed limit (can postpone some shares to be burnt later)
* 6. Burn excess shares within the allowed limit (can postpone some shares to be burnt later)
* 7. Distribute protocol fee (treasury & node operators)
* 8. Complete token rebase by informing observers (emit an event and call the external receivers if any)
* 9. Sanity check for the provided simulated share rate
*/
Expand Down Expand Up @@ -1261,6 +1261,13 @@ contract Lido is Versioned, StETHPermit, AragonApp {
);

// Step 6.
// Burn the previously requested shares
if (reportContext.sharesToBurn > 0) {
IBurner(contracts.burner).commitSharesToBurn(reportContext.sharesToBurn);
_burnShares(contracts.burner, reportContext.sharesToBurn);
}

// Step 7.
// Distribute protocol fee (treasury & node operators)
reportContext.sharesMintedAsFees = _processRewards(
reportContext,
Expand All @@ -1269,13 +1276,6 @@ contract Lido is Versioned, StETHPermit, AragonApp {
elRewards
);

// Step 7.
// Burn the previously requested shares
if (reportContext.sharesToBurn > 0) {
IBurner(contracts.burner).commitSharesToBurn(reportContext.sharesToBurn);
_burnShares(contracts.burner, reportContext.sharesToBurn);
}

// Step 8.
// Complete token rebase by informing observers (emit an event and call the external receivers if any)
(
Expand Down

0 comments on commit ac8b87d

Please sign in to comment.