Skip to content

Commit 01f9ee9

Browse files
pcarranzavtilacog
authored andcommitted
fix: use the correct interface for staking on contracts 5.x
1 parent aa17ccf commit 01f9ee9

File tree

1 file changed

+10
-7
lines changed
  • packages/common-ts/src/contracts

1 file changed

+10
-7
lines changed

packages/common-ts/src/contracts/index.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import { EpochManager } from '@graphprotocol/contracts/dist/types/EpochManager'
1111
import { GNS } from '@graphprotocol/contracts/dist/types/GNS'
1212
import { RewardsManager } from '@graphprotocol/contracts/dist/types/RewardsManager'
1313
import { ServiceRegistry } from '@graphprotocol/contracts/dist/types/ServiceRegistry'
14-
import { Staking } from '@graphprotocol/contracts/dist/types/Staking'
14+
import { IL1Staking } from '@graphprotocol/contracts/dist/types/IL1Staking'
15+
import { IL2Staking } from '@graphprotocol/contracts/dist/types/IL2Staking'
1516
import { GraphToken } from '@graphprotocol/contracts/dist/types/GraphToken'
1617
import { Controller } from '@graphprotocol/contracts/dist/types/Controller'
1718
import { AllocationExchange } from '@graphprotocol/contracts/dist/types/AllocationExchange'
@@ -30,7 +31,8 @@ import { EpochManager__factory } from '@graphprotocol/contracts/dist/types/facto
3031
import { GNS__factory } from '@graphprotocol/contracts/dist/types/factories/GNS__factory'
3132
import { RewardsManager__factory } from '@graphprotocol/contracts/dist/types/factories/RewardsManager__factory'
3233
import { ServiceRegistry__factory } from '@graphprotocol/contracts/dist/types/factories/ServiceRegistry__factory'
33-
import { Staking__factory } from '@graphprotocol/contracts/dist/types/factories/Staking__factory'
34+
import { IL1Staking__factory } from '@graphprotocol/contracts/dist/types/factories/IL1Staking__factory'
35+
import { IL2Staking__factory } from '@graphprotocol/contracts/dist/types/factories/IL2Staking__factory'
3436
import { GraphToken__factory } from '@graphprotocol/contracts/dist/types/factories/GraphToken__factory'
3537
import { Controller__factory } from '@graphprotocol/contracts/dist/types/factories/Controller__factory'
3638
import { AllocationExchange__factory } from '@graphprotocol/contracts/dist/types/factories/AllocationExchange__factory'
@@ -51,7 +53,7 @@ export interface NetworkContracts {
5153
gns: GNS
5254
rewardsManager: RewardsManager
5355
serviceRegistry: ServiceRegistry
54-
staking: Staking
56+
staking: IL1Staking | IL2Staking
5557
token: GraphToken | L2GraphToken
5658
controller: Controller
5759
allocationExchange: AllocationExchange
@@ -81,6 +83,10 @@ export const connectContracts = async (
8183
? deployedContracts.GraphToken.address
8284
: deployedContracts.L2GraphToken.address
8385

86+
const staking = GraphChain.isL1(chainId)
87+
? IL1Staking__factory.connect(deployedContracts.L1Staking.address, providerOrSigner)
88+
: IL2Staking__factory.connect(deployedContracts.L2Staking.address, providerOrSigner)
89+
8490
const contracts: NetworkContracts = {
8591
curation: Curation__factory.connect(
8692
deployedContracts.Curation.address,
@@ -103,10 +109,7 @@ export const connectContracts = async (
103109
deployedContracts.ServiceRegistry.address,
104110
providerOrSigner,
105111
),
106-
staking: Staking__factory.connect(
107-
deployedContracts.Staking.address,
108-
providerOrSigner,
109-
),
112+
staking: staking,
110113
token: GraphTokenFactory.connect(graphTokenAddress, providerOrSigner),
111114
controller: Controller__factory.connect(
112115
deployedContracts.Controller.address,

0 commit comments

Comments
 (0)