Skip to content

Commit f7342e5

Browse files
tmigonejuanmardefago
authored andcommitted
chore: use split address book on localnetwork script
Signed-off-by: Tomás Migone <[email protected]>
1 parent f664900 commit f7342e5

File tree

1 file changed

+27
-24
lines changed

1 file changed

+27
-24
lines changed

config/localNetworkAddressScript.ts

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,40 @@
11
import * as fs from 'fs'
22
import * as mustache from 'mustache'
33
// Replace with proper imports once the packages are published
4-
import * as networkAddresses from '/opt/contracts.json'
4+
import * as horizonAddresses from '/opt/horizon.json'
5+
import * as subgraphServiceAddresses from '/opt/subgraph-service.json'
56
import { Addresses } from './addresses.template'
67

78
// mustache doesn't like numbered object keys
89
// eslint-disable-next-line @typescript-eslint/no-explicit-any
9-
let renameAddresses: any = networkAddresses
10-
renameAddresses['localnetwork'] = networkAddresses['1337']
10+
let renameAddresses: any = {
11+
horizon: horizonAddresses['1337'],
12+
subgraphService: subgraphServiceAddresses['1337'],
13+
}
1114

1215
export let addresses: Addresses = {
13-
controller: '{{localnetwork.Controller.address}}',
14-
graphToken: '{{localnetwork.L2GraphToken.address}}',
15-
epochManager: '{{localnetwork.EpochManager.address}}',
16-
disputeManager: '{{localnetwork.DisputeManager.address}}',
17-
staking: '{{localnetwork.HorizonStaking.address}}',
18-
stakingExtension: '{{localnetwork.HorizonStaking.address}}',
19-
curation: '{{localnetwork.L2Curation.address}}',
20-
rewardsManager: '{{localnetwork.RewardsManager.address}}',
16+
controller: '{{horizon.Controller.address}}',
17+
graphToken: '{{horizon.L2GraphToken.address}}',
18+
epochManager: '{{horizon.EpochManager.address}}',
19+
disputeManager: '{{subgraphService.DisputeManager.address}}',
20+
staking: '{{horizon.HorizonStaking.address}}',
21+
stakingExtension: '{{horizon.HorizonStaking.address}}',
22+
curation: '{{horizon.L2Curation.address}}',
23+
rewardsManager: '{{horizon.RewardsManager.address}}',
2124
serviceRegistry: '0x0000000000000000000000000000000000000000',
22-
gns: '{{localnetwork.L2GNS.address}}',
23-
ens: '{{localnetwork.IENS.address}}',
24-
ensPublicResolver: '{{localnetwork.IPublicResolver.address}}',
25+
gns: '{{horizon.L2GNS.address}}',
26+
ens: '{{horizon.IENS.address}}',
27+
ensPublicResolver: '{{horizon.IPublicResolver.address}}',
2528
blockNumber: '',
2629
bridgeBlockNumber: '',
2730
network: '',
2831
tokenLockManager: '',
29-
subgraphNFT: '{{localnetwork.SubgraphNFT.address}}',
32+
subgraphNFT: '{{horizon.SubgraphNFT.address}}',
3033
l1GraphTokenGateway: '',
31-
l2GraphTokenGateway: '{{localnetwork.L2GraphTokenGateway.address}}',
32-
ethereumDIDRegistry: '{{localnetwork.EthereumDIDRegistry.address}}',
33-
subgraphService: '{{localnetwork.SubgraphService.address}}',
34-
graphPayments: '{{localnetwork.GraphPayments.address}}',
34+
l2GraphTokenGateway: '{{horizon.L2GraphTokenGateway.address}}',
35+
ethereumDIDRegistry: '{{horizon.EthereumDIDRegistry.address}}',
36+
subgraphService: '{{subgraphService.SubgraphService.address}}',
37+
graphPayments: '{{horizon.GraphPayments.address}}',
3538
isL1: false,
3639
}
3740

@@ -48,12 +51,12 @@ const main = (): void => {
4851
if(output.ethereumDIDRegistry == '') {
4952
output.ethereumDIDRegistry = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
5053
}
51-
// remove once we have proper packages
52-
if(output.subgraphService == '') {
53-
output.subgraphService = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
54+
// TODO: Remove this once subgraph service scripts deploy GNS and SubgraphNFT
55+
if(output.gns == '') {
56+
output.gns = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
5457
}
55-
if(output.graphPayments == '') {
56-
output.graphPayments = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
58+
if(output.subgraphNFT == '') {
59+
output.subgraphNFT = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
5760
}
5861
fs.writeFileSync(__dirname + '/generatedAddresses.json', JSON.stringify(output, null, 2))
5962
} catch (e) {

0 commit comments

Comments
 (0)