Skip to content

Commit 2c94da4

Browse files
committed
chore: final changes to use interfaces package
Signed-off-by: Tomás Migone <[email protected]>
1 parent 5f707a8 commit 2c94da4

34 files changed

+149
-67
lines changed

packages/horizon/tasks/test/seed.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { generateLegacyAllocationProof, randomAllocationMetadata } from '@graphprotocol/toolshed'
2+
import { delegators, indexers } from '@graphprotocol/toolshed/fixtures'
23
import { requireLocalNetwork, setGRTBalance } from '@graphprotocol/toolshed/hardhat'
34
import { printBanner } from '@graphprotocol/toolshed/utils'
45
import { task } from 'hardhat/config'
56

6-
import { delegators } from './fixtures/delegators'
7-
import { indexers } from './fixtures/indexers'
8-
97
task('test:seed', 'Sets up some protocol state for testing').setAction(async (_, hre) => {
108
printBanner('PROTOCOL STATE SETUP')
119

packages/horizon/test/integration/after-transition-period/delegator.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { ONE_MILLION, ZERO_ADDRESS } from '@graphprotocol/toolshed'
2+
import { delegators } from '@graphprotocol/toolshed/fixtures'
23
import { setGRTBalance } from '@graphprotocol/toolshed/hardhat'
34
import type { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers'
45
import { expect } from 'chai'
56
import hre from 'hardhat'
67
import { ethers } from 'hardhat'
78

8-
import { delegators } from '../../../tasks/test/fixtures/delegators'
9-
109
describe('Delegator', () => {
1110
let delegator: HardhatEthersSigner
1211
let serviceProvider: HardhatEthersSigner

packages/horizon/test/integration/after-transition-period/service-provider.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { ONE_MILLION, PaymentTypes } from '@graphprotocol/toolshed'
2+
import { indexers } from '@graphprotocol/toolshed/fixtures'
23
import { setGRTBalance } from '@graphprotocol/toolshed/hardhat'
34
import type { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers'
45
import { expect } from 'chai'
56
import hre from 'hardhat'
67
import { ethers } from 'hardhat'
78

8-
import { indexers } from '../../../tasks/test/fixtures/indexers'
9-
109
describe('Service provider', () => {
1110
let verifier: string
1211
const thawingPeriod = 2419200n

packages/horizon/test/integration/during-transition-period/delegator.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { ZERO_ADDRESS } from '@graphprotocol/toolshed'
2+
import { delegators } from '@graphprotocol/toolshed/fixtures'
23
import type { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers'
34
import { expect } from 'chai'
45
import hre from 'hardhat'
56
import { ethers } from 'hardhat'
67

7-
import { delegators } from '../../../tasks/test/fixtures/delegators'
8-
98
describe('Delegator', () => {
109
let snapshotId: string
1110

packages/horizon/test/integration/during-transition-period/operator.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { generatePOI } from '@graphprotocol/toolshed'
2+
import { indexers } from '@graphprotocol/toolshed/fixtures'
23
import { getEventData } from '@graphprotocol/toolshed/hardhat'
34
import type { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers'
45
import { expect } from 'chai'
56
import hre from 'hardhat'
67
import { ethers } from 'hardhat'
78

8-
import { indexers } from '../../../tasks/test/fixtures/indexers'
9-
109
describe('Operator', () => {
1110
let snapshotId: string
1211

packages/horizon/test/integration/during-transition-period/permissionless.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { generatePOI } from '@graphprotocol/toolshed'
2+
import { indexers } from '@graphprotocol/toolshed/fixtures'
23
import type { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers'
34
import { expect } from 'chai'
45
import hre from 'hardhat'
56
import { ethers } from 'hardhat'
67

7-
import { indexers } from '../../../tasks/test/fixtures/indexers'
8-
98
describe('Permissionless', () => {
109
let snapshotId: string
1110

packages/horizon/test/integration/during-transition-period/service-provider.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { generatePOI, ONE_MILLION } from '@graphprotocol/toolshed'
2+
import { indexers } from '@graphprotocol/toolshed/fixtures'
23
import { getEventData, setGRTBalance } from '@graphprotocol/toolshed/hardhat'
34
import type { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers'
45
import { expect } from 'chai'
56
import hre from 'hardhat'
67
import { ethers } from 'hardhat'
78

8-
import { indexers } from '../../../tasks/test/fixtures/indexers'
9-
109
describe('Service Provider', () => {
1110
let snapshotId: string
1211

packages/horizon/test/integration/during-transition-period/slasher.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1+
import { indexers } from '@graphprotocol/toolshed/fixtures'
12
import type { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers'
23
import { expect } from 'chai'
34
import hre from 'hardhat'
45
import { ethers } from 'hardhat'
56

6-
import { indexers } from '../../../tasks/test/fixtures/indexers'
7-
87
describe('Slasher', () => {
98
let snapshotId: string
109

packages/interfaces/README.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,66 @@
11
# @graphprotocol/interfaces
22

3-
Contract interfaces for The Graph protocol.
3+
Contract interfaces and types for The Graph protocol.
44

55
## Overview
66

7-
This package contains interfaces used in dependent packages, which makes building systems that interact with Balancer contracts simpler, as the implementation information is not included.
7+
This package contains contract interfaces and types used in dependent packages, which makes building systems that interact with The Graph contracts simpler, as the implementation information is not included.
88

99
## Installation
1010

1111
```bash
1212
pnpm add @graphprotocol/interfaces
1313
```
14+
15+
## Usage
16+
17+
### Contract interfaces
18+
19+
Solidity contract interfaces can be imported from `@graphprotocol/interfaces/contracts/...`:
20+
21+
```solidity
22+
pragma solidity 0.8.27;
23+
24+
import { IGraphPayments } from "@graphprotocol/interfaces/contracts/horizon/IGraphPayments.sol";
25+
26+
contract GraphPayments is IGraphPayments {
27+
...
28+
}
29+
```
30+
31+
Note that contracts in the `toolshed/` directory are not meant to be imported by Solidity code, they only exist to
32+
generate complete TypeScript types.
33+
34+
### TypeScript types
35+
36+
This package provides types generated with [Typechain](https://github.com/dethcrypto/TypeChain) compatible with ethers v6. To use them import with:
37+
38+
```ts
39+
import {
40+
GraphPayments,
41+
GraphTallyCollector,
42+
HorizonStaking,
43+
L2GraphToken,
44+
PaymentsEscrow,
45+
SubgraphService,
46+
} from '@graphprotocol/interfaces'
47+
```
48+
49+
### TypeScript library
50+
51+
Additionally, the package exposes a few helper functions to facilitate the creation of fully typed ethers v6 contracts:
52+
53+
| Function Name | Description |
54+
| -------------------- | ----------------------------------------------------------- |
55+
| `getInterface` | Retrieves the contract interface for a given contract name. |
56+
| `getMergedInterface` | Loads and merges interfaces from multiple contract names. |
57+
| `getAbi` | Gets the ABI for a given contract name. |
58+
59+
```ts
60+
import {
61+
getInterface,
62+
SubgraphService
63+
} from '@graphprotocol/interfaces
64+
65+
const subgraphService = new ethers.Contract('0x12...90', getInterface('SubgraphService')) as SubgraphService
66+
```

packages/interfaces/contracts/toolshed/IDisputeManagerToolshed.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity 0.8.27;
33

44
import { IDisputeManager } from "../subgraph-service/IDisputeManager.sol";
5-
import { IOwnable } from "../subgraph-service/internal/IOwnable.sol";
5+
import { IOwnable } from "./internal/IOwnable.sol";
66

77
interface IDisputeManagerToolshed is IDisputeManager, IOwnable {
88
/**

0 commit comments

Comments
 (0)