Skip to content

Commit 32aeaf3

Browse files
committed
feat: added arbitrum one deployment config
1 parent 1ca8046 commit 32aeaf3

File tree

6 files changed

+69
-56
lines changed

6 files changed

+69
-56
lines changed

.github/workflows/deploy-arbitrum-goerli-subgraph.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Testnet Subgraph L2 (Arbitrum-Goerli)
33
on:
44
push:
55
branches:
6-
- arbitrum
6+
- mainnet-staging
77

88
jobs:
99
deploy:

.github/workflows/deploy-rinkeby-subgraph.yaml renamed to .github/workflows/deploy-production-arbitrum-subgraph.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: Testnet Subgraph (Rinkeby)
1+
name: Production Subgraph (Arbitrum One)
22

33
on:
44
push:
5-
branches:
6-
- mainnet-staging
5+
tags:
6+
- v*
77

88
jobs:
99
deploy:
@@ -27,9 +27,9 @@ jobs:
2727
NODE_AUTH_TOKEN: ${{secrets.graphprotocol_npm_token}}
2828

2929
# Run scripts
30-
- name: Prepare addresses rinkeby
31-
run: ./node_modules/.bin/ts-node config/rinkebyAddressScript.ts && ./node_modules/.bin/mustache ./config/generatedAddresses.json ./config/addresses.template.ts > ./config/addresses.ts
32-
- name: Prepare rinkeby
30+
- name: Prepare addresses mainnet
31+
run: ./node_modules/.bin/ts-node config/mainnetAddressScript.ts && ./node_modules/.bin/mustache ./config/generatedAddresses.json ./config/addresses.template.ts > ./config/addresses.ts
32+
- name: Prepare mainnet
3333
run: ./node_modules/.bin/mustache ./config/generatedAddresses.json subgraph.template.yaml > subgraph.yaml && ./node_modules/@graphprotocol/graph-cli/bin/graph codegen --output-dir src/types/
34-
- name: Deploy to testnet rinkeby
35-
run: ./node_modules/@graphprotocol/graph-cli/bin/graph deploy graphprotocol/graph-network-analytics-testnet --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --access-token ${{secrets.access_token}}
34+
- name: Deploy to mainnet production
35+
run: ./node_modules/@graphprotocol/graph-cli/bin/graph deploy graphprotocol/graph-network-analytics --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --access-token ${{secrets.access_token}}

config/arbitrumAddressScript.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import * as fs from 'fs'
2+
import * as mustache from 'mustache'
3+
import * as networkAddresses from '@graphprotocol/contracts/addresses.json'
4+
import { Addresses } from './addresses.template'
5+
6+
// mustache doesn't like numbered object keys
7+
let renameAddresses: any = networkAddresses
8+
renameAddresses['arbitrum'] = networkAddresses['42161']
9+
10+
export let addresses: Addresses = {
11+
controller: '{{arbitrum.Controller.address}}',
12+
graphToken: '{{arbitrum.GraphToken.address}}',
13+
epochManager: '{{arbitrum.EpochManager.address}}',
14+
disputeManager: '{{arbitrum.DisputeManager.address}}',
15+
staking: '{{arbitrum.Staking.address}}',
16+
curation: '{{arbitrum.Curation.address}}',
17+
rewardsManager: '{{arbitrum.RewardsManager.address}}',
18+
serviceRegistry: '{{arbitrum.ServiceRegistry.address}}',
19+
gns: '{{arbitrum.GNS.address}}',
20+
ens: '{{arbitrum.IENS.address}}',
21+
ensPublicResolver: '{{arbitrum.IPublicResolver.address}}',
22+
blockNumber: '',
23+
network: '',
24+
subgraphNFT: '{{arbitrum.SubgraphNFT.address}}',
25+
}
26+
27+
const main = (): void => {
28+
try {
29+
let output = JSON.parse(mustache.render(JSON.stringify(addresses), renameAddresses))
30+
output.blockNumber = '42440000' // Hardcoded a few thousand blocks before 1st contract deployed
31+
output.network = 'arbitrum-one'
32+
fs.writeFileSync(__dirname + '/generatedAddresses.json', JSON.stringify(output, null, 2))
33+
} catch (e) {
34+
console.log(`Error saving artifacts: ${e.message}`)
35+
}
36+
}
37+
38+
main()

config/rinkebyAddressScript.ts

