Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use the correct interface for staking on contracts 5.x #111

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions packages/common-ts/src/contracts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { EpochManager } from '@graphprotocol/contracts/dist/types/EpochManager'
import { GNS } from '@graphprotocol/contracts/dist/types/GNS'
import { RewardsManager } from '@graphprotocol/contracts/dist/types/RewardsManager'
import { ServiceRegistry } from '@graphprotocol/contracts/dist/types/ServiceRegistry'
import { Staking } from '@graphprotocol/contracts/dist/types/Staking'
import { IL1Staking } from '@graphprotocol/contracts/dist/types/IL1Staking'
import { IL2Staking } from '@graphprotocol/contracts/dist/types/IL2Staking'
import { GraphToken } from '@graphprotocol/contracts/dist/types/GraphToken'
import { Controller } from '@graphprotocol/contracts/dist/types/Controller'
import { AllocationExchange } from '@graphprotocol/contracts/dist/types/AllocationExchange'
Expand All @@ -30,7 +31,8 @@ import { EpochManager__factory } from '@graphprotocol/contracts/dist/types/facto
import { GNS__factory } from '@graphprotocol/contracts/dist/types/factories/GNS__factory'
import { RewardsManager__factory } from '@graphprotocol/contracts/dist/types/factories/RewardsManager__factory'
import { ServiceRegistry__factory } from '@graphprotocol/contracts/dist/types/factories/ServiceRegistry__factory'
import { Staking__factory } from '@graphprotocol/contracts/dist/types/factories/Staking__factory'
import { IL1Staking__factory } from '@graphprotocol/contracts/dist/types/factories/IL1Staking__factory'
import { IL2Staking__factory } from '@graphprotocol/contracts/dist/types/factories/IL2Staking__factory'
import { GraphToken__factory } from '@graphprotocol/contracts/dist/types/factories/GraphToken__factory'
import { Controller__factory } from '@graphprotocol/contracts/dist/types/factories/Controller__factory'
import { AllocationExchange__factory } from '@graphprotocol/contracts/dist/types/factories/AllocationExchange__factory'
Expand All @@ -51,7 +53,7 @@ export interface NetworkContracts {
gns: GNS
rewardsManager: RewardsManager
serviceRegistry: ServiceRegistry
staking: Staking
staking: IL1Staking | IL2Staking
token: GraphToken | L2GraphToken
controller: Controller
allocationExchange: AllocationExchange
Expand Down Expand Up @@ -81,6 +83,10 @@ export const connectContracts = async (
? deployedContracts.GraphToken.address
: deployedContracts.L2GraphToken.address

const staking = GraphChain.isL1(chainId)
? IL1Staking__factory.connect(deployedContracts.L1Staking.address, providerOrSigner)
: IL2Staking__factory.connect(deployedContracts.L2Staking.address, providerOrSigner)

const contracts: NetworkContracts = {
curation: Curation__factory.connect(
deployedContracts.Curation.address,
Expand All @@ -103,10 +109,7 @@ export const connectContracts = async (
deployedContracts.ServiceRegistry.address,
providerOrSigner,
),
staking: Staking__factory.connect(
deployedContracts.Staking.address,
providerOrSigner,
),
staking: staking,
token: GraphTokenFactory.connect(graphTokenAddress, providerOrSigner),
controller: Controller__factory.connect(
deployedContracts.Controller.address,
Expand Down
Loading