Skip to content

Commit 5f707a8

Browse files
committed
chore: update subgraph service to work wiht latest interfaces
Signed-off-by: Tomás Migone <[email protected]>
1 parent 62eb5aa commit 5f707a8

33 files changed

+284
-101
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,6 @@ tx-builder-*.json
8484
**/subgraph-service-localhost/
8585
**/subgraph-service-hardhat/
8686
!**/ignition/**/artifacts/
87+
88+
89+
!packages/interfaces/src/types/

packages/horizon/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"exports": {
1212
"./artifacts/*": "./build/contracts/*",
1313
"./addresses*": "./addresses*",
14-
"./ignition": "./ignition/modules/index.ts"
14+
"./ignition": "./ignition/modules/index.ts",
15+
"./tasks/*": "./tasks/*"
1516
},
1617
"files": [
1718
"build/contracts/**/*",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.27;
3+
4+
/// @title IOwnable
5+
/// @notice Interface for Ownable contracts
6+
interface IOwnable {
7+
/// @notice Returns the address of the current owner
8+
function owner() external view returns (address);
9+
10+
/// @notice Leaves the contract without an owner
11+
function renounceOwnership() external;
12+
13+
/// @notice Transfers ownership of the contract to a new account
14+
/// @param newOwner The address of the new owner
15+
function transferOwnership(address newOwner) external;
16+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.27;
3+
4+
/// @title IPausable
5+
/// @notice Interface for Pausable contract
6+
interface IPausable {
7+
/// @notice Returns true if the contract is paused, and false otherwise
8+
function paused() external view returns (bool);
9+
10+
/**
11+
* @notice Pauses the contract
12+
*/
13+
function pause() external;
14+
15+
/**
16+
* @notice Unpauses the contract
17+
*/
18+
function unpause() external;
19+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
pragma solidity 0.8.27;
3+
4+
import { IDisputeManager } from "../subgraph-service/IDisputeManager.sol";
5+
import { IOwnable } from "../subgraph-service/internal/IOwnable.sol";
6+
7+
interface IDisputeManagerToolshed is IDisputeManager, IOwnable {
8+
/**
9+
* @notice Get the dispute period.
10+
* @return Dispute period in seconds
11+
*/
12+
function disputePeriod() external view returns (uint64);
13+
14+
/**
15+
* @notice Get the fisherman reward cut.
16+
* @return Fisherman reward cut in percentage (ppm)
17+
*/
18+
function fishermanRewardCut() external view returns (uint32);
19+
20+
/**
21+
* @notice Get the maximum percentage that can be used for slashing indexers.
22+
* @return Max percentage slashing for disputes
23+
*/
24+
function maxSlashingCut() external view returns (uint32);
25+
26+
/**
27+
* @notice Get the dispute deposit.
28+
* @return Dispute deposit
29+
*/
30+
function disputeDeposit() external view returns (uint256);
31+
32+
/**
33+
* @notice Get the subgraph service address.
34+
* @return Subgraph service address
35+
*/
36+
function subgraphService() external view returns (address);
37+
38+
/**
39+
* @notice Get the arbitrator address.
40+
* @return Arbitrator address
41+
*/
42+
function arbitrator() external view returns (address);
43+
44+
/**
45+
* @notice Get the dispute status.
46+
* @param disputeId The dispute ID
47+
* @return Dispute status
48+
*/
49+
function disputes(bytes32 disputeId) external view returns (IDisputeManager.Dispute memory);
50+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// SPDX-License-Identifier: GPL-3.0-or-later
2+
pragma solidity 0.8.27;
3+
4+
import { IGraphTallyCollector } from "../horizon/IGraphTallyCollector.sol";
5+
6+
interface IGraphTallyCollectorToolshed is IGraphTallyCollector {
7+
function authorizations(address signer) external view returns (Authorization memory);
8+
function tokensCollected(
9+
address serviceProvider,
10+
bytes32 collectionId,
11+
address receiver,
12+
address payer
13+
) external view returns (uint256);
14+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// SPDX-License-Identifier: GPL-3.0-or-later
2+
pragma solidity 0.8.27;
3+
4+
import { IPaymentsEscrow } from "../horizon/IPaymentsEscrow.sol";
5+
6+
interface IPaymentsEscrowToolshed is IPaymentsEscrow {
7+
function escrowAccounts(
8+
address payer,
9+
address collector,
10+
address receiver
11+
) external view returns (EscrowAccount memory);
12+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// SPDX-License-Identifier: GPL-3.0-or-later
2+
pragma solidity 0.8.27;
3+
4+
import { ISubgraphService } from "../subgraph-service/ISubgraphService.sol";
5+
import { IOwnable } from "../subgraph-service/internal/IOwnable.sol";
6+
import { IPausable } from "../subgraph-service/internal/IPausable.sol";
7+
8+
interface ISubgraphServiceToolshed is ISubgraphService, IOwnable, IPausable {
9+
/**
10+
* @notice Gets the indexer details
11+
* @param indexer The address of the indexer
12+
* @return The indexer details
13+
*/
14+
function indexers(address indexer) external view returns (Indexer memory);
15+
16+
/**
17+
* @notice Gets the allocation provision tracker
18+
* @param indexer The address of the indexer
19+
* @return The allocation provision tracker
20+
*/
21+
function allocationProvisionTracker(address indexer) external view returns (uint256);
22+
23+
/**
24+
* @notice Gets the stake to fees ratio
25+
* @return The stake to fees ratio
26+
*/
27+
function stakeToFeesRatio() external view returns (uint256);
28+
29+
/**
30+
* @notice Gets the max POI staleness
31+
* @return The max POI staleness
32+
*/
33+
function maxPOIStaleness() external view returns (uint256);
34+
35+
/**
36+
* @notice Gets the curation fees cut
37+
* @return The curation fees cut
38+
*/
39+
function curationFeesCut() external view returns (uint256);
40+
41+
/**
42+
* @notice Gets the pause guardians
43+
* @param pauseGuardian The address of the pause guardian
44+
* @return The allowed status of the pause guardian
45+
*/
46+
function pauseGuardians(address pauseGuardian) external view returns (bool);
47+
48+
/**
49+
* @notice Gets the payments destination
50+
* @param indexer The address of the indexer
51+
* @return The payments destination
52+
*/
53+
function paymentsDestination(address indexer) external view returns (address);
54+
}

packages/interfaces/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"version": "0.1.0",
44
"description": "Contract interfaces for The Graph protocol",
55
"main": "./dist/src/index.js",
6-
"types": "./dist/types/index.d.ts",
6+
"types": "./dist/src/index.d.ts",
77
"exports": {
88
".": {
99
"default": "./dist/src/index.js",
10-
"types": "./dist/types/index.d.ts"
10+
"types": "./dist/src/index.d.ts"
1111
}
1212
},
1313
"files": [

packages/interfaces/src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { ContractRunner, Interface } from 'ethers'
22

33
import { factories } from '../types'
44

5-
export * from '../types'
5+
export * from './types/horizon'
6+
export * from './types/subgraph-service'
67

78
/**
89
* Interface representing a static contract factory with methods to create interfaces and connect to contracts
@@ -150,12 +151,16 @@ export function collectFactoriesMap(obj: unknown): Record<string, ContractFactor
150151
function getContractNameAlternatives(contractName: string): string[] {
151152
const nameOverrides: Record<string, string> = {
152153
Controller: 'ControllerToolshed',
154+
DisputeManager: 'DisputeManagerToolshed',
153155
EpochManager: 'EpochManagerToolshed',
154156
GNS: 'GNSToolshed',
157+
GraphTallyCollector: 'GraphTallyCollectorToolshed',
155158
HorizonStaking: 'HorizonStakingToolshed',
156159
L2Curation: 'L2CurationToolshed',
160+
PaymentsEscrow: 'PaymentsEscrowToolshed',
157161
RewardsManager: 'RewardsManagerToolshed',
158162
ServiceRegistry: 'ServiceRegistryToolshed',
163+
SubgraphService: 'SubgraphServiceToolshed',
159164
}
160165

161166
if (nameOverrides[contractName]) {

0 commit comments

Comments
 (0)