@@ -96,12 +96,14 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
96
96
* @param allocationId The id of the allocation
97
97
* @param subgraphDeploymentId The id of the subgraph deployment
98
98
* @param tokens The amount of tokens allocated
99
+ * @param forceClosed Whether the allocation was force closed
99
100
*/
100
101
event AllocationClosed (
101
102
address indexed indexer ,
102
103
address indexed allocationId ,
103
104
bytes32 indexed subgraphDeploymentId ,
104
- uint256 tokens
105
+ uint256 tokens ,
106
+ bool forceClosed
105
107
);
106
108
107
109
/**
@@ -335,9 +337,9 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
335
337
currentEpoch
336
338
);
337
339
338
- // Check if the indexer is over-allocated and close the allocation if necessary
340
+ // Check if the indexer is over-allocated and force close the allocation if necessary
339
341
if (_isOverAllocated (allocation.indexer, _delegationRatio)) {
340
- _closeAllocation (_allocationId);
342
+ _closeAllocation (_allocationId, true );
341
343
}
342
344
343
345
return tokensRewards;
@@ -415,8 +417,9 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
415
417
* Emits a {AllocationClosed} event
416
418
*
417
419
* @param _allocationId The id of the allocation to be closed
420
+ * @param _forceClosed Whether the allocation was force closed
418
421
*/
419
- function _closeAllocation (address _allocationId ) internal {
422
+ function _closeAllocation (address _allocationId , bool _forceClosed ) internal {
420
423
Allocation.State memory allocation = _allocations.get (_allocationId);
421
424
422
425
// Take rewards snapshot to prevent other allos from counting tokens from this allo
@@ -433,7 +436,13 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
433
436
_subgraphAllocatedTokens[allocation.subgraphDeploymentId] -
434
437
allocation.tokens;
435
438
436
- emit AllocationClosed (allocation.indexer, _allocationId, allocation.subgraphDeploymentId, allocation.tokens);
439
+ emit AllocationClosed (
440
+ allocation.indexer,
441
+ _allocationId,
442
+ allocation.subgraphDeploymentId,
443
+ allocation.tokens,
444
+ _forceClosed
445
+ );
437
446
}
438
447
439
448
/**
0 commit comments