1
1
import { ethers } from 'hardhat'
2
2
import { expect } from 'chai'
3
- import { HDNodeWallet } from 'ethers'
4
3
import hre from 'hardhat'
5
4
6
5
import { DisputeManager , IGraphToken , IHorizonStaking , IPaymentsEscrow , SubgraphService } from '../../../../typechain-types'
@@ -24,8 +23,8 @@ describe('Operator', () => {
24
23
25
24
// Test addresses
26
25
let indexer : SignerWithAddress
27
- let authorizedOperator : HDNodeWallet
28
- let unauthorizedOperator : HDNodeWallet
26
+ let authorizedOperator : SignerWithAddress
27
+ let unauthorizedOperator : SignerWithAddress
29
28
let allocationId : string
30
29
let subgraphDeploymentId : string
31
30
let allocationTokens : bigint
@@ -34,24 +33,14 @@ describe('Operator', () => {
34
33
const { provision } = graph . horizon . actions
35
34
const { collect, generateAllocationProof } = graph . subgraphService . actions
36
35
37
- before ( async ( ) => {
36
+ before ( ( ) => {
38
37
// Get contracts
39
38
subgraphService = graph . subgraphService . contracts . SubgraphService as unknown as SubgraphService
40
39
staking = graph . horizon . contracts . HorizonStaking as unknown as IHorizonStaking
41
40
graphToken = graph . horizon . contracts . GraphToken as unknown as IGraphToken
42
41
escrow = graph . horizon . contracts . PaymentsEscrow as unknown as IPaymentsEscrow
43
42
graphTallyCollector = graph . horizon . contracts . GraphTallyCollector as unknown as GraphTallyCollector
44
43
disputeManager = graph . subgraphService . contracts . DisputeManager as unknown as DisputeManager
45
-
46
- // Get signers
47
- authorizedOperator = ethers . Wallet . createRandom ( )
48
- authorizedOperator = authorizedOperator . connect ( ethers . provider )
49
- unauthorizedOperator = ethers . Wallet . createRandom ( )
50
- unauthorizedOperator = unauthorizedOperator . connect ( ethers . provider )
51
-
52
- // Set balances for authorized operator
53
- await ethers . provider . send ( 'hardhat_setBalance' , [ authorizedOperator . address , '0x56BC75E2D63100000' ] )
54
- await ethers . provider . send ( 'hardhat_setBalance' , [ unauthorizedOperator . address , '0x56BC75E2D63100000' ] )
55
44
} )
56
45
57
46
beforeEach ( async ( ) => {
@@ -67,8 +56,11 @@ describe('Operator', () => {
67
56
describe ( 'New indexer' , ( ) => {
68
57
beforeEach ( async ( ) => {
69
58
// Get indexer
70
- const signers = await ethers . getSigners ( )
71
- indexer = await ethers . getSigner ( signers [ 19 ] . address )
59
+ [ indexer , authorizedOperator , unauthorizedOperator ] = await graph . accounts . getTestAccounts ( )
60
+
61
+ // Set balances for operators
62
+ await ethers . provider . send ( 'hardhat_setBalance' , [ authorizedOperator . address , '0x56BC75E2D63100000' ] )
63
+ await ethers . provider . send ( 'hardhat_setBalance' , [ unauthorizedOperator . address , '0x56BC75E2D63100000' ] )
72
64
73
65
// Create provision
74
66
const disputePeriod = await disputeManager . getDisputePeriod ( )
@@ -124,6 +116,8 @@ describe('Operator', () => {
124
116
// Get indexer
125
117
const indexerFixture = indexers [ 0 ]
126
118
indexer = await ethers . getSigner ( indexerFixture . address )
119
+
120
+ ; [ authorizedOperator , unauthorizedOperator ] = await graph . accounts . getTestAccounts ( )
127
121
} )
128
122
129
123
describe ( 'New allocation' , ( ) => {
0 commit comments