@@ -8,7 +8,6 @@ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
88
99import "../mixins/SignatureUtilsMixin.sol " ;
1010import "../interfaces/IEigenPodManager.sol " ;
11- import "../libraries/OperatorSetLib.sol " ;
1211import "../permissions/Pausable.sol " ;
1312import "./StrategyManagerStorage.sol " ;
1413
@@ -31,8 +30,6 @@ contract StrategyManager is
3130{
3231 using SlashingLib for * ;
3332 using SafeERC20 for IERC20 ;
34- using OperatorSetLib for OperatorSet;
35- using EnumerableMap for EnumerableMap.AddressToUintMap;
3633
3734 modifier onlyStrategyWhitelister () {
3835 require (msg .sender == strategyWhitelister, OnlyStrategyWhitelister ());
@@ -55,11 +52,10 @@ contract StrategyManager is
5552 * @param _delegation The delegation contract of EigenLayer.
5653 */
5754 constructor (
58- IAllocationManager _allocationManager ,
5955 IDelegationManager _delegation ,
6056 IPauserRegistry _pauserRegistry ,
6157 string memory _version
62- ) StrategyManagerStorage (_allocationManager, _delegation) Pausable (_pauserRegistry) SignatureUtilsMixin (_version) {
58+ ) StrategyManagerStorage (_delegation) Pausable (_pauserRegistry) SignatureUtilsMixin (_version) {
6359 _disableInitializers ();
6460 }
6561
@@ -151,63 +147,23 @@ contract StrategyManager is
151147 IStrategy strategy ,
152148 uint256 addedSharesToBurn
153149 ) external onlyDelegationManager nonReentrant {
154- EnumerableMap.AddressToUintMap storage operatorSetBurnableShares =
155- _operatorSetBurnableShares[operatorSet.key ()][slashId];
156- (, uint256 currentShares ) = operatorSetBurnableShares.tryGet (address (strategy));
157- operatorSetBurnableShares.set (address (strategy), currentShares + addedSharesToBurn);
158-
150+ // (, uint256 currentShares) = EnumerableMap.tryGet(burnableShares, address(strategy));
151+ // EnumerableMap.set(burnableShares, address(strategy), currentShares + addedSharesToBurn);
159152 emit BurnableSharesIncreased (operatorSet, slashId, strategy, addedSharesToBurn);
160153 }
161154
162155 /// @inheritdoc IStrategyManager
163156 function burnShares (
164157 IStrategy strategy
165158 ) external nonReentrant {
166- EnumerableMap.AddressToUintMap storage burnableShares = _burnableShares;
167- (, uint256 sharesToBurn ) = burnableShares.tryGet (address (strategy));
168- burnableShares.remove (address (strategy));
169-
170- // NOTE: We use max values for the operatorSet and slashId to indicate that this is a pre-distribution burn.
171- _burnShares ({
172- operatorSet: OperatorSet (address (this ), type (uint32 ).max),
173- slashId: type (uint256 ).max,
174- strategy: strategy,
175- recipient: DEFAULT_BURN_ADDRESS,
176- sharesToBurn: sharesToBurn
177- });
178- }
179-
180- /// @inheritdoc IStrategyManager
181- function burnOrDistributeShares (
182- OperatorSet calldata operatorSet ,
183- uint256 slashId ,
184- IStrategy strategy
185- ) external nonReentrant {
186- EnumerableMap.AddressToUintMap storage operatorSetBurnableShares =
187- _operatorSetBurnableShares[operatorSet.key ()][slashId];
188-
189- (, uint256 sharesToBurn ) = operatorSetBurnableShares.tryGet (address (strategy));
190-
191- address recipient = allocationManager.getRedistributionRecipient (operatorSet);
192-
193- _burnOrDistributeShares (operatorSetBurnableShares, operatorSet, strategy, slashId, sharesToBurn, recipient);
194- }
195-
196- /// @inheritdoc IStrategyManager
197- function burnOrDistributeShares (OperatorSet calldata operatorSet , uint256 slashId ) external nonReentrant {
198- EnumerableMap.AddressToUintMap storage operatorSetBurnableShares =
199- _operatorSetBurnableShares[operatorSet.key ()][slashId];
200-
201- uint256 totalEntries = operatorSetBurnableShares.length ();
159+ (, uint256 sharesToBurn ) = EnumerableMap.tryGet (burnableShares, address (strategy));
160+ EnumerableMap.remove (burnableShares, address (strategy));
161+ emit BurnableSharesDecreased (OperatorSet (address (this ), 0 ), 0 , strategy, sharesToBurn);
202162
203- address recipient = allocationManager.getRedistributionRecipient (operatorSet);
204-
205- for (uint256 i = 0 ; i < totalEntries; ++ i) {
206- (address strategy , uint256 sharesToBurn ) = operatorSetBurnableShares.at (i);
207-
208- _burnOrDistributeShares (
209- operatorSetBurnableShares, operatorSet, IStrategy (strategy), slashId, sharesToBurn, recipient
210- );
163+ // Burning acts like withdrawing, except that the destination is to the burn address.
164+ // If we have no shares to burn, we don't need to call the strategy.
165+ if (sharesToBurn != 0 ) {
166+ strategy.withdraw (DEFAULT_BURN_ADDRESS, strategy.underlyingToken (), sharesToBurn);
211167 }
212168 }
213169
@@ -348,62 +304,6 @@ contract StrategyManager is
348304 return userDepositShares;
349305 }
350306
351- /**
352- * @notice Burns `sharesToBurn` shares from `strategy` and sends the underlying tokens to `recipient`.
353- * @param operatorSet The operator set associated with this burn/redistribution.
354- * @param slashId The unique identifier for the slashing event relative to the operator set.
355- * @param strategy The strategy contract from which shares will be burned.
356- * @param recipient The address that will receive the underlying tokens from the burned shares.
357- * @param sharesToBurn The number of shares to burn from the strategy.
358- */
359- function _burnShares (
360- OperatorSet memory operatorSet ,
361- uint256 slashId ,
362- IStrategy strategy ,
363- address recipient ,
364- uint256 sharesToBurn
365- ) internal {
366- emit BurnableSharesDecreased (operatorSet, slashId, strategy, recipient, sharesToBurn);
367-
368- // Burning acts like withdrawing, except that the destination is to the burn address.
369- // If we have no shares to burn, we don't need to call the strategy.
370- if (sharesToBurn != 0 ) {
371- strategy.withdraw (recipient, strategy.underlyingToken (), sharesToBurn);
372- }
373- }
374-
375- /**
376- * @notice Burns `sharesToBurn` shares from `strategy` and sends the underlying tokens to redistribution recipient or `DEFAULT_BURN_ADDRESS`.
377- * @param ptr The pointer to the operator set burnable shares map.
378- * @param operatorSet The operator set associated with this burn/redistribution.
379- * @param slashId The unique identifier for the slashing event relative to the operator set.
380- * @param strategy The strategy contract from which shares will be burned.
381- * @param sharesToBurn The number of shares to burn from the strategy.
382- */
383- function _burnOrDistributeShares (
384- EnumerableMap.AddressToUintMap storage ptr ,
385- OperatorSet calldata operatorSet ,
386- IStrategy strategy ,
387- uint256 slashId ,
388- uint256 sharesToBurn ,
389- address recipient
390- ) internal {
391- require (
392- block .timestamp >= allocationManager.getBurnOrRedistributionBlock (operatorSet, strategy, slashId),
393- BurnOrRedistributionDelayNotElapsed ()
394- );
395-
396- ptr.remove (address (strategy));
397-
398- _burnShares ({
399- operatorSet: operatorSet,
400- slashId: slashId,
401- strategy: IStrategy (strategy),
402- recipient: recipient,
403- sharesToBurn: sharesToBurn
404- });
405- }
406-
407307 /**
408308 * @notice Removes `strategy` from `staker`'s dynamic array of strategies, i.e. from `stakerStrategyList[staker]`
409309 * @param staker The user whose array will have an entry removed
@@ -493,48 +393,22 @@ contract StrategyManager is
493393 /// @inheritdoc IStrategyManager
494394 function getBurnableShares (
495395 IStrategy strategy
496- ) external view returns (uint256 shares ) {
497- (, shares) = _burnableShares.tryGet (address (strategy));
498- }
499-
500- /// @inheritdoc IStrategyManager
501- function getOperatorSetBurnableShares (
502- OperatorSet calldata operatorSet ,
503- uint256 slashId ,
504- IStrategy strategy
505- ) external view returns (uint256 shares ) {
506- (, shares) = _operatorSetBurnableShares[operatorSet.key ()][slashId].tryGet (address (strategy));
396+ ) external view returns (uint256 ) {
397+ (, uint256 shares ) = EnumerableMap.tryGet (burnableShares, address (strategy));
398+ return shares;
507399 }
508400
509401 /// @inheritdoc IStrategyManager
510402 function getStrategiesWithBurnableShares () external view returns (address [] memory , uint256 [] memory ) {
511- EnumerableMap.AddressToUintMap storage burnableShares = _burnableShares;
512- uint256 totalEntries = burnableShares.length ();
513-
514- address [] memory strategies = new address [](totalEntries);
515- uint256 [] memory shares = new uint256 [](totalEntries);
516-
517- for (uint256 i = 0 ; i < totalEntries; ++ i) {
518- (strategies[i], shares[i]) = burnableShares.at (i);
519- }
520-
521- return (strategies, shares);
522- }
523-
524- /// @inheritdoc IStrategyManager
525- function getOperatorSetStrategiesWithBurnableShares (
526- OperatorSet calldata operatorSet ,
527- uint256 slashId
528- ) external view returns (address [] memory , uint256 [] memory ) {
529- EnumerableMap.AddressToUintMap storage operatorSetBurnableShares =
530- _operatorSetBurnableShares[operatorSet.key ()][slashId];
531- uint256 totalEntries = operatorSetBurnableShares.length ();
403+ uint256 totalEntries = EnumerableMap.length (burnableShares);
532404
533405 address [] memory strategies = new address [](totalEntries);
534406 uint256 [] memory shares = new uint256 [](totalEntries);
535407
536- for (uint256 i = 0 ; i < totalEntries; ++ i) {
537- (strategies[i], shares[i]) = operatorSetBurnableShares.at (i);
408+ for (uint256 i = 0 ; i < totalEntries; i++ ) {
409+ (address strategy , uint256 shareAmount ) = EnumerableMap.at (burnableShares, i);
410+ strategies[i] = strategy;
411+ shares[i] = shareAmount;
538412 }
539413
540414 return (strategies, shares);
0 commit comments