Lines changed: 0 additions & 38 deletions
This file was deleted.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,24 @@
1616
"build:ipfs:mainnet": "yarn && yarn prepare:mainnet && graph build --ipfs https://ipfs.network.thegraph.com",
1717
"deploy-mainnet-staging": "yarn && yarn prepare:mainnet && graph deploy graphprotocol/graph-network-analytics-staging --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
1818
"deploy-mainnet": "yarn && yarn prepare:mainnet && graph deploy graphprotocol/graph-network-analytics --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
19-
"deploy-rinkeby": "yarn && yarn prepare:rinkeby && graph deploy graphprotocol/graph-network-analytics-testnet --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
19+
"deploy-arbitrum": "yarn && yarn prepare:arbitrum && graph deploy graphprotocol/graph-analytics-arbitrum --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
2020
"deploy-goerli": "yarn && yarn prepare:goerli && graph deploy graphprotocol/graph-network-analytics-goerli --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
21-
"deploy-testing": "yarn && yarn prepare:arb-goerli && graph deploy juanmardefago/dev-subgraph2 --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
22-
"prep:addresses:rinkeby": "ts-node config/rinkebyAddressScript.ts && mustache ./config/generatedAddresses.json ./config/addresses.template.ts > ./config/addresses.ts",
23-
"prepare:rinkeby": "yarn prep:addresses:rinkeby && mustache ./config/generatedAddresses.json subgraph.template.yaml > subgraph.yaml && graph codegen --output-dir src/types/",
21+
"deploy-testing": "yarn && yarn prepare:arbitrum && graph deploy graphprotocol/graph-analytics-arbitrum --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
2422
"prep:addresses:goerli": "ts-node config/goerliAddressScript.ts && mustache ./config/generatedAddresses.json ./config/addresses.template.ts > ./config/addresses.ts",
2523
"prepare:goerli": "yarn prep:addresses:goerli && mustache ./config/generatedAddresses.json subgraph.template.yaml > subgraph.yaml && graph codegen --output-dir src/types/",
2624
"prep:addresses:arb-goerli": "ts-node config/goerliArbitrumAddressScript.ts && mustache ./config/generatedAddresses.json ./config/addresses.template.ts > ./config/addresses.ts",
2725
"prepare:arb-goerli": "yarn prep:addresses:arb-goerli && mustache ./config/generatedAddresses.json subgraph.template.yaml > subgraph.yaml && graph codegen --output-dir src/types/",
2826
"prep:addresses:mainnet": "ts-node config/mainnetAddressScript.ts && mustache ./config/generatedAddresses.json ./config/addresses.template.ts > ./config/addresses.ts",
2927
"prepare:mainnet": "yarn prep:addresses:mainnet && mustache ./config/generatedAddresses.json subgraph.template.yaml > subgraph.yaml && graph codegen --output-dir src/types/",
28+
"prep:addresses:arbitrum": "ts-node config/arbitrumAddressScript.ts && mustache ./config/generatedAddresses.json ./config/addresses.template.ts > ./config/addresses.ts",
29+
"prepare:arbitrum": "yarn prep:addresses:arbitrum && mustache ./config/generatedAddresses.json subgraph.template.yaml > subgraph.yaml && graph codegen --output-dir src/types/",
3030
"lint": "yarn eslint .",
3131
"lint-fix": "eslint . --fix",
3232
"prettier": "prettier '**/*.ts'",
3333
"prettier-write": "prettier --write '**/*.ts'"
3434
},
3535
"devDependencies": {
36-
"@graphprotocol/contracts": "l2-testnet",
36+
"@graphprotocol/contracts": "2.3.0",
3737
"@graphprotocol/graph-cli": "^0.25.1",
3838
"@graphprotocol/graph-ts": "^0.24.1",
3939
"@types/node": "^14.0.13",

yarn.lock

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,12 @@
387387
"@ethersproject/properties" "^5.7.0"
388388
"@ethersproject/strings" "^5.7.0"
389389

390-
"@graphprotocol/contracts@l2-testnet":
391-
version "2.0.0-testnet"
392-
resolved "https://registry.yarnpkg.com/@graphprotocol/contracts/-/contracts-2.0.0-testnet.tgz#95f3156a03bffc754f523240bf47801a4cbc7eca"
393-
integrity sha512-ZJ/dxGeSnN4cFI7HGUcU2HBe7hZtNat/5UX2B4f27sQyfV9IJBcXy+6wBugn97rmZFPGj3yk7K1PMvJVVOFKpA==
390+
"@graphprotocol/contracts@2.3.0":
391+
version "2.3.0"
392+
resolved "https://registry.yarnpkg.com/@graphprotocol/contracts/-/contracts-2.3.0.tgz#dfc648732e2bfe1cba66bc26ba7dfa9b81d62a3b"
393+
integrity sha512-o+XfVC5EusLcs6ge5dFqvOQZOCX4NBSABjKeiAcSb1wqd2/gl/JWjXBbmofATKorLMpDm6HjE/H37NxCipvWFQ==
394394
dependencies:
395+
console-table-printer "^2.11.1"
395396
ethers "^5.6.0"
396397

397398
"@graphprotocol/graph-cli@^0.25.1":
@@ -1183,6 +1184,13 @@ concat-stream@~1.6.2:
11831184
readable-stream "^2.2.2"
11841185
typedarray "^0.0.6"
11851186

1187+
console-table-printer@^2.11.1:
1188+
version "2.11.1"
1189+
resolved "https://registry.yarnpkg.com/console-table-printer/-/console-table-printer-2.11.1.tgz#c2dfe56e6343ea5bcfa3701a4be29fe912dbd9c7"
1190+
integrity sha512-8LfFpbF/BczoxPwo2oltto5bph8bJkGOATXsg3E9ddMJOGnWJciKHldx2zDj5XIBflaKzPfVCjOTl6tMh7lErg==
1191+
dependencies:
1192+
simple-wcswidth "^1.0.1"
1193+
11861194
11871195
version "1.0.2"
11881196
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
@@ -3367,6 +3375,11 @@ signed-varint@^2.0.1:
33673375
dependencies:
33683376
varint "~5.0.0"
33693377

3378+
simple-wcswidth@^1.0.1:
3379+
version "1.0.1"
3380+
resolved "https://registry.yarnpkg.com/simple-wcswidth/-/simple-wcswidth-1.0.1.tgz#8ab18ac0ae342f9d9b629604e54d2aa1ecb018b2"
3381+
integrity sha512-xMO/8eNREtaROt7tJvWJqHBDTMFN4eiQ5I4JRMuilwfnFcV5W9u7RUkueNkdw0jPqGMX36iCywelS5yilTuOxg==
3382+
33703383
slice-ansi@^4.0.0:
33713384
version "4.0.0"
33723385
resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b"

0 commit comments

Comments
 (0)