Skip to content

Commit 16c97c9

Browse files
eigenmikemMichael
authored andcommitted
chore: add event to dsf reset on full withdrawal (#1270)
**Motivation:** DSF reset isn't emitting event on a full withdrawal. **Modifications:** Added event and shadowed declaration to resolve stack too deep **Result:** Easier for front-end to track dsf changes. --------- Co-authored-by: Michael <[email protected]>
1 parent 0e6f6a4 commit 16c97c9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/contracts/core/DelegationManager.sol

+3-2
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ contract DelegationManager is
474474
// Each of these operations fail if we attempt to remove more shares than exist
475475
for (uint256 i = 0; i < strategies.length; ++i) {
476476
IShareManager shareManager = _getShareManager(strategies[i]);
477-
DepositScalingFactor memory dsf = _depositScalingFactor[staker][strategies[i]];
477+
DepositScalingFactor storage dsf = _depositScalingFactor[staker][strategies[i]];
478478

479479
// Calculate how many shares can be withdrawn after factoring in slashing
480480
withdrawableShares[i] = dsf.calcWithdrawable(depositSharesToWithdraw[i], slashingFactors[i]);
@@ -502,7 +502,8 @@ contract DelegationManager is
502502
uint256 sharesAfter = shareManager.removeDepositShares(staker, strategies[i], depositSharesToWithdraw[i]);
503503

504504
if (sharesAfter == 0) {
505-
_depositScalingFactor[staker][strategies[i]].reset();
505+
dsf.reset();
506+
emit DepositScalingFactorUpdated(staker, strategies[i], dsf.scalingFactor());
506507
}
507508
}
508509

src/test/unit/DelegationUnit.t.sol

+2
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,8 @@ contract DelegationManagerUnitTests is EigenLayerUnitTestSetup, IDelegationManag
603603
cheats.expectEmit(true, true, true, true, address(delegationManager));
604604
emit OperatorSharesDecreased(params.operator, params.staker, params.strategy, params.operatorSharesDecreased);
605605
cheats.expectEmit(true, true, true, true, address(delegationManager));
606+
emit DepositScalingFactorUpdated(params.staker, params.strategy, params.depositScalingFactor);
607+
cheats.expectEmit(true, true, true, true, address(delegationManager));
606608
emit SlashingWithdrawalQueued(params.withdrawalRoot, params.withdrawal, params.operatorSharesDecreased.toArrayU256());
607609
}
608610
}

0 commit comments

Comments
 (0)