Skip to content

Commit 612dc73

Browse files
f: remove comments
1 parent 59735ef commit 612dc73

File tree

2 files changed

+0
-175
lines changed

2 files changed

+0
-175
lines changed

packages/horizon/contracts/data-service/extensions/DataServiceFees.sol

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,6 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
4242
* @param _unlockTimestamp The timestamp when the tokens can be released
4343
*/
4444
function _lockStake(address _serviceProvider, uint256 _tokens, uint256 _unlockTimestamp) internal {
45-
// require(_tokens != 0, DataServiceFeesZeroTokens());
46-
// feesProvisionTracker.lock(_graphStaking(), _serviceProvider, _tokens, _delegationRatio);
47-
48-
// LinkedList.List storage claimsList = claimsLists[_serviceProvider];
49-
50-
// // Save item and add to list
51-
// bytes32 claimId = _buildStakeClaimId(_serviceProvider, claimsList.nonce);
52-
// claims[claimId] = StakeClaim({
53-
// tokens: _tokens,
54-
// createdAt: block.timestamp,
55-
// releasableAt: _unlockTimestamp,
56-
// nextClaim: bytes32(0)
57-
// });
58-
// if (claimsList.count != 0) claims[claimsList.tail].nextClaim = claimId;
59-
// claimsList.addTail(claimId);
60-
61-
// emit StakeClaimLocked(_serviceProvider, claimId, _tokens, _unlockTimestamp);
62-
6345
DataServiceFeesLib.lockStake(
6446
_delegationRatio,
6547
feesProvisionTracker,
@@ -104,24 +86,6 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
10486
* @return The updated accumulator data
10587
*/
10688
function _processStakeClaim(bytes32 _claimId, bytes memory _acc) private returns (bool, bytes memory) {
107-
// StakeClaim memory claim = _getStakeClaim(_claimId);
108-
109-
// // early exit
110-
// if (claim.releasableAt > block.timestamp) {
111-
// return (true, LinkedList.NULL_BYTES);
112-
// }
113-
114-
// // decode
115-
// (uint256 tokensClaimed, address serviceProvider) = abi.decode(_acc, (uint256, address));
116-
117-
// // process
118-
// feesProvisionTracker.release(serviceProvider, claim.tokens);
119-
// emit StakeClaimReleased(serviceProvider, _claimId, claim.tokens, claim.releasableAt);
120-
121-
// // encode
122-
// _acc = abi.encode(tokensClaimed + claim.tokens, serviceProvider);
123-
// return (false, _acc);
124-
12589
return DataServiceFeesLib.processStakeClaim(feesProvisionTracker, claims, _claimId, _acc);
12690
}
12791

@@ -134,17 +98,6 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
13498
delete claims[_claimId];
13599
}
136100

137-
// /**
138-
// * @notice Gets the details of a stake claim
139-
// * @param _claimId The ID of the stake claim
140-
// * @return The stake claim details
141-
// */
142-
// function _getStakeClaim(bytes32 _claimId) private view returns (StakeClaim memory) {
143-
// StakeClaim memory claim = claims[_claimId];
144-
// require(claim.createdAt != 0, DataServiceFeesClaimNotFound(_claimId));
145-
// return claim;
146-
// }
147-
148101
/**
149102
* @notice Gets the next stake claim in the linked list
150103
* @dev This function is used as a callback in the stake claims linked list traversal.
@@ -154,8 +107,4 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
154107
function _getNextStakeClaim(bytes32 _claimId) private view returns (bytes32) {
155108
return claims[_claimId].nextClaim;
156109
}
157-
158-
// function _buildStakeClaimId(address serviceProvider, uint256 nonce) private view returns (bytes32) {
159-
// return keccak256(abi.encodePacked(address(this), serviceProvider, nonce));
160-
// }
161110
}

packages/subgraph-service/contracts/utilities/AllocationManager.sol

Lines changed: 0 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -203,35 +203,6 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
203203
bytes memory _allocationProof,
204204
uint32 _delegationRatio
205205
) 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-
235206
AllocationManagerLib.allocate(
236207
_allocations,
237208
_legacyAllocations,
@@ -286,77 +257,6 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
286257
uint32 _delegationRatio,
287258
address _paymentsDestination
288259
) 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-
360260
return
361261
AllocationManagerLib.presentPOI(
362262
_allocations,
@@ -446,30 +346,6 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
446346
* @param _forceClosed Whether the allocation was force closed
447347
*/
448348
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-
473349
AllocationManagerLib.closeAllocation(
474350
_allocations,
475351
allocationProvisionTracker,

0 commit comments

Comments
 (0)