Skip to content
Merged
Show file tree
Hide file tree
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
48 changes: 22 additions & 26 deletions config/arbitrumSepoliaAddressScript.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
import * as fs from 'fs'
import * as mustache from 'mustache'
import * as networkAddresses from '@graphprotocol/contracts/addresses.json'
import * as horizonAddresses from '@graphprotocol/address-book/horizon/addresses.json'
import * as subgraphServiceAddresses from '@graphprotocol/address-book/subgraph-service/addresses.json'
import { Addresses } from './addresses.template'

// mustache doesn't like numbered object keys
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let renameAddresses: any = networkAddresses
renameAddresses['arbsep'] = networkAddresses['421614']
let renameHorizonAddresses: any = horizonAddresses
renameHorizonAddresses['arbsep'] = horizonAddresses['421614']

// eslint-disable-next-line @typescript-eslint/no-explicit-any
let renameSubgraphServiceAddresses: any = subgraphServiceAddresses
renameSubgraphServiceAddresses['arbsep'] = subgraphServiceAddresses['421614']

const combinedAddresses = {
arbsep: {
...renameHorizonAddresses['arbsep'],
...renameSubgraphServiceAddresses['arbsep']
}
}

export let addresses: Addresses = {
controller: '{{arbsep.Controller.address}}',
graphToken: '{{arbsep.L2GraphToken.address}}',
epochManager: '{{arbsep.EpochManager.address}}',
disputeManager: '{{arbsep.DisputeManager.address}}',
horizonDisputeManager: '{{arbsep.HorizonDisputeManager.address}}',
staking: '{{arbsep.L2Staking.address}}',
stakingExtension: '{{arbsep.StakingExtension.address}}',
disputeManager: '{{arbsep.LegacyDisputeManager.address}}',
horizonDisputeManager: '{{arbsep.DisputeManager.address}}',
staking: '{{arbsep.HorizonStaking.address}}',
stakingExtension: '{{arbsep.HorizonStaking.address}}',
curation: '{{arbsep.L2Curation.address}}',
rewardsManager: '{{arbsep.RewardsManager.address}}',
serviceRegistry: '{{arbsep.ServiceRegistry.address}}',
serviceRegistry: '{{arbsep.LegacyServiceRegistry.address}}',
gns: '{{arbsep.L2GNS.address}}',
ens: '{{arbsep.IENS.address}}',
ensPublicResolver: '{{arbsep.IPublicResolver.address}}',
Expand All @@ -39,7 +51,7 @@ export let addresses: Addresses = {

const main = (): void => {
try {
let output = JSON.parse(mustache.render(JSON.stringify(addresses), renameAddresses))
let output = JSON.parse(mustache.render(JSON.stringify(addresses), combinedAddresses))
output.blockNumber = '570450'
output.bridgeBlockNumber = '570450'
output.network = 'arbitrum-sepolia'
Expand All @@ -50,26 +62,10 @@ const main = (): void => {
if(output.ethereumDIDRegistry == '') {
output.ethereumDIDRegistry = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
}
// remove once we have proper packages
if(output.subgraphService == '') {
output.subgraphService = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
}
if(output.graphPayments == '') {
output.graphPayments = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
}
if(output.horizonDisputeManager == '') {
output.horizonDisputeManager = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
}
if(output.paymentsEscrow == '') {
output.paymentsEscrow = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
}
if(output.graphTallyCollector == '') {
output.graphTallyCollector = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
}
fs.writeFileSync(__dirname + '/generatedAddresses.json', JSON.stringify(output, null, 2))
} catch (e) {
console.log(`Error saving artifacts: ${e.message}`)
}
}

main()
main()
46 changes: 21 additions & 25 deletions config/mainnetArbitrumAddressScript.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
import * as fs from 'fs'
import * as mustache from 'mustache'
import * as networkAddresses from '@graphprotocol/contracts/addresses.json'
import * as horizonAddresses from '@graphprotocol/address-book/horizon/addresses.json'
import * as subgraphServiceAddresses from '@graphprotocol/address-book/subgraph-service/addresses.json'
import { Addresses } from './addresses.template'

// mustache doesn't like numbered object keys
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let renameAddresses: any = networkAddresses
renameAddresses['arbitrum'] = networkAddresses['42161']
let renameHorizonAddresses: any = horizonAddresses
renameHorizonAddresses['arbitrum'] = horizonAddresses['42161'] || {}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
let renameSubgraphServiceAddresses: any = subgraphServiceAddresses
renameSubgraphServiceAddresses['arbitrum'] = subgraphServiceAddresses['42161'] || {}

const combinedAddresses = {
arbitrum: {
...renameHorizonAddresses['arbitrum'],
...renameSubgraphServiceAddresses['arbitrum']
}
}

export let addresses: Addresses = {
controller: '{{arbitrum.Controller.address}}',
graphToken: '{{arbitrum.L2GraphToken.address}}',
epochManager: '{{arbitrum.EpochManager.address}}',
disputeManager: '{{arbitrum.DisputeManager.address}}',
horizonDisputeManager: '{{arbitrum.HorizonDisputeManager.address}}',
staking: '{{arbitrum.L2Staking.address}}',
stakingExtension: '{{arbitrum.StakingExtension.address}}',
staking: '{{arbitrum.HorizonStaking.address}}',
stakingExtension: '{{arbitrum.HorizonStaking.address}}',
curation: '{{arbitrum.L2Curation.address}}',
rewardsManager: '{{arbitrum.RewardsManager.address}}',
serviceRegistry: '{{arbitrum.ServiceRegistry.address}}',
serviceRegistry: '{{arbitrum.LegacyServiceRegistry.address}}',
gns: '{{arbitrum.L2GNS.address}}',
ens: '{{arbitrum.IENS.address}}',
ensPublicResolver: '{{arbitrum.IPublicResolver.address}}',
Expand All @@ -39,38 +51,22 @@ export let addresses: Addresses = {

const main = (): void => {
try {
let output = JSON.parse(mustache.render(JSON.stringify(addresses), renameAddresses))
let output = JSON.parse(mustache.render(JSON.stringify(addresses), combinedAddresses))
output.blockNumber = '42440000' // Hardcoded a few thousand blocks before 1st contract deployed
output.network = 'arbitrum-one'
output.bridgeBlockNumber = '42449749' // Bridge deployment block on L2
output.tokenLockManager = '0xFCf78AC094288D7200cfdB367A8CD07108dFa128'
output.useTokenLockManager = false
if(output.ethereumDIDRegistry == '') {
output.ethereumDIDRegistry = '0xdCa7EF03e98e0DC2B855bE647C39ABe984fcF21B' // since the package doens't have it yet
output.ethereumDIDRegistry = '0xdCa7EF03e98e0DC2B855bE647C39ABe984fcF21B' // since the package doesn't have it yet
}
if(output.ens == '') {
output.ens = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
}
// remove once we have proper packages
if(output.subgraphService == '') {
output.subgraphService = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
}
if(output.graphPayments == '') {
output.graphPayments = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
}
if(output.horizonDisputeManager == '') {
output.horizonDisputeManager = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
}
if(output.paymentsEscrow == '') {
output.paymentsEscrow = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
}
if(output.graphTallyCollector == '') {
output.graphTallyCollector = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
}
fs.writeFileSync(__dirname + '/generatedAddresses.json', JSON.stringify(output, null, 2))
} catch (e) {
console.log(`Error saving artifacts: ${e.message}`)
}
}

main()
main()
22 changes: 17 additions & 5 deletions config/testAddressesL1.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
import * as fs from 'fs'
import * as mustache from 'mustache'
import * as networkAddresses from '@graphprotocol/contracts/addresses.json'
import * as horizonAddresses from '@graphprotocol/address-book/horizon/addresses.json'

Check failure on line 3 in config/testAddressesL1.ts

View workflow job for this annotation

GitHub Actions / deploy

Cannot find module '@graphprotocol/address-book/horizon/addresses.json' or its corresponding type declarations.
import * as subgraphServiceAddresses from '@graphprotocol/address-book/subgraph-service/addresses.json'

Check failure on line 4 in config/testAddressesL1.ts

View workflow job for this annotation

GitHub Actions / deploy

Cannot find module '@graphprotocol/address-book/subgraph-service/addresses.json' or its corresponding type declarations.
import { Addresses } from './addresses.template'

// mustache doesn't like numbered object keys
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let renameAddresses: any = networkAddresses
renameAddresses['mainnet'] = networkAddresses['1']
let renameHorizonAddresses: any = horizonAddresses
renameHorizonAddresses['mainnet'] = horizonAddresses['1'] || {}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
let renameSubgraphServiceAddresses: any = subgraphServiceAddresses
renameSubgraphServiceAddresses['mainnet'] = subgraphServiceAddresses['1'] || {}

const combinedAddresses = {
mainnet: {
...renameHorizonAddresses['mainnet'],
...renameSubgraphServiceAddresses['mainnet']
}
}

export let addresses: Addresses = {
controller: '0x0000000000000000000000000000000000000001',
Expand Down Expand Up @@ -39,7 +51,7 @@

const main = (): void => {
try {
let output = JSON.parse(mustache.render(JSON.stringify(addresses), renameAddresses))
let output = JSON.parse(mustache.render(JSON.stringify(addresses), combinedAddresses))
output.blockNumber = '0' // Hardcoded a few thousand blocks before 1st contract deployed
output.network = 'mainnet'
output.bridgeBlockNumber = '0' // Bridge deployment block on L1
Expand All @@ -54,4 +66,4 @@
}
}

main()
main()
24 changes: 18 additions & 6 deletions config/testAddressesL2.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
import * as fs from 'fs'
import * as mustache from 'mustache'
import * as networkAddresses from '@graphprotocol/contracts/addresses.json'
import * as horizonAddresses from '@graphprotocol/address-book/horizon/addresses.json'

Check failure on line 3 in config/testAddressesL2.ts

View workflow job for this annotation

GitHub Actions / deploy

Cannot find module '@graphprotocol/address-book/horizon/addresses.json' or its corresponding type declarations.
import * as subgraphServiceAddresses from '@graphprotocol/address-book/subgraph-service/addresses.json'

Check failure on line 4 in config/testAddressesL2.ts

View workflow job for this annotation

GitHub Actions / deploy

Cannot find module '@graphprotocol/address-book/subgraph-service/addresses.json' or its corresponding type declarations.
import { Addresses } from './addresses.template'

// mustache doesn't like numbered object keys
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let renameAddresses: any = networkAddresses
renameAddresses['arbitrum'] = networkAddresses['42161']
let renameHorizonAddresses: any = horizonAddresses
renameHorizonAddresses['arbitrum'] = horizonAddresses['42161'] || {}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
let renameSubgraphServiceAddresses: any = subgraphServiceAddresses
renameSubgraphServiceAddresses['arbitrum'] = subgraphServiceAddresses['42161'] || {}

const combinedAddresses = {
arbitrum: {
...renameHorizonAddresses['arbitrum'],
...renameSubgraphServiceAddresses['arbitrum']
}
}

export let addresses: Addresses = {
controller: '0x0000000000000000000000000000000000000001',
Expand Down Expand Up @@ -39,14 +51,14 @@

const main = (): void => {
try {
let output = JSON.parse(mustache.render(JSON.stringify(addresses), renameAddresses))
let output = JSON.parse(mustache.render(JSON.stringify(addresses), combinedAddresses))
output.blockNumber = '0' // Hardcoded a few thousand blocks before 1st contract deployed
output.network = 'arbitrum-one'
output.bridgeBlockNumber = '0' // Bridge deployment block on L2
output.tokenLockManager = '0x0000000000000000000000000000000000000000'
output.useTokenLockManager = false
if(output.ethereumDIDRegistry == '') {
output.ethereumDIDRegistry = '0x0000000000000000000000000000000000000000' // since the package doens't have it yet
output.ethereumDIDRegistry = '0x0000000000000000000000000000000000000000' // since the package doesn't have it yet
}
if(output.ens == '') {
output.ens = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
Expand All @@ -57,4 +69,4 @@
}
}

main()
main()
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"prepare:test-l2": "yarn && yarn prep:addresses:test:l2 && mustache ./config/generatedAddresses.json subgraph.template.yaml > subgraph.yaml && graph codegen --output-dir src/types/"
},
"devDependencies": {
"@graphprotocol/address-book": "0.1.0",
"@graphprotocol/contracts": "6.2.0",
"@graphprotocol/graph-cli": "0.97.0",
"@graphprotocol/graph-ts": "0.36.0",
Expand Down
2 changes: 1 addition & 1 deletion src/mappings/helpers/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ export function createOrLoadGraphNetwork(
graphNetwork.curationImplementations = []
graphNetwork.staking = Address.fromString(addresses.staking)
graphNetwork.stakingImplementations = []
graphNetwork.disputeManager = Address.fromString(addresses.disputeManager)
graphNetwork.disputeManager = Address.fromString(addresses.horizonDisputeManager)
graphNetwork.gns = Address.fromString(addresses.gns)
graphNetwork.serviceRegistry = Address.fromString(addresses.serviceRegistry)
graphNetwork.rewardsManager = Address.fromString(addresses.rewardsManager)
Expand Down
Loading
Loading