@@ -203,35 +203,6 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
203
203
bytes memory _allocationProof ,
204
204
uint32 _delegationRatio
205
205
) internal {
206
- // require(_allocationId != address(0), AllocationManagerInvalidZeroAllocationId());
207
-
208
- // _verifyAllocationProof(_indexer, _allocationId, _allocationProof);
209
-
210
- // // Ensure allocation id is not reused
211
- // // need to check both subgraph service (on allocations.create()) and legacy allocations
212
- // _legacyAllocations.revertIfExists(_graphStaking(), _allocationId);
213
-
214
- // uint256 currentEpoch = _graphEpochManager().currentEpoch();
215
- // Allocation.State memory allocation = _allocations.create(
216
- // _indexer,
217
- // _allocationId,
218
- // _subgraphDeploymentId,
219
- // _tokens,
220
- // _graphRewardsManager().onSubgraphAllocationUpdate(_subgraphDeploymentId),
221
- // currentEpoch
222
- // );
223
-
224
- // // Check that the indexer has enough tokens available
225
- // // Note that the delegation ratio ensures overdelegation cannot be used
226
- // allocationProvisionTracker.lock(_graphStaking(), _indexer, _tokens, _delegationRatio);
227
-
228
- // // Update total allocated tokens for the subgraph deployment
229
- // _subgraphAllocatedTokens[allocation.subgraphDeploymentId] =
230
- // _subgraphAllocatedTokens[allocation.subgraphDeploymentId] +
231
- // allocation.tokens;
232
-
233
- // emit AllocationCreated(_indexer, _allocationId, _subgraphDeploymentId, allocation.tokens, currentEpoch);
234
-
235
206
AllocationManagerLib.allocate (
236
207
_allocations,
237
208
_legacyAllocations,
@@ -286,77 +257,6 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
286
257
uint32 _delegationRatio ,
287
258
address _paymentsDestination
288
259
) internal returns (uint256 ) {
289
- // Allocation.State memory allocation = _allocations.get(_allocationId);
290
- // require(allocation.isOpen(), AllocationManagerAllocationClosed(_allocationId));
291
-
292
- // // Mint indexing rewards if all conditions are met
293
- // uint256 tokensRewards = (!allocation.isStale(maxPOIStaleness) &&
294
- // !allocation.isAltruistic() &&
295
- // _poi != bytes32(0)) && _graphEpochManager().currentEpoch() > allocation.createdAtEpoch
296
- // ? _graphRewardsManager().takeRewards(_allocationId)
297
- // : 0;
298
-
299
- // // ... but we still take a snapshot to ensure the rewards are not accumulated for the next valid POI
300
- // _allocations.snapshotRewards(
301
- // _allocationId,
302
- // _graphRewardsManager().onSubgraphAllocationUpdate(allocation.subgraphDeploymentId)
303
- // );
304
- // _allocations.presentPOI(_allocationId);
305
-
306
- // // Any pending rewards should have been collected now
307
- // _allocations.clearPendingRewards(_allocationId);
308
-
309
- // uint256 tokensIndexerRewards = 0;
310
- // uint256 tokensDelegationRewards = 0;
311
- // if (tokensRewards != 0) {
312
- // // Distribute rewards to delegators
313
- // uint256 delegatorCut = _graphStaking().getDelegationFeeCut(
314
- // allocation.indexer,
315
- // address(this),
316
- // IGraphPayments.PaymentTypes.IndexingRewards
317
- // );
318
- // IHorizonStakingTypes.DelegationPool memory delegationPool = _graphStaking().getDelegationPool(
319
- // allocation.indexer,
320
- // address(this)
321
- // );
322
- // // If delegation pool has no shares then we don't need to distribute rewards to delegators
323
- // tokensDelegationRewards = delegationPool.shares > 0 ? tokensRewards.mulPPM(delegatorCut) : 0;
324
- // if (tokensDelegationRewards > 0) {
325
- // _graphToken().approve(address(_graphStaking()), tokensDelegationRewards);
326
- // _graphStaking().addToDelegationPool(allocation.indexer, address(this), tokensDelegationRewards);
327
- // }
328
-
329
- // // Distribute rewards to indexer
330
- // tokensIndexerRewards = tokensRewards - tokensDelegationRewards;
331
- // if (tokensIndexerRewards > 0) {
332
- // if (_paymentsDestination == address(0)) {
333
- // _graphToken().approve(address(_graphStaking()), tokensIndexerRewards);
334
- // _graphStaking().stakeToProvision(allocation.indexer, address(this), tokensIndexerRewards);
335
- // } else {
336
- // _graphToken().pushTokens(_paymentsDestination, tokensIndexerRewards);
337
- // }
338
- // }
339
- // }
340
-
341
- // emit IndexingRewardsCollected(
342
- // allocation.indexer,
343
- // _allocationId,
344
- // allocation.subgraphDeploymentId,
345
- // tokensRewards,
346
- // tokensIndexerRewards,
347
- // tokensDelegationRewards,
348
- // _poi,
349
- // _poiMetadata,
350
- // _graphEpochManager().currentEpoch()
351
- // );
352
-
353
- // // Check if the indexer is over-allocated and force close the allocation if necessary
354
- // if (_isOverAllocated(allocation.indexer, _delegationRatio)) {
355
- // _closeAllocation(_allocationId, true);
356
- // }
357
-
358
- // return tokensRewards;
359
-
360
260
return
361
261
AllocationManagerLib.presentPOI (
362
262
_allocations,
@@ -446,30 +346,6 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
446
346
* @param _forceClosed Whether the allocation was force closed
447
347
*/
448
348
function _closeAllocation (address _allocationId , bool _forceClosed ) internal {
449
- // Allocation.State memory allocation = _allocations.get(_allocationId);
450
-
451
- // // Take rewards snapshot to prevent other allos from counting tokens from this allo
452
- // _allocations.snapshotRewards(
453
- // _allocationId,
454
- // _graphRewardsManager().onSubgraphAllocationUpdate(allocation.subgraphDeploymentId)
455
- // );
456
-
457
- // _allocations.close(_allocationId);
458
- // allocationProvisionTracker.release(allocation.indexer, allocation.tokens);
459
-
460
- // // Update total allocated tokens for the subgraph deployment
461
- // _subgraphAllocatedTokens[allocation.subgraphDeploymentId] =
462
- // _subgraphAllocatedTokens[allocation.subgraphDeploymentId] -
463
- // allocation.tokens;
464
-
465
- // emit AllocationClosed(
466
- // allocation.indexer,
467
- // _allocationId,
468
- // allocation.subgraphDeploymentId,
469
- // allocation.tokens,
470
- // _forceClosed
471
- // );
472
-
473
349
AllocationManagerLib.closeAllocation (
474
350
_allocations,
475
351
allocationProvisionTracker,
0 commit comments