From 02d3cc75728d0048eb7a315b7512ffb31ed81450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Migone?= Date: Mon, 10 Feb 2025 16:54:56 -0300 Subject: [PATCH] feat: add isStaleAllocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Migone --- packages/subgraph-service/contracts/SubgraphService.sol | 7 +++++++ .../contracts/interfaces/ISubgraphService.sol | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/packages/subgraph-service/contracts/SubgraphService.sol b/packages/subgraph-service/contracts/SubgraphService.sol index f43669133..b1eecb469 100644 --- a/packages/subgraph-service/contracts/SubgraphService.sol +++ b/packages/subgraph-service/contracts/SubgraphService.sol @@ -463,6 +463,13 @@ contract SubgraphService is return _encodeAllocationProof(indexer, allocationId); } + /** + * @notice See {ISubgraphService.isStaleAllocation} + */ + function isStaleAllocation(address allocationId) external view override returns (bool) { + return _allocations.get(allocationId).isStale(maxPOIStaleness); + } + /** * @notice See {ISubgraphService.isOverAllocated} */ diff --git a/packages/subgraph-service/contracts/interfaces/ISubgraphService.sol b/packages/subgraph-service/contracts/interfaces/ISubgraphService.sol index da04b48ee..7639ed4fb 100644 --- a/packages/subgraph-service/contracts/interfaces/ISubgraphService.sol +++ b/packages/subgraph-service/contracts/interfaces/ISubgraphService.sol @@ -241,6 +241,13 @@ interface ISubgraphService is IDataServiceFees { */ function encodeAllocationProof(address indexer, address allocationId) external view returns (bytes32); + /** + * @notice Checks if an allocation is stale + * @param allocationId The id of the allocation + * @return True if the allocation is stale, false otherwise + */ + function isStaleAllocation(address allocationId) external view returns (bool); + /** * @notice Checks if an indexer is over-allocated * @param allocationId The id of the allocation