Skip to content

Commit

Permalink
fix: Use LegacyAllocationAlreadyMigrated. (OZ N-02)
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonBoi9001 committed Sep 17, 2024
1 parent 9848954 commit f44e046
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,14 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
/**
* @notice Imports a legacy allocation id into the subgraph service
* This is a governor only action that is required to prevent indexers from re-using allocation ids from the
* legacy staking contract. It will revert if the allocation has already been migrated.
* legacy staking contract. It will revert with LegacyAllocationAlreadyMigrated if the allocation has already been migrated.
* @param _indexer The address of the indexer
* @param _allocationId The id of the allocation
* @param _subgraphDeploymentId The id of the subgraph deployment
* @custom:error LegacyAllocationMigrated if the allocation has already been migrated
*/
function _migrateLegacyAllocation(address _indexer, address _allocationId, bytes32 _subgraphDeploymentId) internal {
try legacyAllocations.migrate(_indexer, _allocationId, _subgraphDeploymentId) {
emit LegacyAllocationMigrated(_indexer, _allocationId, _subgraphDeploymentId);
} catch Error(string memory reason) {
revert(reason);
}
}
legacyAllocations.migrate(_indexer, _allocationId, _subgraphDeploymentId);
emit LegacyAllocationMigrated(_indexer, _allocationId, _subgraphDeploymentId);

/**
* @notice Create an allocation
Expand Down

0 comments on commit f44e046

Please sign in to comment.