@@ -42,7 +42,7 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
42
42
) external initializer {
43
43
_transferOwnership (initialOwner);
44
44
_setPausedStatus (initialPausedStatus);
45
- _setGlobalBurnOrRedistributionDelay (initialGlobalDelayBlocks);
45
+ _setGlobalEscrowDelay (initialGlobalDelayBlocks);
46
46
}
47
47
48
48
/**
@@ -72,14 +72,14 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
72
72
73
73
// Set the start block for the slash ID.
74
74
_slashIdToStartBlock[operatorSet.key ()][slashId] = uint32 (block .number );
75
- emit StartBurnOrRedistribution (operatorSet, slashId, strategy, uint32 (block .number ));
75
+ emit StartEscrow (operatorSet, slashId, strategy, uint32 (block .number ));
76
76
}
77
77
78
78
/// @inheritdoc ISlashEscrowFactory
79
79
function releaseSlashEscrow (
80
80
OperatorSet calldata operatorSet ,
81
81
uint256 slashId
82
- ) external virtual onlyWhenNotPaused (PAUSED_BURN_OR_REDISTRIBUTE_SHARES ) {
82
+ ) external virtual onlyWhenNotPaused (PAUSED_RELEASE_ESCROW ) {
83
83
address redistributionRecipient = allocationManager.getRedistributionRecipient (operatorSet);
84
84
85
85
// If the redistribution recipient is not the default burn address...
@@ -88,10 +88,10 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
88
88
}
89
89
90
90
// Assert that the slash ID is not paused
91
- require (! isBurnOrRedistributionPaused (operatorSet, slashId), IPausable.CurrentlyPaused ());
91
+ require (! isEscrowPaused (operatorSet, slashId), IPausable.CurrentlyPaused ());
92
92
93
93
// Assert that the escrow delay has elapsed
94
- require (block .number >= getBurnOrRedistributionCompleteBlock (operatorSet, slashId), EscrowDelayNotElapsed ());
94
+ require (block .number >= getEscrowCompleteBlock (operatorSet, slashId), EscrowDelayNotElapsed ());
95
95
96
96
// Calling `decreaseBurnOrRedistributableShares` will transfer the underlying tokens to the `SlashEscrow`.
97
97
// NOTE: While `decreaseBurnOrRedistributableShares` may have already been called, we call it again to ensure that the
@@ -184,7 +184,7 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
184
184
address strategy = pendingStrategiesForSlashId.at (i - 1 );
185
185
186
186
// Burn or redistribute the underlying tokens for the strategy.
187
- slashEscrow.burnOrRedistributeUnderlyingTokens (
187
+ slashEscrow.releaseTokens (
188
188
ISlashEscrowFactory (address (this )),
189
189
slashEscrowImplementation,
190
190
operatorSet,
@@ -195,7 +195,7 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
195
195
196
196
// Remove the strategy and underlying amount from the pending burn or redistributions map.
197
197
pendingStrategiesForSlashId.remove (strategy);
198
- emit BurnOrRedistributionComplete (operatorSet, slashId, IStrategy (strategy), redistributionRecipient);
198
+ emit EscrowComplete (operatorSet, slashId, IStrategy (strategy), redistributionRecipient);
199
199
}
200
200
201
201
// Remove the slash ID from the pending slash IDs set.
@@ -210,12 +210,69 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
210
210
}
211
211
}
212
212
213
- /// @notice Sets the global burn or redistribution delay.
214
- function _setGlobalBurnOrRedistributionDelay (
213
+ /// @inheritdoc ISlashEscrowFactory
214
+ function deploySlashEscrow (OperatorSet calldata operatorSet , uint256 slashId ) public returns (ISlashEscrow) {
215
+ ISlashEscrow slashEscrow = getSlashEscrow (operatorSet, slashId);
216
+
217
+ // If the slash escrow is not deployed...
218
+ if (! isDeployedSlashEscrow (slashEscrow)) {
219
+ return ISlashEscrow (
220
+ address (slashEscrowImplementation).cloneDeterministic (computeSlashEscrowSalt (operatorSet, slashId))
221
+ );
222
+ }
223
+
224
+ return slashEscrow;
225
+ }
226
+
227
+ /**
228
+ *
229
+ * PAUSABLE ACTIONS
230
+ *
231
+ */
232
+
233
+ /// @inheritdoc ISlashEscrowFactory
234
+ function pauseEscrow (OperatorSet calldata operatorSet , uint256 slashId ) external virtual onlyPauser {
235
+ _checkNewPausedStatus (operatorSet, slashId, true );
236
+ _paused[operatorSet.key ()][slashId] = true ;
237
+ emit EscrowPaused (operatorSet, slashId);
238
+ }
239
+
240
+ /// @inheritdoc ISlashEscrowFactory
241
+ function unpauseEscrow (OperatorSet calldata operatorSet , uint256 slashId ) external virtual onlyUnpauser {
242
+ _checkNewPausedStatus (operatorSet, slashId, false );
243
+ _paused[operatorSet.key ()][slashId] = false ;
244
+ emit EscrowUnPaused (operatorSet, slashId);
245
+ }
246
+
247
+ /**
248
+ *
249
+ * OWNER ACTIONS
250
+ *
251
+ */
252
+
253
+ /// @inheritdoc ISlashEscrowFactory
254
+ function setGlobalEscrowDelay (
255
+ uint32 delay
256
+ ) external onlyOwner {
257
+ _setGlobalEscrowDelay (delay);
258
+ }
259
+
260
+ /// @inheritdoc ISlashEscrowFactory
261
+ function setStrategyEscrowDelay (IStrategy strategy , uint32 delay ) external onlyOwner {
262
+ _strategyEscrowDelayBlocks[address (strategy)] = delay;
263
+ emit StrategyEscrowDelaySet (strategy, delay);
264
+ }
265
+
266
+ /**
267
+ *
268
+ * HELPERS
269
+ *
270
+ */
271
+ function _setGlobalEscrowDelay (
215
272
uint32 delay
216
273
) internal {
217
- _globalBurnOrRedistributionDelayBlocks = delay;
218
- emit GlobalBurnOrRedistributionDelaySet (delay);
274
+ _globalEscrowDelayBlocks = delay;
275
+ emit GlobalEscrowDelaySet (delay);
219
276
}
220
277
221
278
/// @notice Checks that the new paused status is not the same as the current paused status.
@@ -300,7 +357,7 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
300
357
// For each slashId, get the complete block.
301
358
completeBlocks[i] = new uint32 [](slashIds[i].length );
302
359
for (uint256 j = 0 ; j < slashIds[i].length ; j++ ) {
303
- completeBlocks[i][j] = getBurnOrRedistributionCompleteBlock (operatorSets[i], slashIds[i][j]);
360
+ completeBlocks[i][j] = getEscrowCompleteBlock (operatorSets[i], slashIds[i][j]);
304
361
}
305
362
}
306
363
}
@@ -362,55 +419,46 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
362
419
}
363
420
364
421
/// @inheritdoc ISlashEscrowFactory
365
- function isBurnOrRedistributionPaused (
366
- OperatorSet calldata operatorSet ,
367
- uint256 slashId
368
- ) public view returns (bool ) {
422
+ function isEscrowPaused (OperatorSet calldata operatorSet , uint256 slashId ) public view returns (bool ) {
369
423
return _paused[operatorSet.key ()][slashId];
370
424
}
371
425
372
426
/// @inheritdoc ISlashEscrowFactory
373
- function getBurnOrRedistributionStartBlock (
374
- OperatorSet memory operatorSet ,
375
- uint256 slashId
376
- ) public view returns (uint256 ) {
427
+ function getEscrowStartBlock (OperatorSet memory operatorSet , uint256 slashId ) public view returns (uint256 ) {
377
428
return _slashIdToStartBlock[operatorSet.key ()][slashId];
378
429
}
379
430
380
431
/// @inheritdoc ISlashEscrowFactory
381
- function getBurnOrRedistributionCompleteBlock (
382
- OperatorSet memory operatorSet ,
383
- uint256 slashId
384
- ) public view returns (uint32 ) {
432
+ function getEscrowCompleteBlock (OperatorSet memory operatorSet , uint256 slashId ) public view returns (uint32 ) {
385
433
IStrategy[] memory strategies = getPendingStrategiesForSlashId (operatorSet, slashId);
386
434
387
435
// Loop through all strategies and return the max delay
388
436
uint32 maxStrategyDelay;
389
437
for (uint256 i = 0 ; i < strategies.length ; ++ i) {
390
- uint32 delay = getStrategyBurnOrRedistributionDelay (IStrategy (address (strategies[i])));
438
+ uint32 delay = getStrategyEscrowDelay (IStrategy (address (strategies[i])));
391
439
if (delay > maxStrategyDelay) {
392
440
maxStrategyDelay = delay;
393
441
}
394
442
}
395
443
396
444
// The escrow can be released once the max strategy delay has elapsed.
397
- return uint32 (getBurnOrRedistributionStartBlock (operatorSet, slashId) + maxStrategyDelay + 1 );
445
+ return uint32 (getEscrowStartBlock (operatorSet, slashId) + maxStrategyDelay + 1 );
398
446
}
399
447
400
448
/// @inheritdoc ISlashEscrowFactory
401
- function getStrategyBurnOrRedistributionDelay (
449
+ function getStrategyEscrowDelay (
402
450
IStrategy strategy
403
451
) public view returns (uint32 ) {
404
- uint32 globalDelay = _globalBurnOrRedistributionDelayBlocks ;
405
- uint32 strategyDelay = _strategyBurnOrRedistributionDelayBlocks [address (strategy)];
452
+ uint32 globalDelay = _globalEscrowDelayBlocks ;
453
+ uint32 strategyDelay = _strategyEscrowDelayBlocks [address (strategy)];
406
454
407
455
// Return whichever delay is greater.
408
456
return strategyDelay > globalDelay ? strategyDelay : globalDelay;
409
457
}
410
458
411
459
/// @inheritdoc ISlashEscrowFactory
412
- function getGlobalBurnOrRedistributionDelay () external view returns (uint32 ) {
413
- return _globalBurnOrRedistributionDelayBlocks ;
460
+ function getGlobalEscrowDelay () external view returns (uint32 ) {
461
+ return _globalEscrowDelayBlocks ;
414
462
}
415
463
416
464
/// @inheritdoc ISlashEscrowFactory
0 commit comments