11import * as fs from 'fs'
22import * as mustache from 'mustache'
3- import * as networkAddresses from '@graphprotocol/contracts/addresses.json'
3+ import * as horizonAddresses from '@graphprotocol/address-book/horizon/addresses.json'
4+ import * as subgraphServiceAddresses from '@graphprotocol/address-book/subgraph-service/addresses.json'
45import { Addresses } from './addresses.template'
56
67// mustache doesn't like numbered object keys
78// eslint-disable-next-line @typescript-eslint/no-explicit-any
8- let renameAddresses : any = networkAddresses
9- renameAddresses [ 'arbitrum' ] = networkAddresses [ '42161' ]
9+ let renameHorizonAddresses : any = horizonAddresses
10+ renameHorizonAddresses [ 'arbitrum' ] = horizonAddresses [ '42161' ] || { }
11+
12+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13+ let renameSubgraphServiceAddresses : any = subgraphServiceAddresses
14+ renameSubgraphServiceAddresses [ 'arbitrum' ] = subgraphServiceAddresses [ '42161' ] || { }
15+
16+ const combinedAddresses = {
17+ arbitrum : {
18+ ...renameHorizonAddresses [ 'arbitrum' ] ,
19+ ...renameSubgraphServiceAddresses [ 'arbitrum' ]
20+ }
21+ }
1022
1123export let addresses : Addresses = {
1224 controller : '{{arbitrum.Controller.address}}' ,
1325 graphToken : '{{arbitrum.L2GraphToken.address}}' ,
1426 epochManager : '{{arbitrum.EpochManager.address}}' ,
1527 disputeManager : '{{arbitrum.DisputeManager.address}}' ,
1628 horizonDisputeManager : '{{arbitrum.HorizonDisputeManager.address}}' ,
17- staking : '{{arbitrum.L2Staking .address}}' ,
18- stakingExtension : '{{arbitrum.StakingExtension .address}}' ,
29+ staking : '{{arbitrum.HorizonStaking .address}}' ,
30+ stakingExtension : '{{arbitrum.HorizonStaking .address}}' ,
1931 curation : '{{arbitrum.L2Curation.address}}' ,
2032 rewardsManager : '{{arbitrum.RewardsManager.address}}' ,
21- serviceRegistry : '{{arbitrum.ServiceRegistry .address}}' ,
33+ serviceRegistry : '{{arbitrum.LegacyServiceRegistry .address}}' ,
2234 gns : '{{arbitrum.L2GNS.address}}' ,
2335 ens : '{{arbitrum.IENS.address}}' ,
2436 ensPublicResolver : '{{arbitrum.IPublicResolver.address}}' ,
@@ -39,38 +51,22 @@ export let addresses: Addresses = {
3951
4052const main = ( ) : void => {
4153 try {
42- let output = JSON . parse ( mustache . render ( JSON . stringify ( addresses ) , renameAddresses ) )
54+ let output = JSON . parse ( mustache . render ( JSON . stringify ( addresses ) , combinedAddresses ) )
4355 output . blockNumber = '42440000' // Hardcoded a few thousand blocks before 1st contract deployed
4456 output . network = 'arbitrum-one'
4557 output . bridgeBlockNumber = '42449749' // Bridge deployment block on L2
4658 output . tokenLockManager = '0xFCf78AC094288D7200cfdB367A8CD07108dFa128'
4759 output . useTokenLockManager = false
4860 if ( output . ethereumDIDRegistry == '' ) {
49- output . ethereumDIDRegistry = '0xdCa7EF03e98e0DC2B855bE647C39ABe984fcF21B' // since the package doens 't have it yet
61+ output . ethereumDIDRegistry = '0xdCa7EF03e98e0DC2B855bE647C39ABe984fcF21B' // since the package doesn 't have it yet
5062 }
5163 if ( output . ens == '' ) {
5264 output . ens = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
5365 }
54- // remove once we have proper packages
55- if ( output . subgraphService == '' ) {
56- output . subgraphService = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
57- }
58- if ( output . graphPayments == '' ) {
59- output . graphPayments = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
60- }
61- if ( output . horizonDisputeManager == '' ) {
62- output . horizonDisputeManager = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
63- }
64- if ( output . paymentsEscrow == '' ) {
65- output . paymentsEscrow = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
66- }
67- if ( output . graphTallyCollector == '' ) {
68- output . graphTallyCollector = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
69- }
7066 fs . writeFileSync ( __dirname + '/generatedAddresses.json' , JSON . stringify ( output , null , 2 ) )
7167 } catch ( e ) {
7268 console . log ( `Error saving artifacts: ${ e . message } ` )
7369 }
7470}
7571
76- main ( )
72+ main ( )
0 commit comments