@@ -15,6 +15,7 @@ import { Allocation } from "../libraries/Allocation.sol";
15
15
import { LegacyAllocation } from "../libraries/LegacyAllocation.sol " ;
16
16
import { PPMMath } from "@graphprotocol/horizon/contracts/libraries/PPMMath.sol " ;
17
17
import { ProvisionTracker } from "@graphprotocol/horizon/contracts/data-service/libraries/ProvisionTracker.sol " ;
18
+ import { AllocationManagerLib } from "../libraries/AllocationManagerLib.sol " ;
18
19
19
20
/**
20
21
* @title AllocationManager contract
@@ -204,34 +205,53 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
204
205
bytes memory _allocationProof ,
205
206
uint32 _delegationRatio
206
207
) internal {
207
- require (_allocationId != address (0 ), AllocationManagerInvalidZeroAllocationId ());
208
-
209
- _verifyAllocationProof (_indexer, _allocationId, _allocationProof);
210
-
211
- // Ensure allocation id is not reused
212
- // need to check both subgraph service (on allocations.create()) and legacy allocations
213
- _legacyAllocations.revertIfExists (_graphStaking (), _allocationId);
214
-
215
- uint256 currentEpoch = _graphEpochManager ().currentEpoch ();
216
- Allocation.State memory allocation = _allocations.create (
217
- _indexer,
218
- _allocationId,
219
- _subgraphDeploymentId,
220
- _tokens,
221
- _graphRewardsManager ().onSubgraphAllocationUpdate (_subgraphDeploymentId),
222
- currentEpoch
208
+ // require(_allocationId != address(0), AllocationManagerInvalidZeroAllocationId());
209
+
210
+ // _verifyAllocationProof(_indexer, _allocationId, _allocationProof);
211
+
212
+ // // Ensure allocation id is not reused
213
+ // // need to check both subgraph service (on allocations.create()) and legacy allocations
214
+ // _legacyAllocations.revertIfExists(_graphStaking(), _allocationId);
215
+
216
+ // uint256 currentEpoch = _graphEpochManager().currentEpoch();
217
+ // Allocation.State memory allocation = _allocations.create(
218
+ // _indexer,
219
+ // _allocationId,
220
+ // _subgraphDeploymentId,
221
+ // _tokens,
222
+ // _graphRewardsManager().onSubgraphAllocationUpdate(_subgraphDeploymentId),
223
+ // currentEpoch
224
+ // );
225
+
226
+ // // Check that the indexer has enough tokens available
227
+ // // Note that the delegation ratio ensures overdelegation cannot be used
228
+ // allocationProvisionTracker.lock(_graphStaking(), _indexer, _tokens, _delegationRatio);
229
+
230
+ // // Update total allocated tokens for the subgraph deployment
231
+ // _subgraphAllocatedTokens[allocation.subgraphDeploymentId] =
232
+ // _subgraphAllocatedTokens[allocation.subgraphDeploymentId] +
233
+ // allocation.tokens;
234
+
235
+ // emit AllocationCreated(_indexer, _allocationId, _subgraphDeploymentId, allocation.tokens, currentEpoch);
236
+
237
+ AllocationManagerLib.allocate (
238
+ _allocations,
239
+ _legacyAllocations,
240
+ allocationProvisionTracker,
241
+ _subgraphAllocatedTokens,
242
+ AllocationManagerLib.AllocateParams ({
243
+ _allocationId: _allocationId,
244
+ _allocationProof: _allocationProof,
245
+ _encodeAllocationProof: _encodeAllocationProof (_indexer, _allocationId),
246
+ _delegationRatio: _delegationRatio,
247
+ _indexer: _indexer,
248
+ _subgraphDeploymentId: _subgraphDeploymentId,
249
+ _tokens: _tokens,
250
+ currentEpoch: _graphEpochManager ().currentEpoch (),
251
+ graphRewardsManager: _graphRewardsManager (),
252
+ graphStaking: _graphStaking ()
253
+ })
223
254
);
224
-
225
- // Check that the indexer has enough tokens available
226
- // Note that the delegation ratio ensures overdelegation cannot be used
227
- allocationProvisionTracker.lock (_graphStaking (), _indexer, _tokens, _delegationRatio);
228
-
229
- // Update total allocated tokens for the subgraph deployment
230
- _subgraphAllocatedTokens[allocation.subgraphDeploymentId] =
231
- _subgraphAllocatedTokens[allocation.subgraphDeploymentId] +
232
- allocation.tokens;
233
-
234
- emit AllocationCreated (_indexer, _allocationId, _subgraphDeploymentId, allocation.tokens, currentEpoch);
235
255
}
236
256
237
257
/**
0 commit comments