Skip to content
Closed
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
5 changes: 5 additions & 0 deletions .changeset/horizon-curation-addresses.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/address-book': minor
---

Add the GraphCurationToken and SubgraphNFTDescriptor addresses for Arbitrum One and Arbitrum Sepolia to the horizon address book.
5 changes: 5 additions & 0 deletions .changeset/subgraph-discovery-initial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/subgraph-discovery': major
---

Publish the discovery and curation contracts (L2GNS, L2Curation, GNS, SubgraphNFT, SubgraphNFTDescriptor and GraphCurationToken) as `@graphprotocol/subgraph-discovery`.
5 changes: 5 additions & 0 deletions .changeset/toolshed-tenderly-sources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/toolshed': minor
---

`TenderlyConfig.externalArtifacts` is now an array of `{ source, buildInfo }`, so artifacts can be copied from several packages.
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ on:
- contracts
- graph-core
- graph-token
- subgraph-discovery
- interfaces
- toolshed
tag:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ wagmi/
packages/contracts/types/
packages/graph-core/types/
packages/graph-token/types/
packages/subgraph-discovery/types/
packages/interfaces/types/
packages/token-distribution/types/
packages/issuance/types/
Expand Down
24 changes: 24 additions & 0 deletions packages/address-book/src/horizon/addresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@
"SubgraphNFT": {
"address": "0x3FbD54f0cc17b7aE649008dEEA12ed7D2622B23f"
},
"GraphCurationToken": {
"address": "0x47a0d56ea574419B524285d52fFe7198297D209c",
"creationCodeHash": "0x1ee42ee271cefe20c33c0de904501e618ac4b56debca67c634d0564cecea9ff2",
"runtimeCodeHash": "0x340e8f378c0117b300f3ec255bc5c3a273f9ab5bd2940fa8eb3b5065b21f86dc",
"txHash": "0x382568f1871a3d57f4d3787b255a2364e9926cb6770fdca3cde6cb04b577ecd5"
},
"SubgraphNFTDescriptor": {
"address": "0x96cce9b6489744630A058324FB22e7CD02815ebe",
"creationCodeHash": "0xf16e8ff11d852eea165195ac9e0dfa00f98e48f6ce3c77c469c7df9bf195b651",
"runtimeCodeHash": "0x39583196f2bcb85789b6e64692d8c0aa56f001c46f0ca3d371abbba2c695860f",
"txHash": "0xbb01566726e1d58825cf7aa2860f0f571ff47f92b3837aad0e73e7791fbca48c"
},
"RewardsManager": {
"address": "0x971B9d3d0Ae3ECa029CAB5eA1fB0F72c85e6a525",
"proxy": "graph",
Expand Down Expand Up @@ -183,6 +195,18 @@
"SubgraphNFT": {
"address": "0xF21Df5BbA7EB9b54D8F60C560aFb9bA63e6aED1A"
},
"GraphCurationToken": {
"address": "0x00FBd5D46FFAc54862c1Dd27BE08924BB17f5CDa",
"creationCodeHash": "0x1ee42ee271cefe20c33c0de904501e618ac4b56debca67c634d0564cecea9ff2",
"runtimeCodeHash": "0x340e8f378c0117b300f3ec255bc5c3a273f9ab5bd2940fa8eb3b5065b21f86dc",
"txHash": "0x045d64dc3ebb7ae6c4976854ce0a797a04524d22a6ef5f526bfc27f744bc68e5"
},
"SubgraphNFTDescriptor": {
"address": "0x4032F7B6b27FfC9862106f826379DaB1716C71d7",
"creationCodeHash": "0xf16e8ff11d852eea165195ac9e0dfa00f98e48f6ce3c77c469c7df9bf195b651",
"runtimeCodeHash": "0x39583196f2bcb85789b6e64692d8c0aa56f001c46f0ca3d371abbba2c695860f",
"txHash": "0xb7e7aeeecc693f34f491b01c56950533119810a4e3e2642081efc127f11cb782"
},
"RewardsManager": {
"address": "0x1F49caE7669086c8ba53CC35d1E9f80176d67E79",
"proxy": "graph",
Expand Down
4 changes: 2 additions & 2 deletions packages/deployment/lib/contract-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const HORIZON_CONTRACTS = {
lifecycleActions: ['deploy', 'upgrade', 'configure', 'transfer'],
},
L2Curation: {
artifact: { type: 'contracts', path: 'l2/curation', name: 'L2Curation' },
artifact: { type: 'subgraph-discovery', path: 'l2/curation', name: 'L2Curation' },
proxyType: 'graph',
proxyAdminName: 'GraphProxyAdmin',
prerequisite: true,
Expand All @@ -202,7 +202,7 @@ const HORIZON_CONTRACTS = {
componentTag: ComponentTags.PAYMENTS_ESCROW,
},
L2GNS: {
artifact: { type: 'contracts', path: 'l2/discovery', name: 'L2GNS' },
artifact: { type: 'subgraph-discovery', path: 'l2/discovery', name: 'L2GNS' },
proxyType: 'graph',
proxyAdminName: 'GraphProxyAdmin',
prerequisite: true,
Expand Down
1 change: 1 addition & 0 deletions packages/deployment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@graphprotocol/interfaces": "workspace:*",
"@graphprotocol/issuance": "workspace:*",
"@graphprotocol/subgraph-service": "workspace:*",
"@graphprotocol/subgraph-discovery": "workspace:*",
"@graphprotocol/toolshed": "workspace:*",
"@rocketh/core": "^0.17.8",
"ethers": "^6.15.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/deployment/test/bytecode-comparison.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ describe('Deploy Implementation Helper', function () {
})

it('should load different contracts with correct paths', function () {
const l2Curation = loadContractsArtifact('l2/curation', 'L2Curation')
const l2Curation = loadPackageArtifact('subgraph-discovery', 'l2/curation', 'L2Curation')
expect(l2Curation.abi).to.be.an('array')
expect(l2Curation.bytecode).to.match(/^0x/)

Expand Down
24 changes: 24 additions & 0 deletions packages/horizon/addresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@
"SubgraphNFT": {
"address": "0x3FbD54f0cc17b7aE649008dEEA12ed7D2622B23f"
},
"GraphCurationToken": {
"address": "0x47a0d56ea574419B524285d52fFe7198297D209c",
"creationCodeHash": "0x1ee42ee271cefe20c33c0de904501e618ac4b56debca67c634d0564cecea9ff2",
"runtimeCodeHash": "0x340e8f378c0117b300f3ec255bc5c3a273f9ab5bd2940fa8eb3b5065b21f86dc",
"txHash": "0x382568f1871a3d57f4d3787b255a2364e9926cb6770fdca3cde6cb04b577ecd5"
},
"SubgraphNFTDescriptor": {
"address": "0x96cce9b6489744630A058324FB22e7CD02815ebe",
"creationCodeHash": "0xf16e8ff11d852eea165195ac9e0dfa00f98e48f6ce3c77c469c7df9bf195b651",
"runtimeCodeHash": "0x39583196f2bcb85789b6e64692d8c0aa56f001c46f0ca3d371abbba2c695860f",
"txHash": "0xbb01566726e1d58825cf7aa2860f0f571ff47f92b3837aad0e73e7791fbca48c"
},
"RewardsManager": {
"address": "0x971B9d3d0Ae3ECa029CAB5eA1fB0F72c85e6a525",
"proxy": "graph",
Expand Down Expand Up @@ -183,6 +195,18 @@
"SubgraphNFT": {
"address": "0xF21Df5BbA7EB9b54D8F60C560aFb9bA63e6aED1A"
},
"GraphCurationToken": {
"address": "0x00FBd5D46FFAc54862c1Dd27BE08924BB17f5CDa",
"creationCodeHash": "0x1ee42ee271cefe20c33c0de904501e618ac4b56debca67c634d0564cecea9ff2",
"runtimeCodeHash": "0x340e8f378c0117b300f3ec255bc5c3a273f9ab5bd2940fa8eb3b5065b21f86dc",
"txHash": "0x045d64dc3ebb7ae6c4976854ce0a797a04524d22a6ef5f526bfc27f744bc68e5"
},
"SubgraphNFTDescriptor": {
"address": "0x4032F7B6b27FfC9862106f826379DaB1716C71d7",
"creationCodeHash": "0xf16e8ff11d852eea165195ac9e0dfa00f98e48f6ce3c77c469c7df9bf195b651",
"runtimeCodeHash": "0x39583196f2bcb85789b6e64692d8c0aa56f001c46f0ca3d371abbba2c695860f",
"txHash": "0xb7e7aeeecc693f34f491b01c56950533119810a4e3e2642081efc127f11cb782"
},
"RewardsManager": {
"address": "0x1F49caE7669086c8ba53CC35d1E9f80176d67E79",
"proxy": "graph",
Expand Down
2 changes: 1 addition & 1 deletion packages/horizon/ignition/modules/periphery/Curation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import CurationArtifact from '@graphprotocol/contracts/artifacts/contracts/l2/curation/L2Curation.sol/L2Curation.json'
import GraphCurationTokenArtifact from '@graphprotocol/contracts-7.3.0/artifacts/contracts/curation/GraphCurationToken.sol/GraphCurationToken.json'
import GraphProxyArtifact from '@graphprotocol/contracts-7.3.0/artifacts/contracts/upgrades/GraphProxy.sol/GraphProxy.json'
import GraphProxyAdminArtifact from '@graphprotocol/contracts-7.3.0/artifacts/contracts/upgrades/GraphProxyAdmin.sol/GraphProxyAdmin.json'
import CurationArtifact from '@graphprotocol/subgraph-discovery/artifacts/contracts/l2/curation/L2Curation.sol/L2Curation.json'
import { buildModule, IgnitionModuleBuilder } from '@nomicfoundation/ignition-core'

import { deployWithGraphProxy, upgradeGraphProxy } from '../proxy/GraphProxy'
Expand Down
2 changes: 1 addition & 1 deletion packages/horizon/ignition/modules/periphery/GNS.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import L2GNSArtifact from '@graphprotocol/contracts/artifacts/contracts/l2/discovery/L2GNS.sol/L2GNS.json'
import SubgraphNFTArtifact from '@graphprotocol/contracts-7.3.0/artifacts/contracts/discovery/SubgraphNFT.sol/SubgraphNFT.json'
import SubgraphNFTDescriptorArtifact from '@graphprotocol/contracts-7.3.0/artifacts/contracts/discovery/SubgraphNFTDescriptor.sol/SubgraphNFTDescriptor.json'
import L2GNSArtifact from '@graphprotocol/subgraph-discovery/artifacts/contracts/l2/discovery/L2GNS.sol/L2GNS.json'
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'

import { deployWithGraphProxy } from '../proxy/GraphProxy'
Expand Down
1 change: 1 addition & 0 deletions packages/horizon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@graphprotocol/graph-token": "workspace:^",
"@graphprotocol/contracts-7.3.0": "npm:@graphprotocol/contracts@7.3.0",
"@graphprotocol/interfaces": "workspace:^",
"@graphprotocol/subgraph-discovery": "workspace:^",
"@graphprotocol/toolshed": "workspace:^",
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
"@nomicfoundation/hardhat-ethers": "catalog:",
Expand Down
5 changes: 3 additions & 2 deletions packages/horizon/scripts/pre-verify
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ cp -r node_modules/@graphprotocol/contracts-7.3.0/artifacts/build-info/* build/c

# RewardsManager, L2Curation and L2GNS are deployed from live artifacts
cp -r ../contracts/artifacts/contracts/rewards/RewardsManager.sol build/contracts/contracts/rewards
cp -r ../contracts/artifacts/contracts/l2/curation/L2Curation.sol build/contracts/contracts/l2/curation
cp -r ../contracts/artifacts/contracts/l2/discovery/L2GNS.sol build/contracts/contracts/l2/discovery
cp -r ../subgraph-discovery/artifacts/contracts/l2/curation/L2Curation.sol build/contracts/contracts/l2/curation
cp -r ../subgraph-discovery/artifacts/contracts/l2/discovery/L2GNS.sol build/contracts/contracts/l2/discovery
cp -r ../subgraph-discovery/artifacts/build-info/* build/contracts/build-info
cp -r ../contracts/artifacts/build-info/* build/contracts/build-info

cp -r build/contracts/@openzeppelin/contracts/proxy/transparent/* build/contracts/contracts
Expand Down
14 changes: 10 additions & 4 deletions packages/horizon/tenderly.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@
"project": "horizon-arbitrum-one"
}
},
"externalArtifacts": {
"source": "../contracts/artifacts",
"buildInfo": "../contracts/artifacts/build-info"
},
"externalArtifacts": [
{
"source": "../subgraph-discovery/artifacts",
"buildInfo": "../subgraph-discovery/artifacts/build-info"
},
{
"source": "../contracts/artifacts",
"buildInfo": "../contracts/artifacts/build-info"
}
],
"verifyList": [
"HorizonStaking",
"GraphPayments",
Expand Down
3 changes: 3 additions & 0 deletions packages/subgraph-discovery/.solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./../../.solhint.json"
}
22 changes: 22 additions & 0 deletions packages/subgraph-discovery/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Subgraph Discovery

The Graph subgraph discovery and curation contracts: `L2GNS`, `L2Curation`, `GNS`, `SubgraphNFT`, `SubgraphNFTDescriptor`, `GraphCurationToken`, their storage contracts, `Multicall` and the `Base58Encoder` and `HexStrings` libraries.

`L2GNS` and `L2Curation` are the contracts deployed on Arbitrum. `GNS` is the abstract base of `L2GNS`; it is not what runs on Ethereum mainnet, where the L1 GNS implementation is held in `packages/legacy`.

The contracts compile with solc 0.7.6 (optimizer enabled, 200 runs).

## Usage

```solidity
import { L2GNS } from '@graphprotocol/subgraph-discovery/contracts/l2/discovery/L2GNS.sol';
```

Hardhat artifacts are published under `@graphprotocol/subgraph-discovery/artifacts/` and typechain types under `@graphprotocol/subgraph-discovery/types`.

## Development

```bash
pnpm build # compile with Hardhat
pnpm test:self # Foundry tests
```
12 changes: 9 additions & 3 deletions packages/subgraph-discovery/foundry.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
[profile.default]
src = 'test'
src = 'contracts'
out = 'forge-artifacts'
test = 'test'
libs = ["node_modules"]
cache_path = 'cache_forge'
auto_detect_remappings = false
remappings = [
"@graphprotocol/=node_modules/@graphprotocol/",
"@openzeppelin/=node_modules/@openzeppelin/",
"forge-std/=node_modules/forge-std/src/",
]
solc_version = '0.8.35'
evm_version = 'cancun'
fs_permissions = [{ access = "read", path = "node_modules/@graphprotocol/contracts/artifacts" }, { access = "read", path = "node_modules/@graphprotocol/graph-core/artifacts" }, { access = "read", path = "node_modules/@graphprotocol/graph-token/artifacts" }]
optimizer = true
optimizer_runs = 200
compilation_restrictions = [
{ paths = "contracts/**", version = "=0.7.6" },
{ paths = "test/**", version = "=0.8.35" },
]
fs_permissions = [{ access = "read", path = "artifacts" }, { access = "read", path = "node_modules/@graphprotocol/graph-core/artifacts" }, { access = "read", path = "node_modules/@graphprotocol/graph-token/artifacts" }]
ignored_warnings_from = ["node_modules"]

[lint]
Expand Down
67 changes: 67 additions & 0 deletions packages/subgraph-discovery/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import '@typechain/hardhat'
import 'hardhat-ignore-warnings'
import '@nomicfoundation/hardhat-verify'

import { vars } from 'hardhat/config'
import { HardhatUserConfig } from 'hardhat/config'

const DEFAULT_TEST_MNEMONIC = 'myth like bonus scare over problem client lizard pioneer submit female collect'

const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: '0.7.6',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
],
},
defaultNetwork: 'hardhat',
networks: {
hardhat: {
chainId: 1337,
accounts: {
mnemonic: DEFAULT_TEST_MNEMONIC,
},
},
arbitrumSepolia: {
chainId: 421614,
url: process.env.ARBITRUM_SEPOLIA_URL || 'https://sepolia-rollup.arbitrum.io/rpcblock',
accounts: {
mnemonic: DEFAULT_TEST_MNEMONIC,
},
},
arbitrumOne: {
chainId: 42161,
url: process.env.ARBITRUM_ONE_URL || 'https://arb1.arbitrum.io/rpc',
accounts: {
mnemonic: DEFAULT_TEST_MNEMONIC,
},
},
},
etherscan: {
apiKey: vars.has('ARBISCAN_API_KEY') ? vars.get('ARBISCAN_API_KEY') : (process.env.ARBISCAN_API_KEY ?? ''),
},
sourcify: {
enabled: false,
},
blockscout: {
enabled: false,
},
typechain: {
outDir: 'types',
target: 'ethers-v5',
},
warnings: {
'@openzeppelin/contracts/**/*': {
default: 'off',
},
},
}

export default config
44 changes: 38 additions & 6 deletions packages/subgraph-discovery/package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,53 @@
{
"name": "@graphprotocol/subgraph-discovery",
"version": "0.0.0",
"private": true,
"description": "The Graph subgraph discovery and curation contracts",
"license": "GPL-2.0-or-later",
"scripts": {
"build": "pnpm build:dep",
"build": "pnpm build:dep && pnpm build:self",
"build:dep": "pnpm --filter '@graphprotocol/subgraph-discovery^...' run build:self",
"clean": "rm -rf forge-artifacts/ cache_forge/",
"build:self": "hardhat compile --quiet",
"clean": "rm -rf artifacts/ cache/ types/ forge-artifacts/ cache_forge/ coverage/",
"lint:sol": "solhint --fix --noPrompt --noPoster 'contracts/**/*.sol'; prettier -w --cache --log-level warn 'contracts/**/*.sol'",
"prepack": "pnpm build",
"test": "pnpm build && pnpm test:self",
"test:self": "forge test"
},
"devDependencies": {
"@graphprotocol/contracts": "workspace:^",
"files": [
"artifacts/**/*",
"types/**/*",
"contracts/**/*",
"README.md"
],
"exports": {
"./artifacts/*": "./artifacts/*",
"./contracts/*": "./contracts/*",
"./types": "./types/index.ts",
"./types/*": "./types/*"
},
"dependencies": {
"@graphprotocol/graph-core": "workspace:^",
"@graphprotocol/graph-token": "workspace:^",
"@graphprotocol/interfaces": "workspace:^",
"forge-std": "catalog:"
"@openzeppelin/contracts": "3.4.2",
"@openzeppelin/contracts-upgradeable": "3.4.2"
},
"devDependencies": {
"@ethersproject/abi": "^5.8.0",
"@ethersproject/bytes": "^5.8.0",
"@ethersproject/providers": "^5.8.0",
"@nomicfoundation/hardhat-verify": "2.1.1",
"@typechain/ethers-v5": "^10.2.1",
"@typechain/hardhat": "^6.1.2",
"ethers": "^5.7.2",
"forge-std": "catalog:",
"hardhat": "catalog:",
"hardhat-ignore-warnings": "catalog:",
"prettier": "catalog:",
"prettier-plugin-solidity": "catalog:",
"solhint": "catalog:",
"ts-node": "^10.9.2",
"typechain": "^8.3.2",
"typescript": "catalog:"
}
}
5 changes: 5 additions & 0 deletions packages/subgraph-discovery/prettier.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const baseConfig = require('../../prettier.config.cjs')

module.exports = {
...baseConfig,
}
Loading
Loading