Skip to content

Commit 03a174a

Browse files
Source protocol contracts page from @graphprotocol/address-book
Drive the Arbitrum One and Arbitrum Sepolia contract tables from the @graphprotocol/address-book package (horizon, subgraph-service, issuance) so Horizon-era deployments stay current with each release bump. Ethereum Mainnet and Sepolia continue to be sourced from @graphprotocol/contracts. Page is organized network-first with per-product sub-tables on Arbitrum. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTTzmumskQuqnV1PoaTnpV
1 parent 937f82d commit 03a174a

3 files changed

Lines changed: 80 additions & 13 deletions

File tree

website/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"@edgeandnode/gds": "^6.9.0",
2323
"@edgeandnode/go": "^10.5.1",
2424
"@emotion/react": "^11.14.0",
25+
"@graphprotocol/address-book": "^1.2.0",
2526
"@graphprotocol/contracts": "^7.3.0",
2627
"@pinax/graph-networks-registry": "^0.7.1",
2728
"@react-hookz/web": "^25.2.0",

website/src/contracts.tsx

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import ContractAddresses from '@graphprotocol/contracts/addresses.json'
2+
import HorizonAddresses from '@graphprotocol/address-book/horizon/addresses.json'
3+
import IssuanceAddresses from '@graphprotocol/address-book/issuance/addresses.json'
4+
import SubgraphServiceAddresses from '@graphprotocol/address-book/subgraph-service/addresses.json'
25

36
import { getAddressLink } from '@edgeandnode/common'
47
import { ExperimentalLink } from '@edgeandnode/gds'
@@ -7,14 +10,38 @@ import { Table } from '@/components'
710
import { useI18n } from '@/i18n'
811

912
type ValueOf<T> = T[keyof T]
13+
14+
/**
15+
* Legacy protocol contracts (Ethereum Mainnet, Sepolia) sourced from `@graphprotocol/contracts`.
16+
* The new Horizon deployments on Arbitrum live in `@graphprotocol/address-book` (see below).
17+
*/
1018
const contractsByNetworkId = ContractAddresses as Record<string, ValueOf<typeof ContractAddresses>>
1119

12-
export function ProtocolContractsTable({ networkId }: { networkId: number }) {
20+
/**
21+
* Horizon-era contracts (Arbitrum One, Arbitrum Sepolia) sourced from `@graphprotocol/address-book`.
22+
* Each package file is keyed by chain ID, then by contract name. Reading straight from the package
23+
* means new deployments are picked up automatically whenever the dependency is bumped.
24+
*/
25+
type AddressBookEntry = { address: string }
26+
type AddressBook = Record<string, Record<string, AddressBookEntry>>
27+
28+
export const addressBookPackages = {
29+
horizon: HorizonAddresses as AddressBook,
30+
'subgraph-service': SubgraphServiceAddresses as AddressBook,
31+
issuance: IssuanceAddresses as AddressBook,
32+
}
33+
34+
export type AddressBookPackage = keyof typeof addressBookPackages
35+
36+
/** Shared name + address table used by both the legacy and address-book sources. */
37+
function ContractsTable({
38+
networkId,
39+
contracts,
40+
}: {
41+
networkId: number
42+
contracts: { name: string; address: string }[]
43+
}) {
1344
const { t } = useI18n()
14-
const contracts = Object.entries(contractsByNetworkId[`${networkId}`] ?? {}).map(([name, contract]) => ({
15-
...contract,
16-
name,
17-
}))
1845
return (
1946
<Table>
2047
<tbody>
@@ -34,3 +61,22 @@ export function ProtocolContractsTable({ networkId }: { networkId: number }) {
3461
</Table>
3562
)
3663
}
64+
65+
/** Legacy protocol contracts for a given network, from `@graphprotocol/contracts`. */
66+
export function ProtocolContractsTable({ networkId }: { networkId: number }) {
67+
const contracts = Object.entries(contractsByNetworkId[`${networkId}`] ?? {}).map(([name, contract]) => ({
68+
name,
69+
address: contract.address,
70+
}))
71+
return <ContractsTable networkId={networkId} contracts={contracts} />
72+
}
73+
74+
/** Horizon-era contracts for a given network and package, from `@graphprotocol/address-book`. */
75+
export function HorizonContractsTable({ networkId, product }: { networkId: number; product: AddressBookPackage }) {
76+
const contracts = Object.entries(addressBookPackages[product][`${networkId}`] ?? {}).map(([name, contract]) => ({
77+
name,
78+
address: contract.address,
79+
}))
80+
if (contracts.length === 0) return null
81+
return <ContractsTable networkId={networkId} contracts={contracts} />
82+
}

website/src/pages/en/contracts.mdx

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,48 @@
22
title: Protocol Contracts
33
---
44

5-
import { ProtocolContractsTable } from '@/contracts'
5+
import { HorizonContractsTable, ProtocolContractsTable } from '@/contracts'
66

7-
Below are the deployed contracts which power The Graph Network. Visit the official [contracts repository](https://github.com/graphprotocol/contracts) to learn more.
7+
Below are the deployed contracts which power The Graph Network. The Arbitrum contracts are sourced directly from the [`@graphprotocol/address-book`](https://www.npmjs.com/package/@graphprotocol/address-book) package, so they stay current with each release. Visit the official [contracts repository](https://github.com/graphprotocol/contracts) to learn more.
88

99
## Arbitrum One
1010

1111
This is the principal deployment of The Graph Network.
1212

13-
<ProtocolContractsTable networkId={42161} />
13+
### Horizon
1414

15-
## Ethereum Mainnet
15+
<HorizonContractsTable networkId={42161} product="horizon" />
1616

17-
This was the original deployment of The Graph Network. Learn more about The Graph's scaling with Arbitrum.
17+
### Subgraph Service
1818

19-
<ProtocolContractsTable networkId={1} />
19+
<HorizonContractsTable networkId={42161} product="subgraph-service" />
20+
21+
### Issuance
22+
23+
<HorizonContractsTable networkId={42161} product="issuance" />
2024

2125
## Arbitrum Sepolia
2226

2327
This is the primary testnet for The Graph Network. Testnet is predominantly used by core developers and ecosystem participants for testing purposes. There are no guarantees of service or availability on The Graph's testnets.
2428

25-
<ProtocolContractsTable networkId={421614} />
29+
### Horizon
30+
31+
<HorizonContractsTable networkId={421614} product="horizon" />
32+
33+
### Subgraph Service
34+
35+
<HorizonContractsTable networkId={421614} product="subgraph-service" />
36+
37+
### Issuance
38+
39+
<HorizonContractsTable networkId={421614} product="issuance" />
40+
41+
## Ethereum Mainnet
42+
43+
This was the original deployment of The Graph Network. Learn more about The Graph's scaling with Arbitrum.
44+
45+
<ProtocolContractsTable networkId={1} />
2646

27-
## Sepolia
47+
## Ethereum Sepolia
2848

2949
<ProtocolContractsTable networkId={11155111} />

0 commit comments

Comments
 (0)