Skip to content

Commit 44bd8d2

Browse files
chore: update naming (#1408)
**Motivation:** We use `burnOrRedistributable` everywhere. Let's just use escrow instead. Much simpler. **Modifications:** `burnOrRedistributable -> escrow`. **Result:** Better readability. --------- Co-authored-by: clandestine.eth <[email protected]>
1 parent 5b383c7 commit 44bd8d2

File tree

6 files changed

+212
-203
lines changed

6 files changed

+212
-203
lines changed

src/contracts/core/SlashEscrow.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ contract SlashEscrow is ISlashEscrow {
1111
using SafeERC20 for IERC20;
1212

1313
/// @inheritdoc ISlashEscrow
14-
function burnOrRedistributeUnderlyingTokens(
14+
function releaseTokens(
1515
ISlashEscrowFactory slashEscrowFactory,
1616
ISlashEscrow slashEscrowImplementation,
1717
OperatorSet calldata operatorSet,

src/contracts/core/SlashEscrowFactory.sol

Lines changed: 31 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
4242
) external initializer {
4343
_transferOwnership(initialOwner);
4444
_setPausedStatus(initialPausedStatus);
45-
_setGlobalBurnOrRedistributionDelay(initialGlobalDelayBlocks);
45+
_setGlobalEscrowDelay(initialGlobalDelayBlocks);
4646
}
4747

4848
/**
@@ -72,14 +72,14 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
7272

7373
// Set the start block for the slash ID.
7474
_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));
7676
}
7777

7878
/// @inheritdoc ISlashEscrowFactory
7979
function releaseSlashEscrow(
8080
OperatorSet calldata operatorSet,
8181
uint256 slashId
82-
) external virtual onlyWhenNotPaused(PAUSED_BURN_OR_REDISTRIBUTE_SHARES) {
82+
) external virtual onlyWhenNotPaused(PAUSED_RELEASE_ESCROW) {
8383
address redistributionRecipient = allocationManager.getRedistributionRecipient(operatorSet);
8484

8585
// If the redistribution recipient is not the default burn address...
@@ -88,10 +88,10 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
8888
}
8989

9090
// Assert that the slash ID is not paused
91-
require(!isBurnOrRedistributionPaused(operatorSet, slashId), IPausable.CurrentlyPaused());
91+
require(!isEscrowPaused(operatorSet, slashId), IPausable.CurrentlyPaused());
9292

9393
// Assert that the escrow delay has elapsed
94-
require(block.number >= getBurnOrRedistributionCompleteBlock(operatorSet, slashId), EscrowDelayNotElapsed());
94+
require(block.number >= getEscrowCompleteBlock(operatorSet, slashId), EscrowDelayNotElapsed());
9595

9696
// Calling `decreaseBurnOrRedistributableShares` will transfer the underlying tokens to the `SlashEscrow`.
9797
// NOTE: While `decreaseBurnOrRedistributableShares` may have already been called, we call it again to ensure that the
@@ -127,17 +127,17 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
127127
*/
128128

129129
/// @inheritdoc ISlashEscrowFactory
130-
function pauseRedistribution(OperatorSet calldata operatorSet, uint256 slashId) external virtual onlyPauser {
130+
function pauseEscrow(OperatorSet calldata operatorSet, uint256 slashId) external virtual onlyPauser {
131131
_checkNewPausedStatus(operatorSet, slashId, true);
132132
_paused[operatorSet.key()][slashId] = true;
133-
emit RedistributionPaused(operatorSet, slashId);
133+
emit EscrowPaused(operatorSet, slashId);
134134
}
135135

136136
/// @inheritdoc ISlashEscrowFactory
137-
function unpauseRedistribution(OperatorSet calldata operatorSet, uint256 slashId) external virtual onlyUnpauser {
137+
function unpauseEscrow(OperatorSet calldata operatorSet, uint256 slashId) external virtual onlyUnpauser {
138138
_checkNewPausedStatus(operatorSet, slashId, false);
139139
_paused[operatorSet.key()][slashId] = false;
140-
emit RedistributionUnpaused(operatorSet, slashId);
140+
emit EscrowUnpaused(operatorSet, slashId);
141141
}
142142

143143
/**
@@ -147,16 +147,16 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
147147
*/
148148

149149
/// @inheritdoc ISlashEscrowFactory
150-
function setGlobalBurnOrRedistributionDelay(
150+
function setGlobalEscrowDelay(
151151
uint32 delay
152152
) external onlyOwner {
153-
_setGlobalBurnOrRedistributionDelay(delay);
153+
_setGlobalEscrowDelay(delay);
154154
}
155155

156156
/// @inheritdoc ISlashEscrowFactory
157-
function setStrategyBurnOrRedistributionDelay(IStrategy strategy, uint32 delay) external onlyOwner {
158-
_strategyBurnOrRedistributionDelayBlocks[address(strategy)] = delay;
159-
emit StrategyBurnOrRedistributionDelaySet(strategy, delay);
157+
function setStrategyEscrowDelay(IStrategy strategy, uint32 delay) external onlyOwner {
158+
_strategyEscrowDelayBlocks[address(strategy)] = delay;
159+
emit StrategyEscrowDelaySet(strategy, delay);
160160
}
161161

162162
/**
@@ -184,7 +184,7 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
184184
address strategy = pendingStrategiesForSlashId.at(i - 1);
185185

186186
// Burn or redistribute the underlying tokens for the strategy.
187-
slashEscrow.burnOrRedistributeUnderlyingTokens(
187+
slashEscrow.releaseTokens(
188188
ISlashEscrowFactory(address(this)),
189189
slashEscrowImplementation,
190190
operatorSet,
@@ -195,7 +195,7 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
195195

196196
// Remove the strategy and underlying amount from the pending burn or redistributions map.
197197
pendingStrategiesForSlashId.remove(strategy);
198-
emit BurnOrRedistributionComplete(operatorSet, slashId, IStrategy(strategy), redistributionRecipient);
198+
emit EscrowComplete(operatorSet, slashId, IStrategy(strategy), redistributionRecipient);
199199
}
200200

201201
// Remove the slash ID from the pending slash IDs set.
@@ -210,12 +210,12 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
210210
}
211211
}
212212

213-
/// @notice Sets the global burn or redistribution delay.
214-
function _setGlobalBurnOrRedistributionDelay(
213+
/// @notice Sets the global escrow delay.
214+
function _setGlobalEscrowDelay(
215215
uint32 delay
216216
) internal {
217-
_globalBurnOrRedistributionDelayBlocks = delay;
218-
emit GlobalBurnOrRedistributionDelaySet(delay);
217+
_globalEscrowDelayBlocks = delay;
218+
emit GlobalEscrowDelaySet(delay);
219219
}
220220

221221
/// @notice Checks that the new paused status is not the same as the current paused status.
@@ -300,7 +300,7 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
300300
// For each slashId, get the complete block.
301301
completeBlocks[i] = new uint32[](slashIds[i].length);
302302
for (uint256 j = 0; j < slashIds[i].length; j++) {
303-
completeBlocks[i][j] = getBurnOrRedistributionCompleteBlock(operatorSets[i], slashIds[i][j]);
303+
completeBlocks[i][j] = getEscrowCompleteBlock(operatorSets[i], slashIds[i][j]);
304304
}
305305
}
306306
}
@@ -362,55 +362,46 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
362362
}
363363

364364
/// @inheritdoc ISlashEscrowFactory
365-
function isBurnOrRedistributionPaused(
366-
OperatorSet calldata operatorSet,
367-
uint256 slashId
368-
) public view returns (bool) {
365+
function isEscrowPaused(OperatorSet calldata operatorSet, uint256 slashId) public view returns (bool) {
369366
return _paused[operatorSet.key()][slashId];
370367
}
371368

372369
/// @inheritdoc ISlashEscrowFactory
373-
function getBurnOrRedistributionStartBlock(
374-
OperatorSet memory operatorSet,
375-
uint256 slashId
376-
) public view returns (uint256) {
370+
function getEscrowStartBlock(OperatorSet memory operatorSet, uint256 slashId) public view returns (uint256) {
377371
return _slashIdToStartBlock[operatorSet.key()][slashId];
378372
}
379373

380374
/// @inheritdoc ISlashEscrowFactory
381-
function getBurnOrRedistributionCompleteBlock(
382-
OperatorSet memory operatorSet,
383-
uint256 slashId
384-
) public view returns (uint32) {
375+
function getEscrowCompleteBlock(OperatorSet memory operatorSet, uint256 slashId) public view returns (uint32) {
385376
IStrategy[] memory strategies = getPendingStrategiesForSlashId(operatorSet, slashId);
386377

387378
// Loop through all strategies and return the max delay
388379
uint32 maxStrategyDelay;
389380
for (uint256 i = 0; i < strategies.length; ++i) {
390-
uint32 delay = getStrategyBurnOrRedistributionDelay(IStrategy(address(strategies[i])));
381+
uint32 delay = getStrategyEscrowDelay(IStrategy(address(strategies[i])));
391382
if (delay > maxStrategyDelay) {
392383
maxStrategyDelay = delay;
393384
}
394385
}
395386

396387
// The escrow can be released once the max strategy delay has elapsed.
397-
return uint32(getBurnOrRedistributionStartBlock(operatorSet, slashId) + maxStrategyDelay + 1);
388+
return uint32(getEscrowStartBlock(operatorSet, slashId) + maxStrategyDelay + 1);
398389
}
399390

400391
/// @inheritdoc ISlashEscrowFactory
401-
function getStrategyBurnOrRedistributionDelay(
392+
function getStrategyEscrowDelay(
402393
IStrategy strategy
403394
) public view returns (uint32) {
404-
uint32 globalDelay = _globalBurnOrRedistributionDelayBlocks;
405-
uint32 strategyDelay = _strategyBurnOrRedistributionDelayBlocks[address(strategy)];
395+
uint32 globalDelay = _globalEscrowDelayBlocks;
396+
uint32 strategyDelay = _strategyEscrowDelayBlocks[address(strategy)];
406397

407398
// Return whichever delay is greater.
408399
return strategyDelay > globalDelay ? strategyDelay : globalDelay;
409400
}
410401

411402
/// @inheritdoc ISlashEscrowFactory
412-
function getGlobalBurnOrRedistributionDelay() external view returns (uint32) {
413-
return _globalBurnOrRedistributionDelayBlocks;
403+
function getGlobalEscrowDelay() external view returns (uint32) {
404+
return _globalEscrowDelayBlocks;
414405
}
415406

416407
/// @inheritdoc ISlashEscrowFactory

src/contracts/core/SlashEscrowFactoryStorage.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ abstract contract SlashEscrowFactoryStorage is ISlashEscrowFactory {
1515
address internal constant DEFAULT_BURN_ADDRESS = 0x00000000000000000000000000000000000E16E4;
1616

1717
/// @notice The pause status for the `releaseSlashEscrow` function.
18-
/// @dev Allows all burn or redistribution outflows to be temporarily halted.
19-
uint8 public constant PAUSED_BURN_OR_REDISTRIBUTE_SHARES = 0;
18+
/// @dev Allows all escrow outflows to be temporarily halted.
19+
uint8 public constant PAUSED_RELEASE_ESCROW = 0;
2020

2121
// Immutable Storage
2222

@@ -48,11 +48,11 @@ abstract contract SlashEscrowFactoryStorage is ISlashEscrowFactory {
4848
/// @notice Returns the paused status for a given operator set and slash ID.
4949
mapping(bytes32 operatorSetKey => mapping(uint256 slashId => bool paused)) internal _paused;
5050

51-
/// @dev Returns the burn or redistribution delay for a given strategy.
52-
uint32 internal _globalBurnOrRedistributionDelayBlocks;
51+
/// @dev Returns the global escrow delay for all strategies.
52+
uint32 internal _globalEscrowDelayBlocks;
5353

5454
/// @dev Returns the operator set delay for a given strategy.
55-
mapping(address strategy => uint32 delay) internal _strategyBurnOrRedistributionDelayBlocks;
55+
mapping(address strategy => uint32 delay) internal _strategyEscrowDelayBlocks;
5656

5757
// Constructor
5858

src/contracts/interfaces/ISlashEscrow.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface ISlashEscrow {
1919
/// @param slashId The slash ID that was used to create the slash escrow.
2020
/// @param recipient The recipient of the underlying tokens.
2121
/// @param strategy The strategy that was used to create the slash escrow.
22-
function burnOrRedistributeUnderlyingTokens(
22+
function releaseTokens(
2323
ISlashEscrowFactory slashEscrowFactory,
2424
ISlashEscrow slashEscrowImplementation,
2525
OperatorSet calldata operatorSet,
@@ -32,7 +32,7 @@ interface ISlashEscrow {
3232
/// @dev Validates that the provided parameters deterministically generate this contract's address using CREATE2.
3333
/// - Uses ClonesUpgradeable.predictDeterministicAddress() to compute the expected address from the parameters.
3434
/// - Compares the computed address against this contract's address to validate parameter integrity.
35-
/// - Provides a stateless validation mechanism for burnOrRedistributeUnderlyingTokens() inputs.
35+
/// - Provides a stateless validation mechanism for releaseTokens() inputs.
3636
/// - Security relies on the cryptographic properties of CREATE2 address derivation.
3737
/// - Attack vector would require finding a hash collision in the CREATE2 address computation.
3838
/// @param slashEscrowFactory The factory contract that created the slash escrow.

0 commit comments

Comments
 (0)