From 08c3fc082bd31c01ba8ded0858cc91364fb194bc Mon Sep 17 00:00:00 2001 From: Miguel de Elias Date: Mon, 2 Nov 2026 17:07:30 -0300 Subject: [PATCH] refactor(subgraph-discovery): move discovery and curation contracts --- .changeset/horizon-curation-addresses.md | 5 ++ .changeset/subgraph-discovery-initial.md | 5 ++ .changeset/toolshed-tenderly-sources.md | 5 ++ .github/workflows/publish.yml | 1 + .gitignore | 1 + .../address-book/src/horizon/addresses.json | 24 +++++++ packages/deployment/lib/contract-registry.ts | 4 +- packages/deployment/package.json | 1 + .../test/bytecode-comparison.test.ts | 2 +- packages/horizon/addresses.json | 24 +++++++ .../ignition/modules/periphery/Curation.ts | 2 +- .../horizon/ignition/modules/periphery/GNS.ts | 2 +- packages/horizon/package.json | 1 + packages/horizon/scripts/pre-verify | 5 +- packages/horizon/tenderly.config.json | 14 ++-- packages/subgraph-discovery/.solhint.json | 3 + packages/subgraph-discovery/README.md | 22 ++++++ .../contracts/base/Multicall.sol | 0 .../contracts/curation/CurationStorage.sol | 0 .../contracts/curation/GraphCurationToken.sol | 0 .../contracts/discovery/GNS.sol | 0 .../contracts/discovery/GNSStorage.sol | 0 .../contracts/discovery/SubgraphNFT.sol | 0 .../discovery/SubgraphNFTDescriptor.sol | 0 .../contracts/l2/curation/L2Curation.sol | 0 .../contracts/l2/discovery/L2GNS.sol | 0 .../contracts/l2/discovery/L2GNSStorage.sol | 0 .../contracts/libraries/Base58Encoder.sol | 0 .../contracts/libraries/HexStrings.sol | 0 packages/subgraph-discovery/foundry.toml | 12 +++- packages/subgraph-discovery/hardhat.config.ts | 67 +++++++++++++++++++ packages/subgraph-discovery/package.json | 44 ++++++++++-- .../subgraph-discovery/prettier.config.cjs | 5 ++ .../subgraph-discovery/test/unit/Setup.t.sol | 10 +++ .../test/unit/l2-curation/RewardsHook.t.sol | 55 +++++++++++++++ .../test/unit/l2-gns/Multicall.t.sol | 22 ++++++ .../test/unit/shared/DiscoveryTest.t.sol | 22 +++--- .../test/unit/shared/ProtocolFixture.t.sol | 14 +++- .../ignition/modules/Curation.ts | 2 +- .../subgraph-service/ignition/modules/GNS.ts | 2 +- packages/subgraph-service/package.json | 1 + packages/subgraph-service/scripts/pre-verify | 5 +- packages/toolshed/src/hardhat/tenderly.ts | 29 ++++---- pnpm-lock.yaml | 66 ++++++++++++++++-- scripts/contracts-migration/manifest.json | 10 +-- 45 files changed, 428 insertions(+), 59 deletions(-) create mode 100644 .changeset/horizon-curation-addresses.md create mode 100644 .changeset/subgraph-discovery-initial.md create mode 100644 .changeset/toolshed-tenderly-sources.md create mode 100644 packages/subgraph-discovery/.solhint.json create mode 100644 packages/subgraph-discovery/README.md rename packages/{contracts => subgraph-discovery}/contracts/base/Multicall.sol (100%) rename packages/{contracts => subgraph-discovery}/contracts/curation/CurationStorage.sol (100%) rename packages/{contracts => subgraph-discovery}/contracts/curation/GraphCurationToken.sol (100%) rename packages/{contracts => subgraph-discovery}/contracts/discovery/GNS.sol (100%) rename packages/{contracts => subgraph-discovery}/contracts/discovery/GNSStorage.sol (100%) rename packages/{contracts => subgraph-discovery}/contracts/discovery/SubgraphNFT.sol (100%) rename packages/{contracts => subgraph-discovery}/contracts/discovery/SubgraphNFTDescriptor.sol (100%) rename packages/{contracts => subgraph-discovery}/contracts/l2/curation/L2Curation.sol (100%) rename packages/{contracts => subgraph-discovery}/contracts/l2/discovery/L2GNS.sol (100%) rename packages/{contracts => subgraph-discovery}/contracts/l2/discovery/L2GNSStorage.sol (100%) rename packages/{contracts => subgraph-discovery}/contracts/libraries/Base58Encoder.sol (100%) rename packages/{contracts => subgraph-discovery}/contracts/libraries/HexStrings.sol (100%) create mode 100644 packages/subgraph-discovery/hardhat.config.ts create mode 100644 packages/subgraph-discovery/prettier.config.cjs create mode 100644 packages/subgraph-discovery/test/unit/l2-curation/RewardsHook.t.sol diff --git a/.changeset/horizon-curation-addresses.md b/.changeset/horizon-curation-addresses.md new file mode 100644 index 000000000..a30ac1cb9 --- /dev/null +++ b/.changeset/horizon-curation-addresses.md @@ -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. diff --git a/.changeset/subgraph-discovery-initial.md b/.changeset/subgraph-discovery-initial.md new file mode 100644 index 000000000..7ed9b37ab --- /dev/null +++ b/.changeset/subgraph-discovery-initial.md @@ -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`. diff --git a/.changeset/toolshed-tenderly-sources.md b/.changeset/toolshed-tenderly-sources.md new file mode 100644 index 000000000..06a23ebc7 --- /dev/null +++ b/.changeset/toolshed-tenderly-sources.md @@ -0,0 +1,5 @@ +--- +'@graphprotocol/toolshed': minor +--- + +`TenderlyConfig.externalArtifacts` is now an array of `{ source, buildInfo }`, so artifacts can be copied from several packages. diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index af7888fda..7d19f6d14 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -33,6 +33,7 @@ on: - contracts - graph-core - graph-token + - subgraph-discovery - interfaces - toolshed tag: diff --git a/.gitignore b/.gitignore index af5ea1374..15e664fcb 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/packages/address-book/src/horizon/addresses.json b/packages/address-book/src/horizon/addresses.json index 9cd38dfe0..e37a6cd0b 100644 --- a/packages/address-book/src/horizon/addresses.json +++ b/packages/address-book/src/horizon/addresses.json @@ -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", @@ -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", diff --git a/packages/deployment/lib/contract-registry.ts b/packages/deployment/lib/contract-registry.ts index c3295f22d..6c979d6a2 100644 --- a/packages/deployment/lib/contract-registry.ts +++ b/packages/deployment/lib/contract-registry.ts @@ -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, @@ -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, diff --git a/packages/deployment/package.json b/packages/deployment/package.json index f42ec8fee..6c0317548 100644 --- a/packages/deployment/package.json +++ b/packages/deployment/package.json @@ -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", diff --git a/packages/deployment/test/bytecode-comparison.test.ts b/packages/deployment/test/bytecode-comparison.test.ts index b0ef438a8..c4a4ab1a9 100644 --- a/packages/deployment/test/bytecode-comparison.test.ts +++ b/packages/deployment/test/bytecode-comparison.test.ts @@ -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/) diff --git a/packages/horizon/addresses.json b/packages/horizon/addresses.json index 9cd38dfe0..e37a6cd0b 100644 --- a/packages/horizon/addresses.json +++ b/packages/horizon/addresses.json @@ -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", @@ -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", diff --git a/packages/horizon/ignition/modules/periphery/Curation.ts b/packages/horizon/ignition/modules/periphery/Curation.ts index 4c9abf9c3..14a4329ae 100644 --- a/packages/horizon/ignition/modules/periphery/Curation.ts +++ b/packages/horizon/ignition/modules/periphery/Curation.ts @@ -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' diff --git a/packages/horizon/ignition/modules/periphery/GNS.ts b/packages/horizon/ignition/modules/periphery/GNS.ts index 78ee364f5..5326b8b41 100644 --- a/packages/horizon/ignition/modules/periphery/GNS.ts +++ b/packages/horizon/ignition/modules/periphery/GNS.ts @@ -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' diff --git a/packages/horizon/package.json b/packages/horizon/package.json index c5a6406cd..183b04c72 100644 --- a/packages/horizon/package.json +++ b/packages/horizon/package.json @@ -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:", diff --git a/packages/horizon/scripts/pre-verify b/packages/horizon/scripts/pre-verify index 88d3adb71..e4b6b80b3 100755 --- a/packages/horizon/scripts/pre-verify +++ b/packages/horizon/scripts/pre-verify @@ -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 diff --git a/packages/horizon/tenderly.config.json b/packages/horizon/tenderly.config.json index 725ce035e..d6d4e099a 100644 --- a/packages/horizon/tenderly.config.json +++ b/packages/horizon/tenderly.config.json @@ -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", diff --git a/packages/subgraph-discovery/.solhint.json b/packages/subgraph-discovery/.solhint.json new file mode 100644 index 000000000..780d82f39 --- /dev/null +++ b/packages/subgraph-discovery/.solhint.json @@ -0,0 +1,3 @@ +{ + "extends": "./../../.solhint.json" +} diff --git a/packages/subgraph-discovery/README.md b/packages/subgraph-discovery/README.md new file mode 100644 index 000000000..40b80d264 --- /dev/null +++ b/packages/subgraph-discovery/README.md @@ -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 +``` diff --git a/packages/contracts/contracts/base/Multicall.sol b/packages/subgraph-discovery/contracts/base/Multicall.sol similarity index 100% rename from packages/contracts/contracts/base/Multicall.sol rename to packages/subgraph-discovery/contracts/base/Multicall.sol diff --git a/packages/contracts/contracts/curation/CurationStorage.sol b/packages/subgraph-discovery/contracts/curation/CurationStorage.sol similarity index 100% rename from packages/contracts/contracts/curation/CurationStorage.sol rename to packages/subgraph-discovery/contracts/curation/CurationStorage.sol diff --git a/packages/contracts/contracts/curation/GraphCurationToken.sol b/packages/subgraph-discovery/contracts/curation/GraphCurationToken.sol similarity index 100% rename from packages/contracts/contracts/curation/GraphCurationToken.sol rename to packages/subgraph-discovery/contracts/curation/GraphCurationToken.sol diff --git a/packages/contracts/contracts/discovery/GNS.sol b/packages/subgraph-discovery/contracts/discovery/GNS.sol similarity index 100% rename from packages/contracts/contracts/discovery/GNS.sol rename to packages/subgraph-discovery/contracts/discovery/GNS.sol diff --git a/packages/contracts/contracts/discovery/GNSStorage.sol b/packages/subgraph-discovery/contracts/discovery/GNSStorage.sol similarity index 100% rename from packages/contracts/contracts/discovery/GNSStorage.sol rename to packages/subgraph-discovery/contracts/discovery/GNSStorage.sol diff --git a/packages/contracts/contracts/discovery/SubgraphNFT.sol b/packages/subgraph-discovery/contracts/discovery/SubgraphNFT.sol similarity index 100% rename from packages/contracts/contracts/discovery/SubgraphNFT.sol rename to packages/subgraph-discovery/contracts/discovery/SubgraphNFT.sol diff --git a/packages/contracts/contracts/discovery/SubgraphNFTDescriptor.sol b/packages/subgraph-discovery/contracts/discovery/SubgraphNFTDescriptor.sol similarity index 100% rename from packages/contracts/contracts/discovery/SubgraphNFTDescriptor.sol rename to packages/subgraph-discovery/contracts/discovery/SubgraphNFTDescriptor.sol diff --git a/packages/contracts/contracts/l2/curation/L2Curation.sol b/packages/subgraph-discovery/contracts/l2/curation/L2Curation.sol similarity index 100% rename from packages/contracts/contracts/l2/curation/L2Curation.sol rename to packages/subgraph-discovery/contracts/l2/curation/L2Curation.sol diff --git a/packages/contracts/contracts/l2/discovery/L2GNS.sol b/packages/subgraph-discovery/contracts/l2/discovery/L2GNS.sol similarity index 100% rename from packages/contracts/contracts/l2/discovery/L2GNS.sol rename to packages/subgraph-discovery/contracts/l2/discovery/L2GNS.sol diff --git a/packages/contracts/contracts/l2/discovery/L2GNSStorage.sol b/packages/subgraph-discovery/contracts/l2/discovery/L2GNSStorage.sol similarity index 100% rename from packages/contracts/contracts/l2/discovery/L2GNSStorage.sol rename to packages/subgraph-discovery/contracts/l2/discovery/L2GNSStorage.sol diff --git a/packages/contracts/contracts/libraries/Base58Encoder.sol b/packages/subgraph-discovery/contracts/libraries/Base58Encoder.sol similarity index 100% rename from packages/contracts/contracts/libraries/Base58Encoder.sol rename to packages/subgraph-discovery/contracts/libraries/Base58Encoder.sol diff --git a/packages/contracts/contracts/libraries/HexStrings.sol b/packages/subgraph-discovery/contracts/libraries/HexStrings.sol similarity index 100% rename from packages/contracts/contracts/libraries/HexStrings.sol rename to packages/subgraph-discovery/contracts/libraries/HexStrings.sol diff --git a/packages/subgraph-discovery/foundry.toml b/packages/subgraph-discovery/foundry.toml index 5f83fe21d..43d303213 100644 --- a/packages/subgraph-discovery/foundry.toml +++ b/packages/subgraph-discovery/foundry.toml @@ -1,5 +1,5 @@ [profile.default] -src = 'test' +src = 'contracts' out = 'forge-artifacts' test = 'test' libs = ["node_modules"] @@ -7,11 +7,17 @@ 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] diff --git a/packages/subgraph-discovery/hardhat.config.ts b/packages/subgraph-discovery/hardhat.config.ts new file mode 100644 index 000000000..e974652ed --- /dev/null +++ b/packages/subgraph-discovery/hardhat.config.ts @@ -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 diff --git a/packages/subgraph-discovery/package.json b/packages/subgraph-discovery/package.json index 28722f13d..be779872e 100644 --- a/packages/subgraph-discovery/package.json +++ b/packages/subgraph-discovery/package.json @@ -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:" } } diff --git a/packages/subgraph-discovery/prettier.config.cjs b/packages/subgraph-discovery/prettier.config.cjs new file mode 100644 index 000000000..4e8dcf4f3 --- /dev/null +++ b/packages/subgraph-discovery/prettier.config.cjs @@ -0,0 +1,5 @@ +const baseConfig = require('../../prettier.config.cjs') + +module.exports = { + ...baseConfig, +} diff --git a/packages/subgraph-discovery/test/unit/Setup.t.sol b/packages/subgraph-discovery/test/unit/Setup.t.sol index d95930ff7..5cd8195fc 100644 --- a/packages/subgraph-discovery/test/unit/Setup.t.sol +++ b/packages/subgraph-discovery/test/unit/Setup.t.sol @@ -1,6 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.27; +import { VmSafe } from "forge-std/Vm.sol"; import { GNSHelpers } from "./shared/GNSHelpers.t.sol"; contract SetupTest is GNSHelpers { @@ -13,4 +14,13 @@ contract SetupTest is GNSHelpers { function test_Setup_PublishNewSubgraph() public { _publishNewSubgraph(me, DEPLOYMENT_ID_0); } + + function test_Setup_FoundryL2GNSMatchesHardhat() public { + vm.skip(vm.isContext(VmSafe.ForgeContext.Coverage)); + string memory json = vm.readFile("artifacts/contracts/l2/discovery/L2GNS.sol/L2GNS.json"); + bytes memory hardhat = _stripMetadata(vm.parseJsonBytes(json, ".bytecode")); + bytes memory foundry = _stripMetadata(vm.getCode(L2_GNS)); + assertGt(hardhat.length, 0); + assertEq(foundry, hardhat); + } } diff --git a/packages/subgraph-discovery/test/unit/l2-curation/RewardsHook.t.sol b/packages/subgraph-discovery/test/unit/l2-curation/RewardsHook.t.sol new file mode 100644 index 000000000..011e4cb1f --- /dev/null +++ b/packages/subgraph-discovery/test/unit/l2-curation/RewardsHook.t.sol @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.27; + +import { IManaged } from "@graphprotocol/interfaces/contracts/contracts/governance/IManaged.sol"; +import { L2CurationSharedTest } from "./L2CurationShared.t.sol"; + +contract RewardsManagerRecorder { + bytes32[] public updates; + + function onSubgraphSignalUpdate(bytes32 subgraphDeploymentID) external returns (uint256) { + updates.push(subgraphDeploymentID); + return 0; + } + + function updatesLength() external view returns (uint256) { + return updates.length; + } +} + +contract RewardsHookTest is L2CurationSharedTest { + RewardsManagerRecorder internal recorder; + + function setUp() public override { + super.setUp(); + recorder = new RewardsManagerRecorder(); + _registerContract("RewardsManager", address(recorder)); + IManaged(address(curation)).syncAllContracts(); + } + + function test_RewardsHook_NotifiedOnMint() public { + _mint(TOKENS_TO_DEPOSIT); + + assertEq(recorder.updatesLength(), 1); + assertEq(recorder.updates(0), SUBGRAPH_DEPLOYMENT_ID); + } + + function test_RewardsHook_NotifiedOnBurn() public { + uint256 signal = _mint(TOKENS_TO_DEPOSIT); + assertEq(recorder.updatesLength(), 1); + + vm.prank(curator); + curation.burn(SUBGRAPH_DEPLOYMENT_ID, signal, 0); + + assertEq(recorder.updatesLength(), 2); + assertEq(recorder.updates(1), SUBGRAPH_DEPLOYMENT_ID); + } + + function test_RewardsHook_NotifiedOnMintTaxFree() public { + vm.prank(address(gns)); + curation.mintTaxFree(SUBGRAPH_DEPLOYMENT_ID, TOKENS_TO_DEPOSIT); + + assertEq(recorder.updatesLength(), 1); + assertEq(recorder.updates(0), SUBGRAPH_DEPLOYMENT_ID); + } +} diff --git a/packages/subgraph-discovery/test/unit/l2-gns/Multicall.t.sol b/packages/subgraph-discovery/test/unit/l2-gns/Multicall.t.sol index 34c568fae..8176a5e97 100644 --- a/packages/subgraph-discovery/test/unit/l2-gns/Multicall.t.sol +++ b/packages/subgraph-discovery/test/unit/l2-gns/Multicall.t.sol @@ -29,4 +29,26 @@ contract MulticallTest is GNSHelpers { // Curation tax is zero assertEq(curation.getCurationPoolTokens(DEPLOYMENT_ID_0), tokens); } + + function test_GNS_Multicall_RevertWhen_BatchedCallReverts() public { + bytes[] memory calls = new bytes[](2); + calls[0] = abi.encodeCall(IL2GNSLike.setOwnerTaxPercentage, (100)); + calls[1] = abi.encodeCall( + IL2GNSLike.publishNewSubgraph, + (DEPLOYMENT_ID_0, _versionMetadata(DEPLOYMENT_ID_0), _subgraphMetadata(DEPLOYMENT_ID_0)) + ); + + vm.expectRevert(bytes("Only Controller governor")); + vm.prank(me); + gns.multicall(calls); + } + + function test_GNS_Multicall_RevertWhen_SelectorNotRecognized() public { + bytes[] memory calls = new bytes[](1); + calls[0] = abi.encodeWithSignature("_setOwnerTaxPercentage(uint32)", uint32(100)); + + vm.expectRevert(bytes("")); + vm.prank(me); + gns.multicall(calls); + } } diff --git a/packages/subgraph-discovery/test/unit/shared/DiscoveryTest.t.sol b/packages/subgraph-discovery/test/unit/shared/DiscoveryTest.t.sol index 6b6681a76..1bf8abdd2 100644 --- a/packages/subgraph-discovery/test/unit/shared/DiscoveryTest.t.sol +++ b/packages/subgraph-discovery/test/unit/shared/DiscoveryTest.t.sol @@ -15,13 +15,11 @@ abstract contract DiscoveryTest is ProtocolFixture { string internal constant TOKEN_ARTIFACTS = "node_modules/@graphprotocol/graph-token/artifacts/contracts/"; string internal constant L2_GRAPH_TOKEN = string.concat(TOKEN_ARTIFACTS, "l2/token/L2GraphToken.sol/L2GraphToken.json"); - string internal constant GRAPH_CURATION_TOKEN = - string.concat(PKG_ARTIFACTS, "curation/GraphCurationToken.sol/GraphCurationToken.json"); - string internal constant L2_CURATION = string.concat(PKG_ARTIFACTS, "l2/curation/L2Curation.sol/L2Curation.json"); - string internal constant SUBGRAPH_NFT = string.concat(PKG_ARTIFACTS, "discovery/SubgraphNFT.sol/SubgraphNFT.json"); - string internal constant SUBGRAPH_NFT_DESCRIPTOR = - string.concat(PKG_ARTIFACTS, "discovery/SubgraphNFTDescriptor.sol/SubgraphNFTDescriptor.json"); - string internal constant L2_GNS = string.concat(PKG_ARTIFACTS, "l2/discovery/L2GNS.sol/L2GNS.json"); + string internal constant GRAPH_CURATION_TOKEN = "GraphCurationToken.sol:GraphCurationToken"; + string internal constant L2_CURATION = "L2Curation.sol:L2Curation"; + string internal constant SUBGRAPH_NFT = "SubgraphNFT.sol:SubgraphNFT"; + string internal constant SUBGRAPH_NFT_DESCRIPTOR = "SubgraphNFTDescriptor.sol:SubgraphNFTDescriptor"; + string internal constant L2_GNS = "L2GNS.sol:L2GNS"; IGraphTokenLike internal grt; IL2CurationLike internal curation; @@ -53,23 +51,23 @@ abstract contract DiscoveryTest is ProtocolFixture { grt.addMinter(governor); vm.stopPrank(); - curationTokenMaster = _deployArtifact(GRAPH_CURATION_TOKEN, ""); + curationTokenMaster = _deployPkg(GRAPH_CURATION_TOKEN, ""); curation = IL2CurationLike( _deployBehindProxy( - _deployArtifact(L2_CURATION, ""), + _deployPkg(L2_CURATION, ""), abi.encodeCall(IL2CurationLike.initialize, (address(controller), curationTokenMaster, 0, 1)) ) ); - nft = ISubgraphNFTLike(_deployArtifact(SUBGRAPH_NFT, abi.encode(governor))); - address descriptor = _deployArtifact(SUBGRAPH_NFT_DESCRIPTOR, ""); + nft = ISubgraphNFTLike(_deployPkg(SUBGRAPH_NFT, abi.encode(governor))); + address descriptor = _deployPkg(SUBGRAPH_NFT_DESCRIPTOR, ""); vm.prank(governor); nft.setTokenDescriptor(descriptor); gns = IL2GNSLike( _deployBehindProxy( - _deployArtifact(L2_GNS, ""), + _deployPkg(L2_GNS, ""), abi.encodeCall(IL2GNSLike.initialize, (address(controller), address(nft))) ) ); diff --git a/packages/subgraph-discovery/test/unit/shared/ProtocolFixture.t.sol b/packages/subgraph-discovery/test/unit/shared/ProtocolFixture.t.sol index e1567eaa9..78cbc5f11 100644 --- a/packages/subgraph-discovery/test/unit/shared/ProtocolFixture.t.sol +++ b/packages/subgraph-discovery/test/unit/shared/ProtocolFixture.t.sol @@ -8,12 +8,24 @@ import { IGraphProxyAdmin } from "@graphprotocol/interfaces/contracts/contracts/ abstract contract ProtocolFixture is Test { string internal constant CORE_ARTIFACTS = "node_modules/@graphprotocol/graph-core/artifacts/contracts/"; - string internal constant PKG_ARTIFACTS = "node_modules/@graphprotocol/contracts/artifacts/contracts/"; address internal governor; // makeAddr("governor"), set in _deployProtocolBase IController internal controller; IGraphProxyAdmin internal proxyAdmin; + /// id has the form "L2GNS.sol:L2GNS". Deploys the Foundry-compiled contract with CREATE + /// (honours an active vm.prank). Reverts if the contract is missing or its constructor reverts. + function _deployPkg(string memory id, bytes memory args) internal returns (address) { + return vm.deployCode(id, args); + } + + function _stripMetadata(bytes memory code) internal pure returns (bytes memory out) { + uint256 metadataLength = (uint256(uint8(code[code.length - 2])) << 8) | uint256(uint8(code[code.length - 1])); + uint256 newLength = code.length - metadataLength - 2; + out = new bytes(newLength); + for (uint256 i = 0; i < newLength; i++) out[i] = code[i]; + } + /// path is a full artifact path, e.g. string.concat(CORE_ARTIFACTS, "governance/Controller.sol/Controller.json"). /// Deploys `.bytecode ++ args` with CREATE (honours an active vm.prank). /// Reverts "artifact needs linking" if `.linkReferences` has any key (vm.parseJsonKeys), diff --git a/packages/subgraph-service/ignition/modules/Curation.ts b/packages/subgraph-service/ignition/modules/Curation.ts index 55d3c9553..4cf83574a 100644 --- a/packages/subgraph-service/ignition/modules/Curation.ts +++ b/packages/subgraph-service/ignition/modules/Curation.ts @@ -1,4 +1,4 @@ -import CurationArtifact from '@graphprotocol/contracts/artifacts/contracts/l2/curation/L2Curation.sol/L2Curation.json' +import CurationArtifact from '@graphprotocol/subgraph-discovery/artifacts/contracts/l2/curation/L2Curation.sol/L2Curation.json' import { buildModule } from '@nomicfoundation/ignition-core' // Note that this module is a no-op, we only run it to get curation addresses into the address book. diff --git a/packages/subgraph-service/ignition/modules/GNS.ts b/packages/subgraph-service/ignition/modules/GNS.ts index 7e7c0bbb0..6aceb4301 100644 --- a/packages/subgraph-service/ignition/modules/GNS.ts +++ b/packages/subgraph-service/ignition/modules/GNS.ts @@ -1,5 +1,5 @@ -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 L2GNSArtifact from '@graphprotocol/subgraph-discovery/artifacts/contracts/l2/discovery/L2GNS.sol/L2GNS.json' import { buildModule } from '@nomicfoundation/hardhat-ignition/modules' // Note that this module is a no-op, we only run it to get gns addresses into the address book. diff --git a/packages/subgraph-service/package.json b/packages/subgraph-service/package.json index 795dbfdba..09e20becb 100644 --- a/packages/subgraph-service/package.json +++ b/packages/subgraph-service/package.json @@ -43,6 +43,7 @@ "@graphprotocol/contracts-7.3.0": "npm:@graphprotocol/contracts@7.3.0", "@graphprotocol/horizon": "workspace:^", "@graphprotocol/interfaces": "workspace:^", + "@graphprotocol/subgraph-discovery": "workspace:^", "@graphprotocol/toolshed": "workspace:^", "@nomicfoundation/hardhat-chai-matchers": "^2.0.0", "@nomicfoundation/hardhat-ethers": "catalog:", diff --git a/packages/subgraph-service/scripts/pre-verify b/packages/subgraph-service/scripts/pre-verify index 7a8ad65d9..f41a73c0f 100755 --- a/packages/subgraph-service/scripts/pre-verify +++ b/packages/subgraph-service/scripts/pre-verify @@ -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 ../horizon/build/contracts/contracts/* build/contracts/contracts diff --git a/packages/toolshed/src/hardhat/tenderly.ts b/packages/toolshed/src/hardhat/tenderly.ts index 14114d94d..34a79ac68 100644 --- a/packages/toolshed/src/hardhat/tenderly.ts +++ b/packages/toolshed/src/hardhat/tenderly.ts @@ -16,7 +16,7 @@ export interface TenderlyConfig { externalArtifacts?: { source: string buildInfo: string - } + }[] verifyList?: string[] excludeList?: string[] tag?: string @@ -89,26 +89,29 @@ export function copyExternalArtifacts(packageDir: string, config: TenderlyConfig } const destDir = path.join(packageDir, '.tenderly-artifacts') - const sourceDir = path.resolve(packageDir, config.externalArtifacts.source) - - console.log(`Copying external artifacts from ${sourceDir}...`) if (!fs.existsSync(destDir)) { fs.mkdirSync(destDir, { recursive: true }) } - const sourcePath = path.join(sourceDir, 'contracts') - const destPath = path.join(destDir, 'contracts') + for (const external of config.externalArtifacts) { + const sourceDir = path.resolve(packageDir, external.source) - if (fs.existsSync(sourcePath)) { - execSync(`rsync -a "${sourcePath}/" "${destPath}/"`, { stdio: 'inherit' }) - } + console.log(`Copying external artifacts from ${sourceDir}...`) - const buildInfoSource = path.resolve(packageDir, config.externalArtifacts.buildInfo) - const buildInfoDest = path.join(destDir, 'build-info') + const sourcePath = path.join(sourceDir, 'contracts') + const destPath = path.join(destDir, 'contracts') - if (fs.existsSync(buildInfoSource)) { - execSync(`rsync -a "${buildInfoSource}/" "${buildInfoDest}/"`, { stdio: 'inherit' }) + if (fs.existsSync(sourcePath)) { + execSync(`rsync -a "${sourcePath}/" "${destPath}/"`, { stdio: 'inherit' }) + } + + const buildInfoSource = path.resolve(packageDir, external.buildInfo) + const buildInfoDest = path.join(destDir, 'build-info') + + if (fs.existsSync(buildInfoSource)) { + execSync(`rsync -a "${buildInfoSource}/" "${buildInfoDest}/"`, { stdio: 'inherit' }) + } } console.log(`✓ External artifacts copied to ${destDir}`) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b59b38c75..d3905f9a1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -477,6 +477,9 @@ importers: '@graphprotocol/issuance': specifier: workspace:* version: link:../issuance + '@graphprotocol/subgraph-discovery': + specifier: workspace:* + version: link:../subgraph-discovery '@graphprotocol/subgraph-service': specifier: workspace:* version: link:../subgraph-service @@ -769,6 +772,9 @@ importers: '@graphprotocol/interfaces': specifier: workspace:^ version: link:../interfaces + '@graphprotocol/subgraph-discovery': + specifier: workspace:^ + version: link:../subgraph-discovery '@graphprotocol/toolshed': specifier: workspace:^ version: link:../toolshed @@ -1048,10 +1054,7 @@ importers: version: solc@0.7.6 packages/subgraph-discovery: - devDependencies: - '@graphprotocol/contracts': - specifier: workspace:^ - version: link:../contracts + dependencies: '@graphprotocol/graph-core': specifier: workspace:^ version: link:../graph-core @@ -1061,9 +1064,61 @@ importers: '@graphprotocol/interfaces': specifier: workspace:^ version: link:../interfaces + '@openzeppelin/contracts': + specifier: 3.4.2 + version: 3.4.2 + '@openzeppelin/contracts-upgradeable': + specifier: 3.4.2 + version: 3.4.2 + devDependencies: + '@ethersproject/abi': + specifier: ^5.8.0 + version: 5.8.0 + '@ethersproject/bytes': + specifier: ^5.8.0 + version: 5.8.0 + '@ethersproject/providers': + specifier: ^5.8.0 + version: 5.8.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) + '@nomicfoundation/hardhat-verify': + specifier: 2.1.1 + version: 2.1.1(hardhat@2.28.6(bufferutil@4.0.9)(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3))(typescript@5.9.3)(utf-8-validate@5.0.10)) + '@typechain/ethers-v5': + specifier: ^10.2.1 + version: 10.2.1(@ethersproject/abi@5.8.0)(@ethersproject/providers@5.8.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))(ethers@5.8.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))(typechain@8.3.2(patch_hash=b34ed6afcf99760666fdc85ecb2094fdd20ce509f947eb09cef21665a2a6a1d6)(typescript@5.9.3))(typescript@5.9.3) + '@typechain/hardhat': + specifier: ^6.1.2 + version: 6.1.6(@ethersproject/abi@5.8.0)(@ethersproject/providers@5.8.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))(@typechain/ethers-v5@10.2.1(@ethersproject/abi@5.8.0)(@ethersproject/providers@5.8.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))(ethers@5.8.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))(typechain@8.3.2(patch_hash=b34ed6afcf99760666fdc85ecb2094fdd20ce509f947eb09cef21665a2a6a1d6)(typescript@5.9.3))(typescript@5.9.3))(ethers@5.8.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))(hardhat@2.28.6(bufferutil@4.0.9)(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3))(typescript@5.9.3)(utf-8-validate@5.0.10))(typechain@8.3.2(patch_hash=b34ed6afcf99760666fdc85ecb2094fdd20ce509f947eb09cef21665a2a6a1d6)(typescript@5.9.3)) + ethers: + specifier: ^5.7.2 + version: 5.8.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) forge-std: specifier: 'catalog:' version: https://github.com/foundry-rs/forge-std/tarball/v1.14.0 + hardhat: + specifier: 'catalog:' + version: 2.28.6(bufferutil@4.0.9)(ts-node@10.9.2(@types/node@20.19.41)(typescript@5.9.3))(typescript@5.9.3)(utf-8-validate@5.0.10) + hardhat-ignore-warnings: + specifier: 'catalog:' + version: 0.2.12 + prettier: + specifier: 'catalog:' + version: 3.8.1 + prettier-plugin-solidity: + specifier: 'catalog:' + version: 2.1.0(prettier@3.8.1) + solhint: + specifier: 'catalog:' + version: 6.2.1(typescript@5.9.3) + ts-node: + specifier: ^10.9.2 + version: 10.9.2(@types/node@20.19.41)(typescript@5.9.3) + typechain: + specifier: ^8.3.2 + version: 8.3.2(patch_hash=b34ed6afcf99760666fdc85ecb2094fdd20ce509f947eb09cef21665a2a6a1d6)(typescript@5.9.3) + typescript: + specifier: 'catalog:' + version: 5.9.3 packages/subgraph-service: devDependencies: @@ -1085,6 +1140,9 @@ importers: '@graphprotocol/interfaces': specifier: workspace:^ version: link:../interfaces + '@graphprotocol/subgraph-discovery': + specifier: workspace:^ + version: link:../subgraph-discovery '@graphprotocol/toolshed': specifier: workspace:^ version: link:../toolshed diff --git a/scripts/contracts-migration/manifest.json b/scripts/contracts-migration/manifest.json index 0455a0cfa..e6e3e6b61 100644 --- a/scripts/contracts-migration/manifest.json +++ b/scripts/contracts-migration/manifest.json @@ -7,11 +7,11 @@ "L1GraphTokenGateway": "packages/graph-token/artifacts/contracts/gateway/L1GraphTokenGateway.sol/L1GraphTokenGateway.json", "L2GraphTokenGateway": "packages/graph-token/artifacts/contracts/l2/gateway/L2GraphTokenGateway.sol/L2GraphTokenGateway.json", "BridgeEscrow": "packages/graph-token/artifacts/contracts/gateway/BridgeEscrow.sol/BridgeEscrow.json", - "L2GNS": "packages/contracts/artifacts/contracts/l2/discovery/L2GNS.sol/L2GNS.json", - "L2Curation": "packages/contracts/artifacts/contracts/l2/curation/L2Curation.sol/L2Curation.json", - "GraphCurationToken": "packages/contracts/artifacts/contracts/curation/GraphCurationToken.sol/GraphCurationToken.json", - "SubgraphNFT": "packages/contracts/artifacts/contracts/discovery/SubgraphNFT.sol/SubgraphNFT.json", - "SubgraphNFTDescriptor": "packages/contracts/artifacts/contracts/discovery/SubgraphNFTDescriptor.sol/SubgraphNFTDescriptor.json", + "L2GNS": "packages/subgraph-discovery/artifacts/contracts/l2/discovery/L2GNS.sol/L2GNS.json", + "L2Curation": "packages/subgraph-discovery/artifacts/contracts/l2/curation/L2Curation.sol/L2Curation.json", + "GraphCurationToken": "packages/subgraph-discovery/artifacts/contracts/curation/GraphCurationToken.sol/GraphCurationToken.json", + "SubgraphNFT": "packages/subgraph-discovery/artifacts/contracts/discovery/SubgraphNFT.sol/SubgraphNFT.json", + "SubgraphNFTDescriptor": "packages/subgraph-discovery/artifacts/contracts/discovery/SubgraphNFTDescriptor.sol/SubgraphNFTDescriptor.json", "EpochManager": "packages/contracts/artifacts/contracts/epochs/EpochManager.sol/EpochManager.json", "RewardsManager": "packages/contracts/artifacts/contracts/rewards/RewardsManager.sol/RewardsManager.json", "HorizonStaking": "packages/horizon/build/contracts/contracts/staking/HorizonStaking.sol/HorizonStaking.json",