diff --git a/.github/workflows/ci-horizon.yml b/.github/workflows/ci-horizon.yml index 159ca7b4d..056e692bb 100644 --- a/.github/workflows/ci-horizon.yml +++ b/.github/workflows/ci-horizon.yml @@ -24,10 +24,26 @@ jobs: submodules: recursive - name: Set up environment uses: ./.github/actions/setup - - name: Build + - name: Build contracts + run: | + pushd packages/contracts + yarn build + popd + - name: Build horizon run: | pushd packages/horizon yarn build + popd + - name: Build subgraph service + run: | + pushd packages/subgraph-service + yarn build + popd + - name: Build hardhat-graph-protocol + run: | + pushd packages/hardhat-graph-protocol + yarn build + popd - name: Run tests run: | pushd packages/horizon diff --git a/package.json b/package.json index 6b82fd5a4..d1e0f60d8 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "packages/contracts", "packages/data-edge", "packages/eslint-graph-config", + "packages/hardhat-graph-protocol", "packages/horizon", "packages/sdk", "packages/solhint-graph-config", @@ -21,7 +22,7 @@ "postinstall": "husky install", "clean": "yarn workspaces foreach --all --parallel --verbose run clean", "clean:all": "yarn clean && rm -rf node_modules packages/*/node_modules", - "build": "yarn workspaces foreach --all --verbose run build", + "build": "chmod +x ./scripts/build && ./scripts/build", "lint": "yarn workspaces foreach --all --parallel --verbose run lint", "test": "yarn workspaces foreach --all --parallel --verbose --interlaced run test" }, diff --git a/packages/eslint-graph-config/README.md b/packages/eslint-graph-config/README.md index 3e0a41cff..794ad677d 100644 --- a/packages/eslint-graph-config/README.md +++ b/packages/eslint-graph-config/README.md @@ -5,13 +5,13 @@ This repository contains shared linting and formatting rules for TypeScript proj ## Installation ```bash -yarn add --dev eslint eslint-graph-config +yarn add --dev eslint@^8.56.0 eslint-graph-config ``` For projects on this monorepo, you can use the following command to install the package: ```bash -yarn add --dev eslint eslint-graph-config@workspace:^x.y.z +yarn add --dev eslint@^8.56.0 eslint-graph-config@workspace:^x.y.z ``` To enable the rules, you need to create an `eslint.config.js` file in the root of your project with the following content: diff --git a/packages/hardhat-graph-protocol/.mocharc.json b/packages/hardhat-graph-protocol/.mocharc.json new file mode 100644 index 000000000..de4e97026 --- /dev/null +++ b/packages/hardhat-graph-protocol/.mocharc.json @@ -0,0 +1,5 @@ +{ + "require": "ts-node/register/files", + "ignore": ["test/fixtures/**/*"], + "timeout": 6000 +} diff --git a/packages/hardhat-graph-protocol/README.md b/packages/hardhat-graph-protocol/README.md new file mode 100644 index 000000000..9f9d6eb71 --- /dev/null +++ b/packages/hardhat-graph-protocol/README.md @@ -0,0 +1,32 @@ +# hardhat-graph-protocol + + +## Usage + +Install with yarn + +```bash +yarn add --dev hardhat-graph-protocol + +# From the monorepo +yarn add --dev hardhat-graph-protocol@workspace:^x.y.z +``` + +And add it to your `hardhat.config.ts`: + +```ts +import "hardhat-graph-protocol"; + +export default { + ... + graph: { + deployments: { + horizon: require.resolve('@graphprotocol/horizon/addresses.json'), + subgraphService: require.resolve('@graphprotocol/subgraph-service/addresses.json'), + } + }, + ... +}; +``` + +_Note_: When using the plugin from within this monorepo TypeScript fails to properly apply the type extension typings. This is a known issue and can be worked around by adding a `types/hardhat-graph-protocol.d.ts` file with the same content as the `type-extensions.ts` file in this repository. \ No newline at end of file diff --git a/packages/hardhat-graph-protocol/eslint.config.js b/packages/hardhat-graph-protocol/eslint.config.js new file mode 100644 index 000000000..ed2d51271 --- /dev/null +++ b/packages/hardhat-graph-protocol/eslint.config.js @@ -0,0 +1,14 @@ +const config = require('eslint-graph-config') + +module.exports = [ + ...config.default, + { + rules: { + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', + }, + }, +] diff --git a/packages/hardhat-graph-protocol/package.json b/packages/hardhat-graph-protocol/package.json new file mode 100644 index 000000000..b71d8620b --- /dev/null +++ b/packages/hardhat-graph-protocol/package.json @@ -0,0 +1,55 @@ +{ + "name": "hardhat-graph-protocol", + "version": "0.0.1", + "description": "A hardhat plugin that extends the runtime environment to inject additional functionality related to the usage of the Graph Protocol.", + "keywords": [ + "ethereum", + "smart-contracts", + "hardhat", + "hardhat-plugin", + "graph", + "graph-protocol", + "horizon" + ], + "author": "Tomás Migone ", + "license": "MIT", + "main": "dist/src/index.js", + "types": "dist/src/index.d.ts", + "scripts": { + "build": "tsc", + "clean": "rm -rf dist", + "lint": "eslint '**/*.{js,ts}' --fix", + "test": "mocha --exit --recursive 'test/**/*.test.ts'", + "prepublishOnly": "npm run build" + }, + "files": [ + "dist/", + "src/", + "LICENSE", + "README.md" + ], + "dependencies": { + "@graphprotocol/contracts": "workspace:^7.0.0", + "@graphprotocol/horizon": "workspace:^0.0.1", + "@graphprotocol/subgraph-service": "workspace:^0.0.1", + "@nomicfoundation/hardhat-ethers": "^3.0.8", + "debug": "^4.3.7" + }, + "devDependencies": { + "@types/chai": "^4.0.0", + "@types/debug": "^4.1.12", + "@types/mocha": "^10.0.9", + "chai": "^4.0.0", + "eslint": "^8.56.0", + "eslint-graph-config": "workspace:^0.0.1", + "ethers": "^6.13.4", + "hardhat": "^2.22.16", + "mocha": "^10.8.2", + "ts-node": "^8.0.0", + "typescript": "^5.6.3" + }, + "peerDependencies": { + "ethers": "^6.13.4", + "hardhat": "^2.22.16" + } +} diff --git a/packages/hardhat-graph-protocol/src/config.ts b/packages/hardhat-graph-protocol/src/config.ts new file mode 100644 index 000000000..acd966db0 --- /dev/null +++ b/packages/hardhat-graph-protocol/src/config.ts @@ -0,0 +1,48 @@ +import fs from 'fs' + +import { GraphPluginError } from './sdk/utils/error' +import { logDebug } from './logger' +import { normalizePath } from './sdk/utils/path' + +import type { GraphDeployment, GraphRuntimeEnvironmentOptions } from './types' +import type { HardhatRuntimeEnvironment } from 'hardhat/types' + +export function getAddressBookPath( + deployment: GraphDeployment, + hre: HardhatRuntimeEnvironment, + opts: GraphRuntimeEnvironmentOptions, +): string { + const optsPath = getPath(opts.deployments?.[deployment]) + const networkPath = getPath(hre.network.config.deployments?.[deployment]) + const globalPath = getPath(hre.config.graph?.deployments?.[deployment]) + + logDebug(`Getting address book path...`) + logDebug(`Graph base dir: ${hre.config.paths.graph}`) + logDebug(`1) opts: ${optsPath}`) + logDebug(`2) network: ${networkPath}`) + logDebug(`3) global: ${globalPath}`) + + const addressBookPath = optsPath ?? networkPath ?? globalPath + if (addressBookPath === undefined) { + throw new GraphPluginError('Must set a an addressBook path!') + } + + const normalizedAddressBookPath = normalizePath(addressBookPath, hre.config.paths.graph) + if (!fs.existsSync(normalizedAddressBookPath)) { + throw new GraphPluginError(`Address book not found: ${normalizedAddressBookPath}`) + } + + logDebug(`Address book path found: ${normalizedAddressBookPath}`) + return normalizedAddressBookPath +} + +function getPath(value: string | { + addressBook: string +} | undefined): string | undefined { + if (typeof value === 'string') { + return value + } else if (value && typeof value == 'object') { + return value.addressBook + } + return +} diff --git a/packages/hardhat-graph-protocol/src/deployment-list.ts b/packages/hardhat-graph-protocol/src/deployment-list.ts new file mode 100644 index 000000000..fb3e46fab --- /dev/null +++ b/packages/hardhat-graph-protocol/src/deployment-list.ts @@ -0,0 +1,19 @@ +import type { GraphHorizonAddressBook, GraphHorizonContracts } from './sdk/deployments/horizon' +import type { SubgraphServiceAddressBook, SubgraphServiceContracts } from './sdk/deployments/subgraph-service' + +// List of supported Graph deployments +export const GraphDeploymentsList = [ + 'horizon', + 'subgraphService', +] as const + +export type GraphDeploymentRuntimeEnvironmentMap = { + horizon: { + contracts: GraphHorizonContracts + addressBook: GraphHorizonAddressBook + } + subgraphService: { + contracts: SubgraphServiceContracts + addressBook: SubgraphServiceAddressBook + } +} diff --git a/packages/hardhat-graph-protocol/src/gre.ts b/packages/hardhat-graph-protocol/src/gre.ts new file mode 100644 index 000000000..028df6229 --- /dev/null +++ b/packages/hardhat-graph-protocol/src/gre.ts @@ -0,0 +1,84 @@ +import path from 'path' + +import { getAddressBookPath } from './config' +import { HardhatEthersProvider } from '@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider' +import { logDebug } from './logger' + +import { GraphHorizonAddressBook } from './sdk/deployments/horizon' +import { SubgraphServiceAddressBook } from './sdk/deployments/subgraph-service' + +import { assertGraphRuntimeEnvironment, type GraphRuntimeEnvironmentOptions, isGraphDeployment } from './types' +import type { HardhatConfig, HardhatRuntimeEnvironment, HardhatUserConfig } from 'hardhat/types' + +export const greExtendConfig = (config: HardhatConfig, userConfig: Readonly) => { + const userPath = userConfig.paths?.graph + + let newPath: string + if (userPath === undefined) { + newPath = config.paths.root + } else { + if (path.isAbsolute(userPath)) { + newPath = userPath + } else { + newPath = path.normalize(path.join(config.paths.root, userPath)) + } + } + + config.paths.graph = newPath +} + +export const greExtendEnvironment = (hre: HardhatRuntimeEnvironment) => { + hre.graph = (opts: GraphRuntimeEnvironmentOptions = { deployments: {} }) => { + logDebug('*** Initializing Graph Runtime Environment (GRE) ***') + logDebug(`Main network: ${hre.network.name}`) + const chainId = hre.network.config.chainId + if (chainId === undefined) { + throw new Error('Please define chainId in your Hardhat network configuration') + } + logDebug(`Chain Id: ${chainId}`) + + const deployments = [ + ...Object.keys(opts.deployments ?? {}), + ...Object.keys(hre.network.config.deployments ?? {}), + ...Object.keys(hre.config.graph?.deployments ?? {}), + ].filter(v => isGraphDeployment(v)) + logDebug(`Detected deployments: ${deployments.join(', ')}`) + + // Build the Graph Runtime Environment (GRE) for each deployment + const provider = new HardhatEthersProvider(hre.network.provider, hre.network.name) + const greDeployments: Record = {} + for (const deployment of deployments) { + logDebug(`== Initializing deployment: ${deployment} ==`) + const addressBookPath = getAddressBookPath(deployment, hre, opts) + let addressBook + + switch (deployment) { + case 'horizon': + addressBook = new GraphHorizonAddressBook(addressBookPath, chainId) + greDeployments.horizon = { + addressBook: addressBook, + contracts: addressBook.loadContracts(provider), + } + break + case 'subgraphService': + addressBook = new SubgraphServiceAddressBook(addressBookPath, chainId) + greDeployments.subgraphService = { + addressBook: addressBook, + contracts: addressBook.loadContracts(provider), + } + break + default: + break + } + } + + const gre = { + ...greDeployments, + provider, + chainId, + } + assertGraphRuntimeEnvironment(gre) + logDebug('GRE initialized successfully!') + return gre + } +} diff --git a/packages/hardhat-graph-protocol/src/index.ts b/packages/hardhat-graph-protocol/src/index.ts new file mode 100644 index 000000000..f4284811c --- /dev/null +++ b/packages/hardhat-graph-protocol/src/index.ts @@ -0,0 +1,10 @@ +import { extendConfig, extendEnvironment } from 'hardhat/config' +import { greExtendConfig, greExtendEnvironment } from './gre' + +// This import is needed to let the TypeScript compiler know that it should include your type +// extensions in your npm package's types file. +import './type-extensions' + +// ** Graph Runtime Environment (GRE) extensions for the HRE ** +extendConfig(greExtendConfig) +extendEnvironment(greExtendEnvironment) diff --git a/packages/hardhat-graph-protocol/src/logger.ts b/packages/hardhat-graph-protocol/src/logger.ts new file mode 100644 index 000000000..3529373f6 --- /dev/null +++ b/packages/hardhat-graph-protocol/src/logger.ts @@ -0,0 +1,7 @@ +import debug from 'debug' + +const LOG_BASE = 'hardhat:graph' + +export const logDebug = debug(`${LOG_BASE}:debug`) +export const logWarn = debug(`${LOG_BASE}:warn`) +export const logError = debug(`${LOG_BASE}:error`) diff --git a/packages/hardhat-graph-protocol/src/sdk/address-book.ts b/packages/hardhat-graph-protocol/src/sdk/address-book.ts new file mode 100644 index 000000000..b9b16cedf --- /dev/null +++ b/packages/hardhat-graph-protocol/src/sdk/address-book.ts @@ -0,0 +1,227 @@ +import fs from 'fs' + +import { AssertionError } from 'assert' +import { assertObject } from './utils/assertion' + +import { ContractList, loadContract } from './lib/contract' +import { logDebug, logError, logWarn } from '../logger' +import { Provider, Signer } from 'ethers' + +export type AddressBookJson< + ChainId extends number = number, + ContractName extends string = string, +> = Record> + +export type AddressBookEntry = { + address: string + proxy?: boolean + implementation?: AddressBookEntry +} + +/** + * An abstract class to manage an address book + * The address book must be a JSON file with the following structure: + * { + * "": { + * "": { + * "address": "
", + * "proxy": true, // optional + * "implementation": { ... } // optional, nested contract structure + * ... + * } + * } + * Uses generics to allow specifying a ContractName type to indicate which contracts should be loaded from the address book + * Implementation should provide: + * - `isContractName(name: string): name is ContractName`, a type predicate to check if a given string is a ContractName + * - `loadContracts(signerOrProvider?: Signer | Provider): ContractList` to load contracts from the address book + */ +export abstract class AddressBook< + ChainId extends number = number, + ContractName extends string = string, +> { + // The path to the address book file + public file: string + + // The chain id of the network the address book should be loaded for + public chainId: ChainId + + // The raw contents of the address book file + public addressBook: AddressBookJson + + // Contracts in the address book of type ContractName + private validContracts: ContractName[] = [] + + // Contracts in the address book that are not of type ContractName, these are ignored + private invalidContracts: string[] = [] + + // Type predicate to check if a given string is a ContractName + abstract isContractName(name: string): name is ContractName + + // Method to load valid contracts from the address book + abstract loadContracts(signerOrProvider?: Signer | Provider): ContractList + + /** + * Constructor for the `AddressBook` class + * + * @param _file the path to the address book file + * @param _chainId the chain id of the network the address book should be loaded for + * @param _strictAssert + * + * @throws AssertionError if the target file is not a valid address book + * @throws Error if the target file does not exist + */ + constructor(_file: string, _chainId: ChainId, _strictAssert = false) { + this.file = _file + this.chainId = _chainId + + logDebug(`Loading address book from ${this.file}.`) + if (!fs.existsSync(this.file)) throw new Error(`Address book path provided does not exist!`) + + // Load address book and validate its shape + // If it's empty, initialize it with an empty object + const fileContents = JSON.parse(fs.readFileSync(this.file, 'utf8') || '{}') + if (!fileContents[this.chainId]) { + fileContents[this.chainId] = {} as Record + } + this.assertAddressBookJson(fileContents) + this.addressBook = fileContents + this._parseAddressBook() + } + + /** + * List entry names in the address book + * + * @returns a list with all the names of the entries in the address book + */ + listEntries(): ContractName[] { + return this.validContracts + } + + /** + * Get an entry from the address book + * + * @param name the name of the contract to get + * @returns the address book entry for the contract + * Returns an empty address book entry if the contract is not found + */ + getEntry(name: ContractName): AddressBookEntry { + try { + const entry = this.addressBook[this.chainId][name] + this._assertAddressBookEntry(entry) + return entry + } catch (_) { + // TODO: should we throw instead? + return { address: '0x0000000000000000000000000000000000000000' } + } + } + + /** + * Save an entry to the address book + * + * @param name the name of the contract to save + * @param entry the address book entry for the contract + */ + setEntry(name: ContractName, entry: AddressBookEntry): void { + this._assertAddressBookEntry(entry) + this.addressBook[this.chainId][name] = entry + try { + fs.writeFileSync(this.file, JSON.stringify(this.addressBook, null, 2)) + } catch (e: unknown) { + if (e instanceof Error) logError(`Error saving entry: ${e.message}`) + else logError(`Error saving entry`) + } + } + + /** + * Parse address book and separate valid and invalid contracts + */ + _parseAddressBook() { + const contractList = this.addressBook[this.chainId] + + const contractNames = contractList ? Object.keys(contractList) : [] + for (const contract of contractNames) { + if (!this.isContractName(contract)) { + this.invalidContracts.push(contract) + } else { + this.validContracts.push(contract) + } + } + + if (this.invalidContracts.length > 0) { + logWarn(`Detected invalid contracts in address book - these will not be loaded: ${this.invalidContracts.join(', ')}`) + } + } + + /** + * Loads all valid contracts from an address book + * + * @param addressBook Address book to use + * @param signerOrProvider Signer or provider to use + * @returns the loaded contracts + */ + _loadContracts( + artifactsPath: string | string[] | Record, + signerOrProvider?: Signer | Provider, + ): ContractList { + const contracts = {} as ContractList + if (this.listEntries().length == 0) { + throw Error('No valid contracts found in address book') + } + for (const contractName of this.listEntries()) { + const artifactPath = typeof artifactsPath === 'object' && !Array.isArray(artifactsPath) + ? artifactsPath[contractName] + : artifactsPath + + if (Array.isArray(artifactPath) + ? !artifactPath.some(fs.existsSync) + : !fs.existsSync(artifactPath)) { + logWarn(`Could not load contract ${contractName} - artifact not found`) + logWarn(artifactPath) + continue + } + logDebug(`Loading contract ${contractName}`) + + const contract = loadContract( + contractName, + this.getEntry(contractName).address, + artifactPath, + signerOrProvider, + ) + contracts[contractName] = contract + } + + return contracts + } + + // Asserts the provided object has the correct JSON format shape for an address book + // This method can be overridden by subclasses to provide custom validation + assertAddressBookJson( + json: unknown, + ): asserts json is AddressBookJson { + this._assertAddressBookJson(json) + } + + // Asserts the provided object is a valid address book + _assertAddressBookJson(json: unknown): asserts json is AddressBookJson { + assertObject(json, 'Assertion failed: address book is not an object') + + const contractList = json[this.chainId] + assertObject(contractList, 'Assertion failed: chain contract list is not an object') + + const contractNames = Object.keys(contractList) + for (const contractName of contractNames) { + this._assertAddressBookEntry(contractList[contractName]) + } + } + + // Asserts the provided object is a valid address book entry + _assertAddressBookEntry(json: unknown): asserts json is AddressBookEntry { + assertObject(json) + + if (typeof json.address !== 'string') throw new AssertionError({ message: 'Invalid address' }) + if (json.proxy && typeof json.proxy !== 'boolean') + throw new AssertionError({ message: 'Invalid proxy' }) + if (json.implementation && typeof json.implementation !== 'object') + throw new AssertionError({ message: 'Invalid implementation' }) + } +} diff --git a/packages/hardhat-graph-protocol/src/sdk/deployments/horizon/address-book.ts b/packages/hardhat-graph-protocol/src/sdk/deployments/horizon/address-book.ts new file mode 100644 index 000000000..4511757da --- /dev/null +++ b/packages/hardhat-graph-protocol/src/sdk/deployments/horizon/address-book.ts @@ -0,0 +1,48 @@ +import { GraphHorizonArtifactsMap, GraphHorizonContractNameList } from './contracts' +import { logDebug, logError } from '../../../logger' +import { Provider, Signer } from 'ethers' +import { AddressBook } from '../../address-book' +import { assertObject } from '../../utils/assertion' + +import type { GraphHorizonContractName, GraphHorizonContracts } from './contracts' + +export class GraphHorizonAddressBook extends AddressBook { + isContractName(name: unknown): name is GraphHorizonContractName { + return ( + typeof name === 'string' + && GraphHorizonContractNameList.includes(name as GraphHorizonContractName) + ) + } + + loadContracts( + signerOrProvider?: Signer | Provider, + ): GraphHorizonContracts { + logDebug('Loading Graph Horizon contracts...') + + const contracts = this._loadContracts( + GraphHorizonArtifactsMap, + signerOrProvider, + ) + this._assertGraphHorizonContracts(contracts) + + // Aliases + contracts.GraphToken = contracts.L2GraphToken + contracts.GraphTokenGateway = contracts.L2GraphTokenGateway + + return contracts + } + + _assertGraphHorizonContracts( + contracts: unknown, + ): asserts contracts is GraphHorizonContracts { + assertObject(contracts) + + // Assert that all GraphHorizonContracts were loaded + for (const contractName of GraphHorizonContractNameList) { + if (!contracts[contractName]) { + const errMessage = `Missing GraphHorizon contract: ${contractName}` + logError(errMessage) + } + } + } +} diff --git a/packages/hardhat-graph-protocol/src/sdk/deployments/horizon/contracts.ts b/packages/hardhat-graph-protocol/src/sdk/deployments/horizon/contracts.ts new file mode 100644 index 000000000..7cb828e73 --- /dev/null +++ b/packages/hardhat-graph-protocol/src/sdk/deployments/horizon/contracts.ts @@ -0,0 +1,75 @@ +import path from 'path' + +import type { + Controller, + EpochManager, + GraphProxyAdmin, + L2GraphToken, + L2GraphTokenGateway, + RewardsManager, +} from '@graphprotocol/contracts' +import type { + GraphPayments, + HorizonStaking, + PaymentsEscrow, + TAPCollector, +} from '@graphprotocol/horizon' +import type { ContractList } from '../../lib/contract' + +export const GraphHorizonContractNameList = [ + // @graphprotocol/contracts + 'GraphProxyAdmin', + 'Controller', + 'EpochManager', + 'RewardsManager', + 'L2GraphToken', + 'L2GraphTokenGateway', + + // @graphprotocol/horizon + 'HorizonStaking', + 'GraphPayments', + 'PaymentsEscrow', + 'TAPCollector', +] as const + +const root = path.resolve(__dirname, '../../../../..') // hardhat-graph-protocol root +export const CONTRACTS_ARTIFACTS_PATH = path.resolve(root, 'node_modules', '@graphprotocol/contracts/build/contracts') +export const HORIZON_ARTIFACTS_PATH = path.resolve(root, 'node_modules', '@graphprotocol/horizon/build/contracts') + +export const GraphHorizonArtifactsMap = { + // @graphprotocol/contracts + GraphProxyAdmin: CONTRACTS_ARTIFACTS_PATH, + Controller: CONTRACTS_ARTIFACTS_PATH, + EpochManager: CONTRACTS_ARTIFACTS_PATH, + RewardsManager: CONTRACTS_ARTIFACTS_PATH, + L2GraphToken: CONTRACTS_ARTIFACTS_PATH, + L2GraphTokenGateway: CONTRACTS_ARTIFACTS_PATH, + + // @graphprotocol/horizon + HorizonStaking: HORIZON_ARTIFACTS_PATH, + GraphPayments: HORIZON_ARTIFACTS_PATH, + PaymentsEscrow: HORIZON_ARTIFACTS_PATH, + TAPCollector: HORIZON_ARTIFACTS_PATH, +} as const + +export interface GraphHorizonContracts extends ContractList { + // @graphprotocol/contracts + EpochManager: EpochManager + RewardsManager: RewardsManager + GraphProxyAdmin: GraphProxyAdmin + Controller: Controller + L2GraphToken: L2GraphToken + L2GraphTokenGateway: L2GraphTokenGateway + + // @graphprotocol/horizon + HorizonStaking: HorizonStaking + GraphPayments: GraphPayments + PaymentsEscrow: PaymentsEscrow + TAPCollector: TAPCollector + + // Aliases + GraphToken: L2GraphToken + GraphTokenGateway: L2GraphTokenGateway +} + +export type GraphHorizonContractName = (typeof GraphHorizonContractNameList)[number] diff --git a/packages/hardhat-graph-protocol/src/sdk/deployments/horizon/index.ts b/packages/hardhat-graph-protocol/src/sdk/deployments/horizon/index.ts new file mode 100644 index 000000000..1a451a161 --- /dev/null +++ b/packages/hardhat-graph-protocol/src/sdk/deployments/horizon/index.ts @@ -0,0 +1,6 @@ +import { GraphHorizonAddressBook } from './address-book' + +import type { GraphHorizonContractName, GraphHorizonContracts } from './contracts' + +export { GraphHorizonAddressBook } +export type { GraphHorizonContractName, GraphHorizonContracts } diff --git a/packages/hardhat-graph-protocol/src/sdk/deployments/subgraph-service/address-book.ts b/packages/hardhat-graph-protocol/src/sdk/deployments/subgraph-service/address-book.ts new file mode 100644 index 000000000..3fca297a0 --- /dev/null +++ b/packages/hardhat-graph-protocol/src/sdk/deployments/subgraph-service/address-book.ts @@ -0,0 +1,48 @@ +import { logDebug, logError } from '../../../logger' +import { Provider, Signer } from 'ethers' +import { SubgraphServiceArtifactsMap, SubgraphServiceContractNameList } from './contracts' +import { AddressBook } from '../../address-book' +import { assertObject } from '../../utils/assertion' + +import type { SubgraphServiceContractName, SubgraphServiceContracts } from './contracts' + +export class SubgraphServiceAddressBook extends AddressBook { + isContractName(name: unknown): name is SubgraphServiceContractName { + return ( + typeof name === 'string' + && SubgraphServiceContractNameList.includes(name as SubgraphServiceContractName) + ) + } + + loadContracts( + signerOrProvider?: Signer | Provider, + ): SubgraphServiceContracts { + logDebug('Loading Subgraph Service contracts...') + + const contracts = this._loadContracts( + SubgraphServiceArtifactsMap, + signerOrProvider, + ) + this._assertSubgraphServiceContracts(contracts) + + // Aliases + contracts.Curation = contracts.L2Curation + contracts.GNS = contracts.L2GNS + + return contracts + } + + _assertSubgraphServiceContracts( + contracts: unknown, + ): asserts contracts is SubgraphServiceContracts { + assertObject(contracts) + + // Assert that all SubgraphServiceContracts were loaded + for (const contractName of SubgraphServiceContractNameList) { + if (!contracts[contractName]) { + const errMessage = `Missing SubgraphService contract: ${contractName}` + logError(errMessage) + } + } + } +} diff --git a/packages/hardhat-graph-protocol/src/sdk/deployments/subgraph-service/contracts.ts b/packages/hardhat-graph-protocol/src/sdk/deployments/subgraph-service/contracts.ts new file mode 100644 index 000000000..7d0ef1ebc --- /dev/null +++ b/packages/hardhat-graph-protocol/src/sdk/deployments/subgraph-service/contracts.ts @@ -0,0 +1,60 @@ +import path from 'path' + +import type { + L2Curation, + L2GNS, + ServiceRegistry, + SubgraphNFT, +} from '@graphprotocol/contracts' + +import type { + DisputeManager, + SubgraphService, +} from '@graphprotocol/subgraph-service' +import type { ContractList } from '../../lib/contract' + +export const SubgraphServiceContractNameList = [ + // @graphprotocol/contracts + 'L2Curation', + 'L2GNS', + 'SubgraphNFT', + 'ServiceRegistry', + + // @graphprotocol/subgraph-service + 'SubgraphService', + 'DisputeManager', +] as const + +const root = path.resolve(__dirname, '../../../../..') // hardhat-graph-protocol root +export const CONTRACTS_ARTIFACTS_PATH = path.resolve(root, 'node_modules', '@graphprotocol/contracts/build/contracts') +export const SUBGRAPH_SERVICE_ARTIFACTS_PATH = path.resolve(root, 'node_modules', '@graphprotocol/subgraph-service/build/contracts') + +export const SubgraphServiceArtifactsMap = { + // @graphprotocol/contracts + L2Curation: CONTRACTS_ARTIFACTS_PATH, + L2GNS: CONTRACTS_ARTIFACTS_PATH, + SubgraphNFT: CONTRACTS_ARTIFACTS_PATH, + ServiceRegistry: CONTRACTS_ARTIFACTS_PATH, + + // @graphprotocol/subgraph-service + SubgraphService: SUBGRAPH_SERVICE_ARTIFACTS_PATH, + DisputeManager: SUBGRAPH_SERVICE_ARTIFACTS_PATH, +} as const + +export interface SubgraphServiceContracts extends ContractList { + // @graphprotocol/contracts + L2Curation: L2Curation + L2GNS: L2GNS + SubgraphNFT: SubgraphNFT + ServiceRegistry: ServiceRegistry + + // @graphprotocol/subgraph-service + SubgraphService: SubgraphService + DisputeManager: DisputeManager + + // Aliases + Curation: L2Curation + GNS: L2GNS +} + +export type SubgraphServiceContractName = (typeof SubgraphServiceContractNameList)[number] diff --git a/packages/hardhat-graph-protocol/src/sdk/deployments/subgraph-service/index.ts b/packages/hardhat-graph-protocol/src/sdk/deployments/subgraph-service/index.ts new file mode 100644 index 000000000..8f9d7bfa6 --- /dev/null +++ b/packages/hardhat-graph-protocol/src/sdk/deployments/subgraph-service/index.ts @@ -0,0 +1,6 @@ +import { SubgraphServiceAddressBook } from './address-book' + +import type { SubgraphServiceContractName, SubgraphServiceContracts } from './contracts' + +export { SubgraphServiceAddressBook } +export type { SubgraphServiceContractName, SubgraphServiceContracts } diff --git a/packages/hardhat-graph-protocol/src/sdk/lib/artifact.ts b/packages/hardhat-graph-protocol/src/sdk/lib/artifact.ts new file mode 100644 index 000000000..eff3fc601 --- /dev/null +++ b/packages/hardhat-graph-protocol/src/sdk/lib/artifact.ts @@ -0,0 +1,41 @@ +import { Artifacts } from 'hardhat/internal/artifacts' +import { logError } from '../../logger' + +import type { Artifact } from 'hardhat/types' + +/** + * Load a contract's artifact from the build output folder + * If multiple build output folders are provided, they will be searched in order + * @param name Name of the contract + * @param buildDir Path to the build output folder(s). Defaults to `build/contracts`. + * @returns The artifact corresponding to the contract name + */ +export const loadArtifact = (name: string, buildDir?: string[] | string): Artifact => { + let artifacts: Artifacts + let artifact: Artifact | undefined + buildDir = buildDir ?? ['build/contracts'] + + if (typeof buildDir === 'string') { + buildDir = [buildDir] + } + + for (const dir of buildDir) { + try { + artifacts = new Artifacts(dir) + artifact = artifacts.readArtifactSync(name) + break + } catch (error) { + if (error instanceof Error) { + logError(`Could not load artifact ${name} from ${dir} - ${error.message}`) + } else { + logError(`Could not load artifact ${name} from ${dir}`) + } + } + } + + if (artifact === undefined) { + throw new Error(`Could not load artifact ${name}`) + } + + return artifact +} diff --git a/packages/hardhat-graph-protocol/src/sdk/lib/contract.ts b/packages/hardhat-graph-protocol/src/sdk/lib/contract.ts new file mode 100644 index 000000000..827237756 --- /dev/null +++ b/packages/hardhat-graph-protocol/src/sdk/lib/contract.ts @@ -0,0 +1,39 @@ +import { Contract, Provider, Signer } from 'ethers' +import { loadArtifact } from './artifact' + +export type ContractList = Partial> + +/** + * Loads a contract from an address book + * + * @param name Name of the contract + * @param addressBook Address book to use + * @param signerOrProvider Signer or provider to use + * @param enableTxLogging Enable transaction logging to console and output file. Defaults to `true` + * @param optional If true, the contract is optional and will not throw if it cannot be loaded + * @returns the loaded contract + * + * @throws Error if the contract could not be loaded + */ +export function loadContract( + name: ContractName, + address: string, + artifactsPath: string | string[], + signerOrProvider?: Signer | Provider, +): Contract { + try { + let contract = new Contract(address, loadArtifact(name, artifactsPath).abi, signerOrProvider) + + if (signerOrProvider) { + contract = contract.connect(signerOrProvider) as Contract + } + + return contract + } catch (err: unknown) { + if (err instanceof Error) { + throw new Error(`Could not load contract ${name} - ${err.message}`) + } else { + throw new Error(`Could not load contract ${name}`) + } + } +} diff --git a/packages/hardhat-graph-protocol/src/sdk/utils/assertion.ts b/packages/hardhat-graph-protocol/src/sdk/utils/assertion.ts new file mode 100644 index 000000000..f215a9497 --- /dev/null +++ b/packages/hardhat-graph-protocol/src/sdk/utils/assertion.ts @@ -0,0 +1,11 @@ +import { AssertionError } from 'assert' + +export function assertObject( + value: unknown, + errorMessage?: string, +): asserts value is Record { + if (typeof value !== 'object' || value == null) + throw new AssertionError({ + message: errorMessage ?? 'Not an object', + }) +} diff --git a/packages/hardhat-graph-protocol/src/sdk/utils/error.ts b/packages/hardhat-graph-protocol/src/sdk/utils/error.ts new file mode 100644 index 000000000..09df0ac3d --- /dev/null +++ b/packages/hardhat-graph-protocol/src/sdk/utils/error.ts @@ -0,0 +1,9 @@ +import { HardhatPluginError } from 'hardhat/plugins' +import { logError } from '../../logger' + +export class GraphPluginError extends HardhatPluginError { + constructor(message: string) { + super('GraphRuntimeEnvironment', message) + logError(message) + } +} diff --git a/packages/hardhat-graph-protocol/src/sdk/utils/path.ts b/packages/hardhat-graph-protocol/src/sdk/utils/path.ts new file mode 100644 index 000000000..3fcf810d7 --- /dev/null +++ b/packages/hardhat-graph-protocol/src/sdk/utils/path.ts @@ -0,0 +1,8 @@ +import path from 'path' + +export function normalizePath(_path: string, graphPath?: string): string { + if (!path.isAbsolute(_path) && graphPath !== undefined) { + _path = path.join(graphPath, _path) + } + return _path +} diff --git a/packages/hardhat-graph-protocol/src/type-extensions.ts b/packages/hardhat-graph-protocol/src/type-extensions.ts new file mode 100644 index 000000000..f42df8eaa --- /dev/null +++ b/packages/hardhat-graph-protocol/src/type-extensions.ts @@ -0,0 +1,44 @@ +// To extend one of Hardhat's types, you need to import the module where it has been defined, and redeclare it. +import 'hardhat/types/config' +import 'hardhat/types/runtime' +import type { GraphDeployments, GraphRuntimeEnvironment, GraphRuntimeEnvironmentOptions } from './types' + +declare module 'hardhat/types/runtime' { + interface HardhatRuntimeEnvironment { + graph: (opts?: GraphRuntimeEnvironmentOptions) => GraphRuntimeEnvironment + } +} + +declare module 'hardhat/types/config' { + interface HardhatConfig { + graph: GraphRuntimeEnvironmentOptions + } + + interface HardhatUserConfig { + graph: GraphRuntimeEnvironmentOptions + } + + interface HardhatNetworkConfig { + deployments?: GraphDeployments + } + + interface HardhatNetworkUserConfig { + deployments?: GraphDeployments + } + + interface HttpNetworkConfig { + deployments?: GraphDeployments + } + + interface HttpNetworkUserConfig { + deployments?: GraphDeployments + } + + interface ProjectPathsConfig { + graph?: string + } + + interface ProjectPathsUserConfig { + graph?: string + } +} diff --git a/packages/hardhat-graph-protocol/src/types.ts b/packages/hardhat-graph-protocol/src/types.ts new file mode 100644 index 000000000..b15045849 --- /dev/null +++ b/packages/hardhat-graph-protocol/src/types.ts @@ -0,0 +1,57 @@ +import { type GraphDeploymentRuntimeEnvironmentMap, GraphDeploymentsList } from './deployment-list' +import type { HardhatEthersProvider } from '@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider' + +export type GraphDeployment = (typeof GraphDeploymentsList)[number] + +export type GraphDeployments = { + [deployment in GraphDeployment]?: string | { + addressBook: string + } +} + +export type GraphRuntimeEnvironmentOptions = { + deployments?: { + [deployment in GraphDeployment]?: string | { + addressBook: string + } + } +} + +export type GraphRuntimeEnvironment = { + [deployment in keyof GraphDeploymentRuntimeEnvironmentMap]?: GraphDeploymentRuntimeEnvironmentMap[deployment] +} & { + provider: HardhatEthersProvider + chainId: number +} + +export function isGraphDeployment(deployment: unknown): deployment is GraphDeployment { + return ( + typeof deployment === 'string' + && GraphDeploymentsList.includes(deployment as GraphDeployment) + ) +} + +export function assertGraphRuntimeEnvironment( + obj: unknown, +): obj is GraphRuntimeEnvironment { + if (typeof obj !== 'object' || obj === null) return false + + const deployments = obj as Partial + + for (const deployment in deployments) { + const environment = deployments[deployment as keyof GraphDeploymentRuntimeEnvironmentMap] + if (!environment || typeof environment !== 'object') { + return false + } + } + + if (typeof (obj as GraphRuntimeEnvironment).provider !== 'object') { + return false + } + + if (typeof (obj as GraphRuntimeEnvironment).chainId !== 'function') { + return false + } + + return true +} diff --git a/packages/hardhat-graph-protocol/test/config.test.ts b/packages/hardhat-graph-protocol/test/config.test.ts new file mode 100644 index 000000000..3cd005c31 --- /dev/null +++ b/packages/hardhat-graph-protocol/test/config.test.ts @@ -0,0 +1,75 @@ +import path from 'path' + +import { expect } from 'chai' +import { getAddressBookPath } from '../src/config' +import { loadHardhatContext } from './helpers' + +describe('GRE init functions', function () { + // No address book - should throw + describe('getAddressBookPath', function () { + it('should throw if no address book is specified', function () { + this.hre = loadHardhatContext('default-config', 'mainnet') + expect(() => getAddressBookPath('horizon', this.hre, {})).to.throw('Must set a an addressBook path!') + }) + + it('should throw if address book doesn\'t exist', function () { + this.hre = loadHardhatContext('invalid-address-book', 'mainnet') + expect(() => getAddressBookPath('horizon', this.hre, {})).to.throw(/Address book not found: /) + }) + + // Address book via opts should be used + it('should use opts parameter if available', function () { + this.hre = loadHardhatContext('network-address-book', 'mainnet') + const addressBook = getAddressBookPath('horizon', this.hre, { + deployments: { + horizon: { + addressBook: 'addresses-opt.json', + }, + }, + }) + expect(path.basename(addressBook)).to.equal('addresses-opt.json') + }) + + it('should use opts parameter if available - shortcut syntax', function () { + this.hre = loadHardhatContext('network-address-book', 'mainnet') + const addressBook = getAddressBookPath('horizon', this.hre, { + deployments: { + horizon: 'addresses-opt.json', + }, + }) + expect(path.basename(addressBook)).to.equal('addresses-opt.json') + }) + + // Address book via network config should be used + it('should use HH network config', function () { + this.hre = loadHardhatContext('network-address-book', 'mainnet') + const addressBook = getAddressBookPath('horizon', this.hre, {}) + expect(path.basename(addressBook)).to.equal('addresses-network.json') + }) + + it('should use HH network config - shortcut syntax', function () { + this.hre = loadHardhatContext('network-address-book', 'mainnet') + if (this.hre.network.config.deployments) { + this.hre.network.config.deployments.horizon = 'addresses-network-short.json' + } + const addressBook = getAddressBookPath('horizon', this.hre, {}) + expect(path.basename(addressBook)).to.equal('addresses-network-short.json') + }) + + // Address book via global config should be used + it('should use HH global config', function () { + this.hre = loadHardhatContext('global-address-book', 'mainnet') + const addressBook = getAddressBookPath('horizon', this.hre, {}) + expect(path.basename(addressBook)).to.equal('addresses-global.json') + }) + + it('should use HH global config - shortcut syntax', function () { + this.hre = loadHardhatContext('global-address-book', 'mainnet') + if (this.hre.config.graph.deployments) { + this.hre.config.graph.deployments.horizon = 'addresses-global-short.json' + } + const addressBook = getAddressBookPath('horizon', this.hre, {}) + expect(path.basename(addressBook)).to.equal('addresses-global-short.json') + }) + }) +}) diff --git a/packages/hardhat-graph-protocol/test/fixtures/default-config/hardhat.config.ts b/packages/hardhat-graph-protocol/test/fixtures/default-config/hardhat.config.ts new file mode 100644 index 000000000..17de4a585 --- /dev/null +++ b/packages/hardhat-graph-protocol/test/fixtures/default-config/hardhat.config.ts @@ -0,0 +1,8 @@ +module.exports = { + networks: { + mainnet: { + chainId: 1, + url: `https://mainnet.infura.io/v3/123456`, + }, + }, +} diff --git a/packages/hardhat-graph-protocol/test/fixtures/files/addresses-arbsep.json b/packages/hardhat-graph-protocol/test/fixtures/files/addresses-arbsep.json new file mode 100644 index 000000000..530fd98ae --- /dev/null +++ b/packages/hardhat-graph-protocol/test/fixtures/files/addresses-arbsep.json @@ -0,0 +1,226 @@ +{ + "421614": { + "HorizonStaking": { + "address": "0xFf2Ee30de92F276018642A59Fb7Be95b3F9088Af" + }, + "GraphPayments": { + "address": "0xf5B3661BbB8CD48571C7f41ba2D896a3589C9753" + }, + "PaymentsEscrow": { + "address": "0x09B985a2042848A08bA59060EaF0f07c6F5D4d54" + }, + "TAPCollector": { + "address": "0xacC71844EF6beEF70106ABe6E51013189A1f3738" + }, + "GraphProxyAdmin": { + "address": "0x7474a6cc5fAeDEc620Db0fa8E4da6eD58477042C", + "creationCodeHash": "0x68b304ac6bce7380d5e0f6b14a122f628bffebcc75f8205cb60f0baf578b79c3", + "runtimeCodeHash": "0x8d9ba87a745cf82ab407ebabe6c1490197084d320efb6c246d94bcc80e804417", + "txHash": "0x71b6defab0d3d7b711b7f6769f20a8c85bc9686eb5939b2a86dfaf587fceab17" + }, + "Controller": { + "address": "0x9DB3ee191681f092607035d9BDA6e59FbEaCa695", + "creationCodeHash": "0x5bde9a87bc4e8dd24d41900f0a19321c1dc6d3373d51bba093b130bb5b80a677", + "runtimeCodeHash": "0x7f0479db1d60ecf6295d92ea2359ebdd223640795613558b0594680f5d4922c9", + "txHash": "0xf7b4faa14f9d29bb62dec73fd163d1253184233012bcadf7ae78af7995017f29" + }, + "EpochManager": { + "address": "0x88b3C7f37253bAA1A9b95feAd69bD5320585826D", + "initArgs": ["0x9DB3ee191681f092607035d9BDA6e59FbEaCa695", "554"], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0x587ea6f421a08ab3a390103f63daba0529901f2e662ca7f6fe575674a439fa79", + "proxy": true, + "implementation": { + "address": "0x646627fa39ec6f6E757Cb4189bC54c92FFBb71da", + "creationCodeHash": "0x9947bd0a1f46027123b8fb4aec8b11af540aea587eb79642475d57b4e347078f", + "runtimeCodeHash": "0xe45a27197726de0e3149014823794708edd432ee56ec8358554c0d2365674ca0", + "txHash": "0x82653a0bd83e0541379b920415af94e4be1d732dfab720e5dead839062781c07" + } + }, + "L2GraphToken": { + "address": "0xf8c05dCF59E8B28BFD5eed176C562bEbcfc7Ac04", + "initArgs": ["0xadE6B8EB69a49B56929C1d4F4b428d791861dB6f"], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0xbb27939a4e4b5d92da8a10add4b7d0126e907da30b07b5f3d439f1c32a6c8e2c", + "proxy": true, + "implementation": { + "address": "0x4cf968bA38b43dd10be114daa7959C1b369479e5", + "creationCodeHash": "0x6c4146427aafa7375a569154be95c8c931bf83aab0315706dd78bdf79c889e4c", + "runtimeCodeHash": "0x004371d1d80011906953dcba17c648503fc94b94e1e0365c8d8c706ff91f93e9", + "txHash": "0x3fab5697addf0c0e16b8e2249f2b833c6f256e699b293d184089c96de8deaa44" + } + }, + "GraphCurationToken": { + "address": "0x00FBd5D46FFAc54862c1Dd27BE08924BB17f5CDa", + "creationCodeHash": "0x1ee42ee271cefe20c33c0de904501e618ac4b56debca67c634d0564cecea9ff2", + "runtimeCodeHash": "0x340e8f378c0117b300f3ec255bc5c3a273f9ab5bd2940fa8eb3b5065b21f86dc", + "txHash": "0x045d64dc3ebb7ae6c4976854ce0a797a04524d22a6ef5f526bfc27f744bc68e5" + }, + "ServiceRegistry": { + "address": "0x888541878CbDDEd880Cd58c728f1Af5C47343F86", + "initArgs": ["0x9DB3ee191681f092607035d9BDA6e59FbEaCa695"], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0xdaa1228e8cd8569c1e5562b63d2fd89caf897ab67da05922636d3309b838e289", + "proxy": true, + "implementation": { + "address": "0x05E732280bf9F37054346Cb83f5Fd58C5B44F6A8", + "creationCodeHash": "0xec9cb879003a06609541ad87efd4bc5dfc8ea60e4e77cfa5ae2cb5208742e7bc", + "runtimeCodeHash": "0x5161b534164413a88d851832f9c9d1dd1bca32fe2bbb62bb35d112c1dc8b69ab", + "txHash": "0xe1fce867f5dd708e60518b7f257fdbcb28f460d1e3b82045b82d03e64345b210" + } + }, + "L2Curation": { + "address": "0xDe761f075200E75485F4358978FB4d1dC8644FD5", + "initArgs": [ + "0x9DB3ee191681f092607035d9BDA6e59FbEaCa695", + "0x00FBd5D46FFAc54862c1Dd27BE08924BB17f5CDa", + "10000", + "1" + ], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0xe9298239bcb3c386cf66e6dd493cf6e7cdd9771c65fa2225e0b34d17550d6805", + "proxy": true, + "implementation": { + "address": "0xd90022aB67920212D0F902F5c427DE82732DE136", + "creationCodeHash": "0x2287d9023bf7d91e688e1eb029eff7657ef3b87e37b5222b01fd50985d0928f9", + "runtimeCodeHash": "0xd799b2b74e9634d6b6ef15b5710409264bed04a60f9519b9d8f05ac183199d16", + "txHash": "0x436bcf91fed712dc8d54f449726b2078fb63cd770f90b492a9622efac5817762" + } + }, + "SubgraphNFTDescriptor": { + "address": "0x4032F7B6b27FfC9862106f826379DaB1716C71d7", + "creationCodeHash": "0xf16e8ff11d852eea165195ac9e0dfa00f98e48f6ce3c77c469c7df9bf195b651", + "runtimeCodeHash": "0x39583196f2bcb85789b6e64692d8c0aa56f001c46f0ca3d371abbba2c695860f", + "txHash": "0xb7e7aeeecc693f34f491b01c56950533119810a4e3e2642081efc127f11cb782" + }, + "SubgraphNFT": { + "address": "0xF21Df5BbA7EB9b54D8F60C560aFb9bA63e6aED1A", + "constructorArgs": ["0xadE6B8EB69a49B56929C1d4F4b428d791861dB6f"], + "creationCodeHash": "0xc1e58864302084de282dffe54c160e20dd96c6cfff45e00e6ebfc15e04136982", + "runtimeCodeHash": "0x7216e736a8a8754e88688fbf5c0c7e9caf35c55ecc3a0c5a597b951c56cf7458", + "txHash": "0x1309c1caea76f4014ba612de092cc746816119b1440d635d11b6bc7e361a32b0" + }, + "L2GNS": { + "address": "0x3133948342F35b8699d8F94aeE064AbB76eDe965", + "initArgs": [ + "0x9DB3ee191681f092607035d9BDA6e59FbEaCa695", + "0xF21Df5BbA7EB9b54D8F60C560aFb9bA63e6aED1A" + ], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0x137140783a99a3e9a60048d607124626ca87e2b972e8cc05efb41ac87c3cbcc4", + "proxy": true, + "implementation": { + "address": "0x00CBF5024d454255577Bf2b0fB6A43328a6828c9", + "creationCodeHash": "0xd71f45e6c194920a26f90fcec96d8c3375f02c5aef8ad90c1be24e906ffe8342", + "runtimeCodeHash": "0x68ec24512fedb866d7ba7ba6c02160317d0ca34eaacd23bddcc62d2cbcd9869c", + "txHash": "0x54619944731edec530b7b0cd587f9c2faae332aa1671fe5e8d7e7e5c7e291a77" + } + }, + "StakingExtension": { + "address": "0x05709dd705A5674346B7206a2bC657C8bAb3301B", + "creationCodeHash": "0x7ae74140871330ecabb7040182dc8288c2c84693393a519230036f39c2281138", + "runtimeCodeHash": "0x4994aa74e9e29c36a8158af690a245ccd1cf4d955223e5fcb1ca62810b37ed57", + "txHash": "0xbe1ff9cb949a53209b778708265740dfa2a08a93cfce4c897a53989a5d93f8c1" + }, + "L2Staking": { + "address": "0x865365C425f3A593Ffe698D9c4E6707D14d51e08", + "initArgs": [ + "0x9DB3ee191681f092607035d9BDA6e59FbEaCa695", + "100000000000000000000000", + "6646", + "10000", + "100000", + "8", + "12", + "16", + "100,100,60,100", + "0x876fB4B13D7Ed146757D3664B7E962b36936001C" + ], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0x326cf1f2849da4bb4d7e39f2783779e3c99fa48e4ee8ef004cfdd50c62e775df", + "proxy": true, + "implementation": { + "address": "0xD07dFD514dc1b57020e6C1F49e05c48d0658C99f", + "creationCodeHash": "0x6a763345e5f166ea4e73ce9a116a49c9fc0833d9ea235a86fa5a997e91cf09e5", + "runtimeCodeHash": "0xb4c31859ac132241f04c802d4add70a94c7f2c6eb9dfd4bf224048d249dbc7bc", + "txHash": "0x68b34eda64287b84582c8f005c4e96162252d36c9c5c9b84332336a7c2e3d6d3", + "libraries": { + "LibExponential": "0xd844116f6d79a280b117Bb6d9EBf4121D4e8B44b" + } + } + }, + "RewardsManager": { + "address": "0x1F49caE7669086c8ba53CC35d1E9f80176d67E79", + "initArgs": ["0x9DB3ee191681f092607035d9BDA6e59FbEaCa695"], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0xd8765fb87e11e8d41951f9071188b888829022a889cf66fdc2357f1f9f15c8e2", + "proxy": true, + "implementation": { + "address": "0x714B54e5249C90414fecA240e2F5B618C243F0aE", + "creationCodeHash": "0x59c1680da2d19124daaf95fd66acc5eae68e6f46dfe2ff0b3ccb777daf9949b2", + "runtimeCodeHash": "0xe33080183ec49ab1ec8d78b80b90158f0f3ac6f2deedf6115a32a9d11d3e4d9b", + "txHash": "0x8192f6c0e63a9beede3b025878af6a49367564c8bc32cb11a64f5f1e8351c7cd" + } + }, + "DisputeManager": { + "address": "0x7C9B82717f9433932507dF6EdA93A9678b258698", + "initArgs": [ + "0x9DB3ee191681f092607035d9BDA6e59FbEaCa695", + "0xF89688d5d44d73cc4dE880857A3940487076e5A4", + "10000000000000000000000", + "500000", + "25000", + "25000" + ], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0xb3764f4b576b46ee8dc6cbf680cad650b3ba80aa93dc6cf099862cfe8efc8a68", + "proxy": true, + "implementation": { + "address": "0x887aC2f58D62Ac86d4E9aEc07c953991e3ca1bA3", + "creationCodeHash": "0xce4c47d94a33d69e03d607dd13a9ad1ed7fa730ef4a2308eb56ddd646ebaa0aa", + "runtimeCodeHash": "0x18d4a1659ccecede3d4d305ef1db4653d8f3dcbd4012f4e52200ae9f0c6c322c", + "txHash": "0x59d99afb9cefbb5c2275d9ac2d7230ac7f4a4cfb2440636408988a66075c032a" + } + }, + "AllocationExchange": { + "address": "0x9BD4FBDa981D628AbA16F261f810dD59E5bAf9eA", + "constructorArgs": [ + "0xf8c05dCF59E8B28BFD5eed176C562bEbcfc7Ac04", + "0x865365C425f3A593Ffe698D9c4E6707D14d51e08", + "0x72ee30d43Fb5A90B3FE983156C5d2fBE6F6d07B3", + "0x49D4CFC037430cA9355B422bAeA7E9391e1d3215" + ], + "creationCodeHash": "0x2963baeedb2d0f5a95fa41f6c89e48e5bf177ca439379fc6becd54870d330ab0", + "runtimeCodeHash": "0xd8b53b3f65b49198d35392e0fd11da229a40d15a96151bca2976cbbe36b909d5", + "txHash": "0xa1a9410662d43463c39802e887f33a1401ed0fc35bf22c5be275e62141eae442" + }, + "L2GraphTokenGateway": { + "address": "0xB24Ce0f8c18c4DdDa584A7EeC132F49C966813bb", + "initArgs": ["0x9DB3ee191681f092607035d9BDA6e59FbEaCa695"], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0x90949db305a73b85e7208aa6b8d03c5181945eedc3df38e90f215a0dec8b02ae", + "proxy": true, + "implementation": { + "address": "0x3C2eB5E561f70c0573E5f6c92358e988E32cb5eC", + "creationCodeHash": "0x90253be19d23d542b29e95e6faf52304fcff91b21edfdb5f79e165051740d1ab", + "runtimeCodeHash": "0x3a7fab6792b4dad58c7b59da19c5b65b3985d1be77024a9f86cb135965e9b462", + "txHash": "0x78ff2e39d5c33ddfb89b1dbee89bdbc24452843a051f860c94e4e9dd75ded9c3" + } + }, + "EthereumDIDRegistry": { + "address": "0xF5f4cA61481558709AFa94AdEDa7B5F180f4AD59", + "creationCodeHash": "0x20cd202f7991716a84c097da5fbd365fd27f7f35f241f82c529ad7aba18b814b", + "runtimeCodeHash": "0x5f396ffd54b6cd6b3faded0f366c5d7e148cc54743926061be2dfd12a75391de", + "txHash": "0x2cefbc169b8ae51c263d0298956d86a397b05f11f076b71c918551f63fe33784" + } + } +} diff --git a/packages/hardhat-graph-protocol/test/fixtures/files/addresses-global-short.json b/packages/hardhat-graph-protocol/test/fixtures/files/addresses-global-short.json new file mode 100644 index 000000000..e69de29bb diff --git a/packages/hardhat-graph-protocol/test/fixtures/files/addresses-global.json b/packages/hardhat-graph-protocol/test/fixtures/files/addresses-global.json new file mode 100644 index 000000000..e69de29bb diff --git a/packages/hardhat-graph-protocol/test/fixtures/files/addresses-hre.json b/packages/hardhat-graph-protocol/test/fixtures/files/addresses-hre.json new file mode 100644 index 000000000..e69de29bb diff --git a/packages/hardhat-graph-protocol/test/fixtures/files/addresses-network-short.json b/packages/hardhat-graph-protocol/test/fixtures/files/addresses-network-short.json new file mode 100644 index 000000000..e69de29bb diff --git a/packages/hardhat-graph-protocol/test/fixtures/files/addresses-network.json b/packages/hardhat-graph-protocol/test/fixtures/files/addresses-network.json new file mode 100644 index 000000000..e69de29bb diff --git a/packages/hardhat-graph-protocol/test/fixtures/files/addresses-opt.json b/packages/hardhat-graph-protocol/test/fixtures/files/addresses-opt.json new file mode 100644 index 000000000..e69de29bb diff --git a/packages/hardhat-graph-protocol/test/fixtures/global-address-book/hardhat.config.ts b/packages/hardhat-graph-protocol/test/fixtures/global-address-book/hardhat.config.ts new file mode 100644 index 000000000..1f7718d54 --- /dev/null +++ b/packages/hardhat-graph-protocol/test/fixtures/global-address-book/hardhat.config.ts @@ -0,0 +1,52 @@ +import '../../../src/index' + +import type { HardhatUserConfig } from 'hardhat/config' + +const config: HardhatUserConfig = { + paths: { + graph: '../files', + }, + solidity: '0.8.9', + defaultNetwork: 'hardhat', + networks: { + 'hardhat': { + chainId: 1337, + accounts: { + mnemonic: 'pumpkin orient can short never warm truth legend cereal tourist craft skin', + }, + }, + 'mainnet': { + chainId: 1, + url: `https://mainnet.infura.io/v3/123456`, + }, + 'arbitrum-one': { + chainId: 42161, + url: 'https://arb1.arbitrum.io/rpc', + }, + 'goerli': { + chainId: 5, + url: `https://goerli.infura.io/v3/123456`, + }, + 'arbitrum-goerli': { + chainId: 421613, + url: 'https://goerli-rollup.arbitrum.io/rpc', + }, + 'localhost': { + chainId: 1337, + url: 'http://127.0.0.1:8545', + }, + 'arbitrum-rinkeby': { + chainId: 421611, + url: 'http://127.0.0.1:8545', + }, + }, + graph: { + deployments: { + horizon: { + addressBook: 'addresses-global.json', + }, + }, + }, +} + +export default config diff --git a/packages/hardhat-graph-protocol/test/fixtures/invalid-address-book/hardhat.config.ts b/packages/hardhat-graph-protocol/test/fixtures/invalid-address-book/hardhat.config.ts new file mode 100644 index 000000000..e4569c04a --- /dev/null +++ b/packages/hardhat-graph-protocol/test/fixtures/invalid-address-book/hardhat.config.ts @@ -0,0 +1,52 @@ +import '../../../src/index' + +import type { HardhatUserConfig } from 'hardhat/config' + +const config: HardhatUserConfig = { + paths: { + graph: '../files', + }, + solidity: '0.8.9', + defaultNetwork: 'hardhat', + networks: { + 'hardhat': { + chainId: 1337, + accounts: { + mnemonic: 'pumpkin orient can short never warm truth legend cereal tourist craft skin', + }, + }, + 'mainnet': { + chainId: 1, + url: `https://mainnet.infura.io/v3/123456`, + }, + 'arbitrum-one': { + chainId: 42161, + url: 'https://arb1.arbitrum.io/rpc', + }, + 'goerli': { + chainId: 5, + url: `https://goerli.infura.io/v3/123456`, + }, + 'arbitrum-goerli': { + chainId: 421613, + url: 'https://goerli-rollup.arbitrum.io/rpc', + }, + 'localhost': { + chainId: 1337, + url: 'http://127.0.0.1:8545', + }, + 'arbitrum-rinkeby': { + chainId: 421611, + url: 'http://127.0.0.1:8545', + }, + }, + graph: { + deployments: { + horizon: { + addressBook: 'addresses-invalid.json', + }, + }, + }, +} + +export default config diff --git a/packages/hardhat-graph-protocol/test/fixtures/network-address-book/hardhat.config.ts b/packages/hardhat-graph-protocol/test/fixtures/network-address-book/hardhat.config.ts new file mode 100644 index 000000000..c75c71e4e --- /dev/null +++ b/packages/hardhat-graph-protocol/test/fixtures/network-address-book/hardhat.config.ts @@ -0,0 +1,57 @@ +import '../../../src/index' + +import type { HardhatUserConfig } from 'hardhat/config' + +const config: HardhatUserConfig = { + paths: { + graph: '../files', + }, + solidity: '0.8.9', + defaultNetwork: 'hardhat', + networks: { + 'hardhat': { + chainId: 1337, + accounts: { + mnemonic: 'pumpkin orient can short never warm truth legend cereal tourist craft skin', + }, + }, + 'mainnet': { + chainId: 1, + url: `https://mainnet.infura.io/v3/123456`, + deployments: { + horizon: { + addressBook: 'addresses-network.json', + }, + }, + }, + 'arbitrum-one': { + chainId: 42161, + url: 'https://arb1.arbitrum.io/rpc', + }, + 'goerli': { + chainId: 5, + url: `https://goerli.infura.io/v3/123456`, + }, + 'arbitrum-goerli': { + chainId: 421613, + url: 'https://goerli-rollup.arbitrum.io/rpc', + }, + 'localhost': { + chainId: 1337, + url: 'http://127.0.0.1:8545', + }, + 'arbitrum-rinkeby': { + chainId: 421611, + url: 'http://127.0.0.1:8545', + }, + }, + graph: { + deployments: { + horizon: { + addressBook: 'addresses-global.json', + }, + }, + }, +} + +export default config diff --git a/packages/hardhat-graph-protocol/test/fixtures/no-path-config/addresses.json b/packages/hardhat-graph-protocol/test/fixtures/no-path-config/addresses.json new file mode 100644 index 000000000..e69de29bb diff --git a/packages/hardhat-graph-protocol/test/fixtures/no-path-config/hardhat.config.ts b/packages/hardhat-graph-protocol/test/fixtures/no-path-config/hardhat.config.ts new file mode 100644 index 000000000..c9199325a --- /dev/null +++ b/packages/hardhat-graph-protocol/test/fixtures/no-path-config/hardhat.config.ts @@ -0,0 +1,49 @@ +import '../../../src/index' + +import type { HardhatUserConfig } from 'hardhat/config' + +const config: HardhatUserConfig = { + solidity: '0.8.9', + defaultNetwork: 'hardhat', + networks: { + 'hardhat': { + chainId: 1337, + accounts: { + mnemonic: 'pumpkin orient can short never warm truth legend cereal tourist craft skin', + }, + }, + 'mainnet': { + chainId: 1, + url: `https://mainnet.infura.io/v3/123456`, + }, + 'arbitrum-one': { + chainId: 42161, + url: 'https://arb1.arbitrum.io/rpc', + }, + 'goerli': { + chainId: 5, + url: `https://goerli.infura.io/v3/123456`, + }, + 'arbitrum-goerli': { + chainId: 421613, + url: 'https://goerli-rollup.arbitrum.io/rpc', + }, + 'localhost': { + chainId: 1337, + url: 'http://127.0.0.1:8545', + }, + 'arbitrum-rinkeby': { + chainId: 421611, + url: 'http://127.0.0.1:8545', + }, + }, + graph: { + deployments: { + horizon: { + addressBook: 'addresses-hre.json', + }, + }, + }, +} + +export default config diff --git a/packages/hardhat-graph-protocol/test/fixtures/path-config/hardhat.config.ts b/packages/hardhat-graph-protocol/test/fixtures/path-config/hardhat.config.ts new file mode 100644 index 000000000..0d689a80e --- /dev/null +++ b/packages/hardhat-graph-protocol/test/fixtures/path-config/hardhat.config.ts @@ -0,0 +1,59 @@ +import '../../../src/index' + +import type { HardhatUserConfig } from 'hardhat/config' + +const config: HardhatUserConfig = { + paths: { + graph: '../files', + }, + solidity: '0.8.9', + defaultNetwork: 'hardhat', + networks: { + 'hardhat': { + chainId: 1337, + accounts: { + mnemonic: 'pumpkin orient can short never warm truth legend cereal tourist craft skin', + }, + }, + 'mainnet': { + chainId: 1, + url: `https://mainnet.infura.io/v3/123456`, + }, + 'arbitrum-one': { + chainId: 42161, + url: 'https://arb1.arbitrum.io/rpc', + }, + 'goerli': { + chainId: 5, + url: `https://goerli.infura.io/v3/123456`, + }, + 'arbitrum-goerli': { + chainId: 421613, + url: 'https://goerli-rollup.arbitrum.io/rpc', + }, + 'arbitrumSepolia': { + chainId: 421614, + url: 'https://goerli-rollup.arbitrum.io/rpc', + deployments: { + horizon: 'addresses-arbsep.json', + }, + }, + 'localhost': { + chainId: 1337, + url: 'http://127.0.0.1:8545', + }, + 'arbitrum-rinkeby': { + chainId: 421611, + url: 'http://127.0.0.1:8545', + }, + }, + graph: { + deployments: { + horizon: { + addressBook: 'addresses-hre.json', + }, + }, + }, +} + +export default config diff --git a/packages/hardhat-graph-protocol/test/gre.test.ts b/packages/hardhat-graph-protocol/test/gre.test.ts new file mode 100644 index 000000000..d1fbbd6cd --- /dev/null +++ b/packages/hardhat-graph-protocol/test/gre.test.ts @@ -0,0 +1,53 @@ +import path from 'path' + +import { assert, expect } from 'chai' +import { loadHardhatContext, useHardhatProject } from './helpers' +import { GraphHorizonAddressBook } from '../src/sdk/deployments/horizon' + +describe('GRE usage', function () { + describe('Project not using GRE', function () { + useHardhatProject('default-config', 'mainnet') + + it('should throw when accessing hre.graph()', function () { + expect(() => this.hre.graph()).to.throw() + }) + }) + + describe(`Project using GRE - graph path`, function () { + it('should add the graph path to the config', function () { + this.hre = loadHardhatContext('no-path-config', 'mainnet') + assert.equal( + this.hre.config.paths.graph, + path.join(__dirname, 'fixtures/no-path-config'), + ) + }) + + it('should add the graph path to the config from custom path', function () { + this.hre = loadHardhatContext('path-config', 'mainnet') + assert.equal( + this.hre.config.paths.graph, + path.join(__dirname, 'fixtures/files'), + ) + }) + }) + + describe(`Project using GRE - deployments`, function () { + useHardhatProject('path-config', 'arbitrumSepolia') + + it('should load Horizon deployment', function () { + const graph = this.hre.graph() + assert.isDefined(graph.horizon) + assert.isObject(graph.horizon) + + assert.isDefined(graph.horizon.contracts) + assert.isObject(graph.horizon.contracts) + + assert.isDefined(graph.horizon.addressBook) + assert.isObject(graph.horizon.addressBook) + assert.instanceOf( + graph.horizon.addressBook, + GraphHorizonAddressBook, + ) + }) + }) +}) diff --git a/packages/hardhat-graph-protocol/test/helpers.ts b/packages/hardhat-graph-protocol/test/helpers.ts new file mode 100644 index 000000000..1c7050e05 --- /dev/null +++ b/packages/hardhat-graph-protocol/test/helpers.ts @@ -0,0 +1,38 @@ +import path from 'path' + +import { resetHardhatContext as _resetHardhatContext } from 'hardhat/plugins-testing' +import type { HardhatRuntimeEnvironment } from 'hardhat/types' + +declare module 'mocha' { + interface Context { + hre: HardhatRuntimeEnvironment + } +} + +export function useHardhatProject(fixtureProjectName: string, network?: string): void { + beforeEach('Loading hardhat environment', function () { + this.hre = loadHardhatContext(fixtureProjectName, network) + }) + + afterEach('Resetting hardhat', function () { + resetHardhatContext() + }) +} + +export function loadHardhatContext(fixtureProjectName: string, network?: string): HardhatRuntimeEnvironment { + resetHardhatContext() + delete process.env.HARDHAT_NETWORK + + process.chdir(path.join(__dirname, 'fixtures', fixtureProjectName)) + + if (network !== undefined) { + process.env.HARDHAT_NETWORK = network + } + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return require('hardhat') +} + +export function resetHardhatContext(): void { + _resetHardhatContext() + delete process.env.HARDHAT_NETWORK +} diff --git a/packages/hardhat-graph-protocol/tsconfig.json b/packages/hardhat-graph-protocol/tsconfig.json new file mode 100644 index 000000000..41ba7e8bc --- /dev/null +++ b/packages/hardhat-graph-protocol/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "es2020", + "module": "commonjs", + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "resolveJsonModule": true, + "outDir": "dist", + }, + "include": ["eslint.config.js", "src/**/*.ts", "test/**/*.ts"], +} diff --git a/packages/horizon/addresses.json b/packages/horizon/addresses.json new file mode 100644 index 000000000..530fd98ae --- /dev/null +++ b/packages/horizon/addresses.json @@ -0,0 +1,226 @@ +{ + "421614": { + "HorizonStaking": { + "address": "0xFf2Ee30de92F276018642A59Fb7Be95b3F9088Af" + }, + "GraphPayments": { + "address": "0xf5B3661BbB8CD48571C7f41ba2D896a3589C9753" + }, + "PaymentsEscrow": { + "address": "0x09B985a2042848A08bA59060EaF0f07c6F5D4d54" + }, + "TAPCollector": { + "address": "0xacC71844EF6beEF70106ABe6E51013189A1f3738" + }, + "GraphProxyAdmin": { + "address": "0x7474a6cc5fAeDEc620Db0fa8E4da6eD58477042C", + "creationCodeHash": "0x68b304ac6bce7380d5e0f6b14a122f628bffebcc75f8205cb60f0baf578b79c3", + "runtimeCodeHash": "0x8d9ba87a745cf82ab407ebabe6c1490197084d320efb6c246d94bcc80e804417", + "txHash": "0x71b6defab0d3d7b711b7f6769f20a8c85bc9686eb5939b2a86dfaf587fceab17" + }, + "Controller": { + "address": "0x9DB3ee191681f092607035d9BDA6e59FbEaCa695", + "creationCodeHash": "0x5bde9a87bc4e8dd24d41900f0a19321c1dc6d3373d51bba093b130bb5b80a677", + "runtimeCodeHash": "0x7f0479db1d60ecf6295d92ea2359ebdd223640795613558b0594680f5d4922c9", + "txHash": "0xf7b4faa14f9d29bb62dec73fd163d1253184233012bcadf7ae78af7995017f29" + }, + "EpochManager": { + "address": "0x88b3C7f37253bAA1A9b95feAd69bD5320585826D", + "initArgs": ["0x9DB3ee191681f092607035d9BDA6e59FbEaCa695", "554"], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0x587ea6f421a08ab3a390103f63daba0529901f2e662ca7f6fe575674a439fa79", + "proxy": true, + "implementation": { + "address": "0x646627fa39ec6f6E757Cb4189bC54c92FFBb71da", + "creationCodeHash": "0x9947bd0a1f46027123b8fb4aec8b11af540aea587eb79642475d57b4e347078f", + "runtimeCodeHash": "0xe45a27197726de0e3149014823794708edd432ee56ec8358554c0d2365674ca0", + "txHash": "0x82653a0bd83e0541379b920415af94e4be1d732dfab720e5dead839062781c07" + } + }, + "L2GraphToken": { + "address": "0xf8c05dCF59E8B28BFD5eed176C562bEbcfc7Ac04", + "initArgs": ["0xadE6B8EB69a49B56929C1d4F4b428d791861dB6f"], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0xbb27939a4e4b5d92da8a10add4b7d0126e907da30b07b5f3d439f1c32a6c8e2c", + "proxy": true, + "implementation": { + "address": "0x4cf968bA38b43dd10be114daa7959C1b369479e5", + "creationCodeHash": "0x6c4146427aafa7375a569154be95c8c931bf83aab0315706dd78bdf79c889e4c", + "runtimeCodeHash": "0x004371d1d80011906953dcba17c648503fc94b94e1e0365c8d8c706ff91f93e9", + "txHash": "0x3fab5697addf0c0e16b8e2249f2b833c6f256e699b293d184089c96de8deaa44" + } + }, + "GraphCurationToken": { + "address": "0x00FBd5D46FFAc54862c1Dd27BE08924BB17f5CDa", + "creationCodeHash": "0x1ee42ee271cefe20c33c0de904501e618ac4b56debca67c634d0564cecea9ff2", + "runtimeCodeHash": "0x340e8f378c0117b300f3ec255bc5c3a273f9ab5bd2940fa8eb3b5065b21f86dc", + "txHash": "0x045d64dc3ebb7ae6c4976854ce0a797a04524d22a6ef5f526bfc27f744bc68e5" + }, + "ServiceRegistry": { + "address": "0x888541878CbDDEd880Cd58c728f1Af5C47343F86", + "initArgs": ["0x9DB3ee191681f092607035d9BDA6e59FbEaCa695"], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0xdaa1228e8cd8569c1e5562b63d2fd89caf897ab67da05922636d3309b838e289", + "proxy": true, + "implementation": { + "address": "0x05E732280bf9F37054346Cb83f5Fd58C5B44F6A8", + "creationCodeHash": "0xec9cb879003a06609541ad87efd4bc5dfc8ea60e4e77cfa5ae2cb5208742e7bc", + "runtimeCodeHash": "0x5161b534164413a88d851832f9c9d1dd1bca32fe2bbb62bb35d112c1dc8b69ab", + "txHash": "0xe1fce867f5dd708e60518b7f257fdbcb28f460d1e3b82045b82d03e64345b210" + } + }, + "L2Curation": { + "address": "0xDe761f075200E75485F4358978FB4d1dC8644FD5", + "initArgs": [ + "0x9DB3ee191681f092607035d9BDA6e59FbEaCa695", + "0x00FBd5D46FFAc54862c1Dd27BE08924BB17f5CDa", + "10000", + "1" + ], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0xe9298239bcb3c386cf66e6dd493cf6e7cdd9771c65fa2225e0b34d17550d6805", + "proxy": true, + "implementation": { + "address": "0xd90022aB67920212D0F902F5c427DE82732DE136", + "creationCodeHash": "0x2287d9023bf7d91e688e1eb029eff7657ef3b87e37b5222b01fd50985d0928f9", + "runtimeCodeHash": "0xd799b2b74e9634d6b6ef15b5710409264bed04a60f9519b9d8f05ac183199d16", + "txHash": "0x436bcf91fed712dc8d54f449726b2078fb63cd770f90b492a9622efac5817762" + } + }, + "SubgraphNFTDescriptor": { + "address": "0x4032F7B6b27FfC9862106f826379DaB1716C71d7", + "creationCodeHash": "0xf16e8ff11d852eea165195ac9e0dfa00f98e48f6ce3c77c469c7df9bf195b651", + "runtimeCodeHash": "0x39583196f2bcb85789b6e64692d8c0aa56f001c46f0ca3d371abbba2c695860f", + "txHash": "0xb7e7aeeecc693f34f491b01c56950533119810a4e3e2642081efc127f11cb782" + }, + "SubgraphNFT": { + "address": "0xF21Df5BbA7EB9b54D8F60C560aFb9bA63e6aED1A", + "constructorArgs": ["0xadE6B8EB69a49B56929C1d4F4b428d791861dB6f"], + "creationCodeHash": "0xc1e58864302084de282dffe54c160e20dd96c6cfff45e00e6ebfc15e04136982", + "runtimeCodeHash": "0x7216e736a8a8754e88688fbf5c0c7e9caf35c55ecc3a0c5a597b951c56cf7458", + "txHash": "0x1309c1caea76f4014ba612de092cc746816119b1440d635d11b6bc7e361a32b0" + }, + "L2GNS": { + "address": "0x3133948342F35b8699d8F94aeE064AbB76eDe965", + "initArgs": [ + "0x9DB3ee191681f092607035d9BDA6e59FbEaCa695", + "0xF21Df5BbA7EB9b54D8F60C560aFb9bA63e6aED1A" + ], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0x137140783a99a3e9a60048d607124626ca87e2b972e8cc05efb41ac87c3cbcc4", + "proxy": true, + "implementation": { + "address": "0x00CBF5024d454255577Bf2b0fB6A43328a6828c9", + "creationCodeHash": "0xd71f45e6c194920a26f90fcec96d8c3375f02c5aef8ad90c1be24e906ffe8342", + "runtimeCodeHash": "0x68ec24512fedb866d7ba7ba6c02160317d0ca34eaacd23bddcc62d2cbcd9869c", + "txHash": "0x54619944731edec530b7b0cd587f9c2faae332aa1671fe5e8d7e7e5c7e291a77" + } + }, + "StakingExtension": { + "address": "0x05709dd705A5674346B7206a2bC657C8bAb3301B", + "creationCodeHash": "0x7ae74140871330ecabb7040182dc8288c2c84693393a519230036f39c2281138", + "runtimeCodeHash": "0x4994aa74e9e29c36a8158af690a245ccd1cf4d955223e5fcb1ca62810b37ed57", + "txHash": "0xbe1ff9cb949a53209b778708265740dfa2a08a93cfce4c897a53989a5d93f8c1" + }, + "L2Staking": { + "address": "0x865365C425f3A593Ffe698D9c4E6707D14d51e08", + "initArgs": [ + "0x9DB3ee191681f092607035d9BDA6e59FbEaCa695", + "100000000000000000000000", + "6646", + "10000", + "100000", + "8", + "12", + "16", + "100,100,60,100", + "0x876fB4B13D7Ed146757D3664B7E962b36936001C" + ], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0x326cf1f2849da4bb4d7e39f2783779e3c99fa48e4ee8ef004cfdd50c62e775df", + "proxy": true, + "implementation": { + "address": "0xD07dFD514dc1b57020e6C1F49e05c48d0658C99f", + "creationCodeHash": "0x6a763345e5f166ea4e73ce9a116a49c9fc0833d9ea235a86fa5a997e91cf09e5", + "runtimeCodeHash": "0xb4c31859ac132241f04c802d4add70a94c7f2c6eb9dfd4bf224048d249dbc7bc", + "txHash": "0x68b34eda64287b84582c8f005c4e96162252d36c9c5c9b84332336a7c2e3d6d3", + "libraries": { + "LibExponential": "0xd844116f6d79a280b117Bb6d9EBf4121D4e8B44b" + } + } + }, + "RewardsManager": { + "address": "0x1F49caE7669086c8ba53CC35d1E9f80176d67E79", + "initArgs": ["0x9DB3ee191681f092607035d9BDA6e59FbEaCa695"], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0xd8765fb87e11e8d41951f9071188b888829022a889cf66fdc2357f1f9f15c8e2", + "proxy": true, + "implementation": { + "address": "0x714B54e5249C90414fecA240e2F5B618C243F0aE", + "creationCodeHash": "0x59c1680da2d19124daaf95fd66acc5eae68e6f46dfe2ff0b3ccb777daf9949b2", + "runtimeCodeHash": "0xe33080183ec49ab1ec8d78b80b90158f0f3ac6f2deedf6115a32a9d11d3e4d9b", + "txHash": "0x8192f6c0e63a9beede3b025878af6a49367564c8bc32cb11a64f5f1e8351c7cd" + } + }, + "DisputeManager": { + "address": "0x7C9B82717f9433932507dF6EdA93A9678b258698", + "initArgs": [ + "0x9DB3ee191681f092607035d9BDA6e59FbEaCa695", + "0xF89688d5d44d73cc4dE880857A3940487076e5A4", + "10000000000000000000000", + "500000", + "25000", + "25000" + ], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0xb3764f4b576b46ee8dc6cbf680cad650b3ba80aa93dc6cf099862cfe8efc8a68", + "proxy": true, + "implementation": { + "address": "0x887aC2f58D62Ac86d4E9aEc07c953991e3ca1bA3", + "creationCodeHash": "0xce4c47d94a33d69e03d607dd13a9ad1ed7fa730ef4a2308eb56ddd646ebaa0aa", + "runtimeCodeHash": "0x18d4a1659ccecede3d4d305ef1db4653d8f3dcbd4012f4e52200ae9f0c6c322c", + "txHash": "0x59d99afb9cefbb5c2275d9ac2d7230ac7f4a4cfb2440636408988a66075c032a" + } + }, + "AllocationExchange": { + "address": "0x9BD4FBDa981D628AbA16F261f810dD59E5bAf9eA", + "constructorArgs": [ + "0xf8c05dCF59E8B28BFD5eed176C562bEbcfc7Ac04", + "0x865365C425f3A593Ffe698D9c4E6707D14d51e08", + "0x72ee30d43Fb5A90B3FE983156C5d2fBE6F6d07B3", + "0x49D4CFC037430cA9355B422bAeA7E9391e1d3215" + ], + "creationCodeHash": "0x2963baeedb2d0f5a95fa41f6c89e48e5bf177ca439379fc6becd54870d330ab0", + "runtimeCodeHash": "0xd8b53b3f65b49198d35392e0fd11da229a40d15a96151bca2976cbbe36b909d5", + "txHash": "0xa1a9410662d43463c39802e887f33a1401ed0fc35bf22c5be275e62141eae442" + }, + "L2GraphTokenGateway": { + "address": "0xB24Ce0f8c18c4DdDa584A7EeC132F49C966813bb", + "initArgs": ["0x9DB3ee191681f092607035d9BDA6e59FbEaCa695"], + "creationCodeHash": "0xcdd28bb3db05f1267ca0f5ea29536c61841be5937ce711b813924f8ff38918cc", + "runtimeCodeHash": "0x4ca8c37c807bdfda1d6dcf441324b7ea14c6ddec5db37c20c2bf05aeae49bc0d", + "txHash": "0x90949db305a73b85e7208aa6b8d03c5181945eedc3df38e90f215a0dec8b02ae", + "proxy": true, + "implementation": { + "address": "0x3C2eB5E561f70c0573E5f6c92358e988E32cb5eC", + "creationCodeHash": "0x90253be19d23d542b29e95e6faf52304fcff91b21edfdb5f79e165051740d1ab", + "runtimeCodeHash": "0x3a7fab6792b4dad58c7b59da19c5b65b3985d1be77024a9f86cb135965e9b462", + "txHash": "0x78ff2e39d5c33ddfb89b1dbee89bdbc24452843a051f860c94e4e9dd75ded9c3" + } + }, + "EthereumDIDRegistry": { + "address": "0xF5f4cA61481558709AFa94AdEDa7B5F180f4AD59", + "creationCodeHash": "0x20cd202f7991716a84c097da5fbd365fd27f7f35f241f82c529ad7aba18b814b", + "runtimeCodeHash": "0x5f396ffd54b6cd6b3faded0f366c5d7e148cc54743926061be2dfd12a75391de", + "txHash": "0x2cefbc169b8ae51c263d0298956d86a397b05f11f076b71c918551f63fe33784" + } + } +} diff --git a/packages/horizon/hardhat.config.ts b/packages/horizon/hardhat.config.ts index 6a57472a5..41c92d1b9 100644 --- a/packages/horizon/hardhat.config.ts +++ b/packages/horizon/hardhat.config.ts @@ -5,7 +5,11 @@ import 'hardhat-storage-layout' import 'hardhat-contract-sizer' import 'hardhat-secure-accounts' -import { HardhatUserConfig } from 'hardhat/config' +import type { HardhatUserConfig } from 'hardhat/config' + +if (process.env.BUILD_RUN !== 'true') { + require('hardhat-graph-protocol') +} const config: HardhatUserConfig = { solidity: { @@ -34,9 +38,17 @@ const config: HardhatUserConfig = { }, }, arbitrumSepolia: { + chainId: 421614, url: 'https://sepolia-rollup.arbitrum.io/rpc', }, }, + graph: { + deployments: { + horizon: { + addressBook: 'addresses.json', + }, + }, + }, etherscan: { apiKey: { arbitrumSepolia: process.env.ETHERSCAN_API_KEY ?? '', diff --git a/packages/horizon/package.json b/packages/horizon/package.json index 04109da36..ba3ff93c9 100644 --- a/packages/horizon/package.json +++ b/packages/horizon/package.json @@ -4,12 +4,18 @@ "description": "", "author": "The Graph core devs", "license": "GPL-2.0-or-later", + "types": "typechain-types/index.ts", + "files": [ + "build/contracts/**/*", + "README.md", + "addresses.json" + ], "scripts": { "lint:ts": "eslint '**/*.{js,ts}' --fix", "lint:sol": "prettier --write contracts/**/*.sol && solhint --noPrompt --fix contracts/**/*.sol --config node_modules/solhint-graph-config/index.js", "lint": "yarn lint:ts && yarn lint:sol", - "clean": "rm -rf build cache typechain-types", - "build": "forge build && hardhat compile", + "clean": "rm -rf build dist cache cache_forge typechain-types", + "build": "forge build --skip test && BUILD_RUN=true hardhat compile", "test": "forge test && hardhat test" }, "devDependencies": { @@ -33,10 +39,11 @@ "chai": "^4.2.0", "eslint": "^8.56.0", "eslint-graph-config": "workspace:^0.0.1", - "ethers": "^6.13.2", - "hardhat": "^2.20.1", + "ethers": "^6.13.4", + "hardhat": "^2.22.0", "hardhat-contract-sizer": "^2.10.0", "hardhat-gas-reporter": "^1.0.8", + "hardhat-graph-protocol": "workspace:^0.0.1", "hardhat-secure-accounts": "^1.0.4", "hardhat-storage-layout": "^0.1.7", "lint-staged": "^15.2.2", @@ -48,7 +55,7 @@ "solidity-coverage": "^0.8.0", "ts-node": ">=8.0.0", "typechain": "^8.3.0", - "typescript": "^5.3.3" + "typescript": "^5.6.3" }, "lint-staged": { "contracts/**/*.sol": [ diff --git a/packages/horizon/tsconfig.json b/packages/horizon/tsconfig.json index 8de96f814..202a9923e 100644 --- a/packages/horizon/tsconfig.json +++ b/packages/horizon/tsconfig.json @@ -6,11 +6,14 @@ "forceConsistentCasingInFileNames": true, "strict": true, "skipLibCheck": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "outDir": "dist" }, "include": [ "hardhat.config.ts", + "types/**/*.ts", "scripts/**/*.ts", + "tasks/**/*.ts", "test/**/*.ts", "ignition/**/*.ts", "eslint.config.js", diff --git a/packages/horizon/types/hardhat-graph-protocol.d.ts b/packages/horizon/types/hardhat-graph-protocol.d.ts new file mode 100644 index 000000000..ab3c30b4b --- /dev/null +++ b/packages/horizon/types/hardhat-graph-protocol.d.ts @@ -0,0 +1,45 @@ +// TypeScript does not resolve correctly the type extensions when they are symlinked from the same monorepo. +// So we need to re-type it... this file should be a copy of hardhat-graph-protocol/src/type-extensions.ts +import 'hardhat/types/config' +import 'hardhat/types/runtime' +import type { GraphDeployments, GraphRuntimeEnvironment, GraphRuntimeEnvironmentOptions } from 'hardhat-graph-protocol/src/types' + +declare module 'hardhat/types/runtime' { + interface HardhatRuntimeEnvironment { + graph: (opts?: GraphRuntimeEnvironmentOptions) => GraphRuntimeEnvironment + } +} + +declare module 'hardhat/types/config' { + interface HardhatConfig { + graph: GraphRuntimeEnvironmentOptions + } + + interface HardhatUserConfig { + graph: GraphRuntimeEnvironmentOptions + } + + interface HardhatNetworkConfig { + deployments?: GraphDeployments + } + + interface HardhatNetworkUserConfig { + deployments?: GraphDeployments + } + + interface HttpNetworkConfig { + deployments?: GraphDeployments + } + + interface HttpNetworkUserConfig { + deployments?: GraphDeployments + } + + interface ProjectPathsConfig { + graph?: string + } + + interface ProjectPathsUserConfig { + graph?: string + } +} diff --git a/packages/subgraph-service/addresses.json b/packages/subgraph-service/addresses.json new file mode 100644 index 000000000..0fb2088ec --- /dev/null +++ b/packages/subgraph-service/addresses.json @@ -0,0 +1,34 @@ +{ + "421614": { + "SubgraphService": { + "address": "0x2268247782f4b7AdB2DA810EFD6e43B27a37af54" + }, + "DisputeManager": { + "address": "0x8e436E815226C8Bd5e775C7FF693DAe6a94bE7d1" + }, + "ServiceRegistry": { + "address": "0x888541878CbDDEd880Cd58c728f1Af5C47343F86", + "proxy": true, + "implementation": { + "address": "0x05E732280bf9F37054346Cb83f5Fd58C5B44F6A8" + } + }, + "L2Curation": { + "address": "0xDe761f075200E75485F4358978FB4d1dC8644FD5", + "proxy": true, + "implementation": { + "address": "0xd90022aB67920212D0F902F5c427DE82732DE136" + } + }, + "SubgraphNFT": { + "address": "0xF21Df5BbA7EB9b54D8F60C560aFb9bA63e6aED1A" + }, + "L2GNS": { + "address": "0x3133948342F35b8699d8F94aeE064AbB76eDe965", + "proxy": true, + "implementation": { + "address": "0x00CBF5024d454255577Bf2b0fB6A43328a6828c9" + } + } + } +} diff --git a/packages/subgraph-service/hardhat.config.ts b/packages/subgraph-service/hardhat.config.ts index a1158bb8b..4db905141 100644 --- a/packages/subgraph-service/hardhat.config.ts +++ b/packages/subgraph-service/hardhat.config.ts @@ -8,6 +8,10 @@ import 'solidity-docgen' import { HardhatUserConfig } from 'hardhat/config' +if (process.env.BUILD_RUN !== 'true') { + require('hardhat-graph-protocol') +} + const config: HardhatUserConfig = { solidity: { version: '0.8.27', @@ -35,9 +39,16 @@ const config: HardhatUserConfig = { }, }, arbitrumSepolia: { + chainId: 421614, url: 'https://sepolia-rollup.arbitrum.io/rpc', }, }, + graph: { + deployments: { + horizon: require.resolve('@graphprotocol/horizon/addresses.json'), + subgraphService: 'addresses.json', + }, + }, } export default config diff --git a/packages/subgraph-service/package.json b/packages/subgraph-service/package.json index 9f9303f20..9ca8f3481 100644 --- a/packages/subgraph-service/package.json +++ b/packages/subgraph-service/package.json @@ -4,12 +4,18 @@ "description": "", "author": "The Graph core devs", "license": "GPL-2.0-or-later", + "types": "typechain-types/index.ts", + "files": [ + "build/contracts/**/*", + "README.md", + "addresses.json" + ], "scripts": { "lint:ts": "eslint '**/*.{js,ts}' --fix", "lint:sol": "prettier --write contracts/**/*.sol && solhint --noPrompt --fix contracts/**/*.sol --config node_modules/solhint-graph-config/index.js", "lint": "yarn lint:ts && yarn lint:sol", - "clean": "rm -rf build cache typechain-types", - "build": "forge build && hardhat compile", + "clean": "rm -rf build dist cache cache_forge typechain-types", + "build": "forge build --skip test && BUILD_RUN=true hardhat compile", "test": "forge test && hardhat test" }, "devDependencies": { @@ -38,6 +44,7 @@ "hardhat": "^2.20.1", "hardhat-contract-sizer": "^2.10.0", "hardhat-gas-reporter": "^1.0.8", + "hardhat-graph-protocol": "workspace:^0.0.1", "hardhat-secure-accounts": "^1.0.4", "hardhat-storage-layout": "^0.1.7", "json5": "^2.2.3", diff --git a/packages/subgraph-service/tsconfig.json b/packages/subgraph-service/tsconfig.json index 8de96f814..06c7ed638 100644 --- a/packages/subgraph-service/tsconfig.json +++ b/packages/subgraph-service/tsconfig.json @@ -10,6 +10,7 @@ }, "include": [ "hardhat.config.ts", + "types/**/*.ts", "scripts/**/*.ts", "test/**/*.ts", "ignition/**/*.ts", diff --git a/packages/subgraph-service/types/hardhat-graph-protocol.d.ts b/packages/subgraph-service/types/hardhat-graph-protocol.d.ts new file mode 100644 index 000000000..ab3c30b4b --- /dev/null +++ b/packages/subgraph-service/types/hardhat-graph-protocol.d.ts @@ -0,0 +1,45 @@ +// TypeScript does not resolve correctly the type extensions when they are symlinked from the same monorepo. +// So we need to re-type it... this file should be a copy of hardhat-graph-protocol/src/type-extensions.ts +import 'hardhat/types/config' +import 'hardhat/types/runtime' +import type { GraphDeployments, GraphRuntimeEnvironment, GraphRuntimeEnvironmentOptions } from 'hardhat-graph-protocol/src/types' + +declare module 'hardhat/types/runtime' { + interface HardhatRuntimeEnvironment { + graph: (opts?: GraphRuntimeEnvironmentOptions) => GraphRuntimeEnvironment + } +} + +declare module 'hardhat/types/config' { + interface HardhatConfig { + graph: GraphRuntimeEnvironmentOptions + } + + interface HardhatUserConfig { + graph: GraphRuntimeEnvironmentOptions + } + + interface HardhatNetworkConfig { + deployments?: GraphDeployments + } + + interface HardhatNetworkUserConfig { + deployments?: GraphDeployments + } + + interface HttpNetworkConfig { + deployments?: GraphDeployments + } + + interface HttpNetworkUserConfig { + deployments?: GraphDeployments + } + + interface ProjectPathsConfig { + graph?: string + } + + interface ProjectPathsUserConfig { + graph?: string + } +} diff --git a/scripts/build b/scripts/build new file mode 100755 index 000000000..c8331ab9a --- /dev/null +++ b/scripts/build @@ -0,0 +1,32 @@ +#!/bin/bash + +# List of packages to build - order matters! +packages=( + "packages/eslint-graph-config" + # "packages/solhint-graph-config" -- disabled since it doesn't have a build script + # "packages/solhint-plugin-graph" -- disabled since it doesn't have a build script + "packages/contracts" + "packages/horizon" + "packages/subgraph-service" + "packages/hardhat-graph-protocol" + "packages/data-edge" + "packages/sdk" + "packages/token-distribution" +) + +for package in "${packages[@]}"; do + echo -e "\n\n==== Building $package..." + + cd "$package" || { echo "Failed to navigate to $package"; exit 1; } + + if BUILD_RUN=true yarn build; then + echo "Successfully built $package" + else + echo "Build failed for $package" >&2 + exit 1 + fi + + cd - > /dev/null +done + +echo "All packages built successfully!" diff --git a/yarn.lock b/yarn.lock index 910995b8c..927c703e1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2949,10 +2949,11 @@ __metadata: chai: "npm:^4.2.0" eslint: "npm:^8.56.0" eslint-graph-config: "workspace:^0.0.1" - ethers: "npm:^6.13.2" - hardhat: "npm:^2.20.1" + ethers: "npm:^6.13.4" + hardhat: "npm:^2.22.0" hardhat-contract-sizer: "npm:^2.10.0" hardhat-gas-reporter: "npm:^1.0.8" + hardhat-graph-protocol: "workspace:^0.0.1" hardhat-secure-accounts: "npm:^1.0.4" hardhat-storage-layout: "npm:^0.1.7" lint-staged: "npm:^15.2.2" @@ -2964,7 +2965,7 @@ __metadata: solidity-coverage: "npm:^0.8.0" ts-node: "npm:>=8.0.0" typechain: "npm:^8.3.0" - typescript: "npm:^5.3.3" + typescript: "npm:^5.6.3" languageName: unknown linkType: soft @@ -3018,7 +3019,7 @@ __metadata: languageName: unknown linkType: soft -"@graphprotocol/subgraph-service@workspace:packages/subgraph-service": +"@graphprotocol/subgraph-service@workspace:^0.0.1, @graphprotocol/subgraph-service@workspace:packages/subgraph-service": version: 0.0.0-use.local resolution: "@graphprotocol/subgraph-service@workspace:packages/subgraph-service" dependencies: @@ -3047,6 +3048,7 @@ __metadata: hardhat: "npm:^2.20.1" hardhat-contract-sizer: "npm:^2.10.0" hardhat-gas-reporter: "npm:^1.0.8" + hardhat-graph-protocol: "workspace:^0.0.1" hardhat-secure-accounts: "npm:^1.0.4" hardhat-storage-layout: "npm:^0.1.7" json5: "npm:^2.2.3" @@ -4218,6 +4220,13 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr-darwin-arm64@npm:0.6.5": + version: 0.6.5 + resolution: "@nomicfoundation/edr-darwin-arm64@npm:0.6.5" + checksum: 1ed23f670f280834db7b0cc144d8287b3a572639917240beb6c743ff0f842fadf200eb3e226a13f0650d8a611f5092ace093679090ceb726d97fb4c6023073e6 + languageName: node + linkType: hard + "@nomicfoundation/edr-darwin-x64@npm:0.3.8": version: 0.3.8 resolution: "@nomicfoundation/edr-darwin-x64@npm:0.3.8" @@ -4225,6 +4234,13 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr-darwin-x64@npm:0.6.5": + version: 0.6.5 + resolution: "@nomicfoundation/edr-darwin-x64@npm:0.6.5" + checksum: 298810fe1ed61568beeb4e4a8ddfb4d3e3cf49d51f89578d5edb5817a7d131069c371d07ea000b246daa2fd57fa4853ab983e3a2e2afc9f27005156e5abfa500 + languageName: node + linkType: hard + "@nomicfoundation/edr-linux-arm64-gnu@npm:0.3.8": version: 0.3.8 resolution: "@nomicfoundation/edr-linux-arm64-gnu@npm:0.3.8" @@ -4232,6 +4248,13 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr-linux-arm64-gnu@npm:0.6.5": + version: 0.6.5 + resolution: "@nomicfoundation/edr-linux-arm64-gnu@npm:0.6.5" + checksum: 695850a75dda9ad00899ca2bd150c72c6b7a2470c352348540791e55459dc6f87ff88b3b647efe07dfe24d4b6aa9d9039724a9761ffc7a557e3e75a784c302a1 + languageName: node + linkType: hard + "@nomicfoundation/edr-linux-arm64-musl@npm:0.3.8": version: 0.3.8 resolution: "@nomicfoundation/edr-linux-arm64-musl@npm:0.3.8" @@ -4239,6 +4262,13 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr-linux-arm64-musl@npm:0.6.5": + version: 0.6.5 + resolution: "@nomicfoundation/edr-linux-arm64-musl@npm:0.6.5" + checksum: 9a6e01a545491b12673334628b6e1601c7856cb3973451ba1a4c29cf279e9a4874b5e5082fc67d899af7930b6576565e2c7e3dbe67824bfe454bf9ce87435c56 + languageName: node + linkType: hard + "@nomicfoundation/edr-linux-x64-gnu@npm:0.3.8": version: 0.3.8 resolution: "@nomicfoundation/edr-linux-x64-gnu@npm:0.3.8" @@ -4246,6 +4276,13 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr-linux-x64-gnu@npm:0.6.5": + version: 0.6.5 + resolution: "@nomicfoundation/edr-linux-x64-gnu@npm:0.6.5" + checksum: 959b62520cc9375284fcc1ae2ad67c5711d387912216e0b0ab7a3d087ef03967e2c8c8bd2e87697a3b1369fc6a96ec60399e3d71317a8be0cb8864d456a30e36 + languageName: node + linkType: hard + "@nomicfoundation/edr-linux-x64-musl@npm:0.3.8": version: 0.3.8 resolution: "@nomicfoundation/edr-linux-x64-musl@npm:0.3.8" @@ -4253,6 +4290,13 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr-linux-x64-musl@npm:0.6.5": + version: 0.6.5 + resolution: "@nomicfoundation/edr-linux-x64-musl@npm:0.6.5" + checksum: d91153a8366005e6a6124893a1da377568157709a147e6c9a18fe6dacae21d3847f02d2e9e89794dc6cb8dbdcd7ee7e49e6c9d3dc74c8dc80cea44e4810752da + languageName: node + linkType: hard + "@nomicfoundation/edr-win32-x64-msvc@npm:0.3.8": version: 0.3.8 resolution: "@nomicfoundation/edr-win32-x64-msvc@npm:0.3.8" @@ -4260,6 +4304,13 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr-win32-x64-msvc@npm:0.6.5": + version: 0.6.5 + resolution: "@nomicfoundation/edr-win32-x64-msvc@npm:0.6.5" + checksum: 96c2f68393b517f9b45cb4e777eb594a969abc3fea10bf11756cd050a7e8cefbe27808bd44d8e8a16dc9c425133a110a2ad186e1e6d29b49f234811db52a1edb + languageName: node + linkType: hard + "@nomicfoundation/edr@npm:^0.3.7": version: 0.3.8 resolution: "@nomicfoundation/edr@npm:0.3.8" @@ -4275,6 +4326,21 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr@npm:^0.6.4": + version: 0.6.5 + resolution: "@nomicfoundation/edr@npm:0.6.5" + dependencies: + "@nomicfoundation/edr-darwin-arm64": "npm:0.6.5" + "@nomicfoundation/edr-darwin-x64": "npm:0.6.5" + "@nomicfoundation/edr-linux-arm64-gnu": "npm:0.6.5" + "@nomicfoundation/edr-linux-arm64-musl": "npm:0.6.5" + "@nomicfoundation/edr-linux-x64-gnu": "npm:0.6.5" + "@nomicfoundation/edr-linux-x64-musl": "npm:0.6.5" + "@nomicfoundation/edr-win32-x64-msvc": "npm:0.6.5" + checksum: 4344efbc7173119bd69dd37c5e60a232ab8307153e9cc329014df95a60f160026042afdd4dc34188f29fc8e8c926f0a3abdf90fb69bed92be031a206da3a6df5 + languageName: node + linkType: hard + "@nomicfoundation/ethereumjs-block@npm:4.2.2": version: 4.2.2 resolution: "@nomicfoundation/ethereumjs-block@npm:4.2.2" @@ -5916,6 +5982,13 @@ __metadata: languageName: node linkType: hard +"@types/chai@npm:^4.0.0": + version: 4.3.20 + resolution: "@types/chai@npm:4.3.20" + checksum: 4601189d611752e65018f1ecadac82e94eed29f348e1d5430e5681a60b01e1ecf855d9bcc74ae43b07394751f184f6970fac2b5561fc57a1f36e93a0f5ffb6e8 + languageName: node + linkType: hard + "@types/concat-stream@npm:^1.6.0": version: 1.6.1 resolution: "@types/concat-stream@npm:1.6.1" @@ -5925,7 +5998,7 @@ __metadata: languageName: node linkType: hard -"@types/debug@npm:^4.1.10, @types/debug@npm:^4.1.7, @types/debug@npm:^4.1.8": +"@types/debug@npm:^4.1.10, @types/debug@npm:^4.1.12, @types/debug@npm:^4.1.7, @types/debug@npm:^4.1.8": version: 4.1.12 resolution: "@types/debug@npm:4.1.12" dependencies: @@ -6082,6 +6155,13 @@ __metadata: languageName: node linkType: hard +"@types/mocha@npm:^10.0.9": + version: 10.0.10 + resolution: "@types/mocha@npm:10.0.10" + checksum: d2b8c48138cde6923493e42b38e839695eb42edd04629abe480a8f34c0e3f50dd82a55832c2e8d2b6e6f9e4deb492d7d733e600fbbdd5a0ceccbcfc6844ff9d5 + languageName: node + linkType: hard + "@types/mocha@npm:^8.2.2": version: 8.2.3 resolution: "@types/mocha@npm:8.2.3" @@ -6129,6 +6209,15 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:22.7.5": + version: 22.7.5 + resolution: "@types/node@npm:22.7.5" + dependencies: + undici-types: "npm:~6.19.2" + checksum: cf11f74f1a26053ec58066616e3a8685b6bcd7259bc569738b8f752009f9f0f7f85a1b2d24908e5b0f752482d1e8b6babdf1fbb25758711ec7bb9500bfcd6e60 + languageName: node + linkType: hard + "@types/node@npm:^10.0.3": version: 10.17.60 resolution: "@types/node@npm:10.17.60" @@ -8657,7 +8746,7 @@ __metadata: languageName: node linkType: hard -"browser-stdout@npm:1.3.1": +"browser-stdout@npm:1.3.1, browser-stdout@npm:^1.3.1": version: 1.3.1 resolution: "browser-stdout@npm:1.3.1" checksum: c40e482fd82be872b6ea7b9f7591beafbf6f5ba522fe3dade98ba1573a1c29a11101564993e4eb44e5488be8f44510af072df9a9637c739217eb155ceb639205 @@ -9163,6 +9252,21 @@ __metadata: languageName: node linkType: hard +"chai@npm:^4.0.0": + version: 4.5.0 + resolution: "chai@npm:4.5.0" + dependencies: + assertion-error: "npm:^1.1.0" + check-error: "npm:^1.0.3" + deep-eql: "npm:^4.1.3" + get-func-name: "npm:^2.0.2" + loupe: "npm:^2.3.6" + pathval: "npm:^1.1.1" + type-detect: "npm:^4.1.0" + checksum: b8cb596bd1aece1aec659e41a6e479290c7d9bee5b3ad63d2898ad230064e5b47889a3bc367b20100a0853b62e026e2dc514acf25a3c9385f936aa3614d4ab4d + languageName: node + linkType: hard + "chai@npm:^4.2.0, chai@npm:^4.3.10, chai@npm:^4.3.4": version: 4.4.1 resolution: "chai@npm:4.4.1" @@ -9346,7 +9450,7 @@ __metadata: languageName: node linkType: hard -"chokidar@npm:^3.4.0, chokidar@npm:^3.5.2": +"chokidar@npm:^3.4.0, chokidar@npm:^3.5.2, chokidar@npm:^3.5.3": version: 3.6.0 resolution: "chokidar@npm:3.6.0" dependencies: @@ -9365,6 +9469,15 @@ __metadata: languageName: node linkType: hard +"chokidar@npm:^4.0.0": + version: 4.0.1 + resolution: "chokidar@npm:4.0.1" + dependencies: + readdirp: "npm:^4.0.1" + checksum: 4bb7a3adc304059810bb6c420c43261a15bb44f610d77c35547addc84faa0374265c3adc67f25d06f363d9a4571962b02679268c40de07676d260de1986efea9 + languageName: node + linkType: hard + "chownr@npm:^1.1.4": version: 1.1.4 resolution: "chownr@npm:1.1.4" @@ -9860,6 +9973,13 @@ __metadata: languageName: node linkType: hard +"commander@npm:^8.1.0": + version: 8.3.0 + resolution: "commander@npm:8.3.0" + checksum: 8b043bb8322ea1c39664a1598a95e0495bfe4ca2fad0d84a92d7d1d8d213e2a155b441d2470c8e08de7c4a28cf2bc6e169211c49e1b21d9f7edc6ae4d9356060 + languageName: node + linkType: hard + "commander@npm:^9.3.0, commander@npm:^9.4.0": version: 9.5.0 resolution: "commander@npm:9.5.0" @@ -10513,6 +10633,18 @@ __metadata: languageName: node linkType: hard +"debug@npm:^4.3.5, debug@npm:^4.3.7": + version: 4.3.7 + resolution: "debug@npm:4.3.7" + dependencies: + ms: "npm:^2.1.3" + peerDependenciesMeta: + supports-color: + optional: true + checksum: 1471db19c3b06d485a622d62f65947a19a23fbd0dd73f7fd3eafb697eec5360cde447fb075919987899b1a2096e85d35d4eb5a4de09a57600ac9cf7e6c8e768b + languageName: node + linkType: hard + "decamelize-keys@npm:^1.1.0": version: 1.1.1 resolution: "decamelize-keys@npm:1.1.1" @@ -10842,7 +10974,7 @@ __metadata: languageName: node linkType: hard -"diff@npm:^5.0.0": +"diff@npm:^5.0.0, diff@npm:^5.2.0": version: 5.2.0 resolution: "diff@npm:5.2.0" checksum: aed0941f206fe261ecb258dc8d0ceea8abbde3ace5827518ff8d302f0fc9cc81ce116c4d8f379151171336caf0516b79e01abdc1ed1201b6440d895a66689eb4 @@ -12255,6 +12387,21 @@ __metadata: languageName: node linkType: hard +"ethers@npm:^6.13.4": + version: 6.13.4 + resolution: "ethers@npm:6.13.4" + dependencies: + "@adraffy/ens-normalize": "npm:1.10.1" + "@noble/curves": "npm:1.2.0" + "@noble/hashes": "npm:1.3.2" + "@types/node": "npm:22.7.5" + aes-js: "npm:4.0.0-beta.5" + tslib: "npm:2.7.0" + ws: "npm:8.17.1" + checksum: efcf9f39f841e38af68ec23cdbd745432c239c256aac4929842d1af04e55d7be0ff65e462f1cf3e93586f43f7bdcc0098fd56f2f7234f36d73e466521a5766ce + languageName: node + linkType: hard + "ethjs-unit@npm:0.1.6": version: 0.1.6 resolution: "ethjs-unit@npm:0.1.6" @@ -12825,6 +12972,18 @@ __metadata: languageName: node linkType: hard +"fdir@npm:^6.4.2": + version: 6.4.2 + resolution: "fdir@npm:6.4.2" + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + checksum: 34829886f34a3ca4170eca7c7180ec4de51a3abb4d380344063c0ae2e289b11d2ba8b724afee974598c83027fea363ff598caf2b51bc4e6b1e0d8b80cc530573 + languageName: node + linkType: hard + "fecha@npm:^4.2.0": version: 4.2.3 resolution: "fecha@npm:4.2.3" @@ -13715,7 +13874,7 @@ __metadata: languageName: node linkType: hard -"glob@npm:8.1.0, glob@npm:^8.0.3": +"glob@npm:8.1.0, glob@npm:^8.0.3, glob@npm:^8.1.0": version: 8.1.0 resolution: "glob@npm:8.1.0" dependencies: @@ -14218,6 +14377,32 @@ __metadata: languageName: node linkType: hard +"hardhat-graph-protocol@workspace:^0.0.1, hardhat-graph-protocol@workspace:packages/hardhat-graph-protocol": + version: 0.0.0-use.local + resolution: "hardhat-graph-protocol@workspace:packages/hardhat-graph-protocol" + dependencies: + "@graphprotocol/contracts": "workspace:^7.0.0" + "@graphprotocol/horizon": "workspace:^0.0.1" + "@graphprotocol/subgraph-service": "workspace:^0.0.1" + "@nomicfoundation/hardhat-ethers": "npm:^3.0.8" + "@types/chai": "npm:^4.0.0" + "@types/debug": "npm:^4.1.12" + "@types/mocha": "npm:^10.0.9" + chai: "npm:^4.0.0" + debug: "npm:^4.3.7" + eslint: "npm:^8.56.0" + eslint-graph-config: "workspace:^0.0.1" + ethers: "npm:^6.13.4" + hardhat: "npm:^2.22.16" + mocha: "npm:^10.8.2" + ts-node: "npm:^8.0.0" + typescript: "npm:^5.6.3" + peerDependencies: + ethers: ^6.13.4 + hardhat: ^2.22.16 + languageName: unknown + linkType: soft + "hardhat-secure-accounts@npm:0.0.5": version: 0.0.5 resolution: "hardhat-secure-accounts@npm:0.0.5" @@ -14362,6 +14547,68 @@ __metadata: languageName: node linkType: hard +"hardhat@npm:^2.22.0, hardhat@npm:^2.22.16": + version: 2.22.16 + resolution: "hardhat@npm:2.22.16" + dependencies: + "@ethersproject/abi": "npm:^5.1.2" + "@metamask/eth-sig-util": "npm:^4.0.0" + "@nomicfoundation/edr": "npm:^0.6.4" + "@nomicfoundation/ethereumjs-common": "npm:4.0.4" + "@nomicfoundation/ethereumjs-tx": "npm:5.0.4" + "@nomicfoundation/ethereumjs-util": "npm:9.0.4" + "@nomicfoundation/solidity-analyzer": "npm:^0.1.0" + "@sentry/node": "npm:^5.18.1" + "@types/bn.js": "npm:^5.1.0" + "@types/lru-cache": "npm:^5.1.0" + adm-zip: "npm:^0.4.16" + aggregate-error: "npm:^3.0.0" + ansi-escapes: "npm:^4.3.0" + boxen: "npm:^5.1.2" + chokidar: "npm:^4.0.0" + ci-info: "npm:^2.0.0" + debug: "npm:^4.1.1" + enquirer: "npm:^2.3.0" + env-paths: "npm:^2.2.0" + ethereum-cryptography: "npm:^1.0.3" + ethereumjs-abi: "npm:^0.6.8" + find-up: "npm:^5.0.0" + fp-ts: "npm:1.19.3" + fs-extra: "npm:^7.0.1" + immutable: "npm:^4.0.0-rc.12" + io-ts: "npm:1.10.4" + json-stream-stringify: "npm:^3.1.4" + keccak: "npm:^3.0.2" + lodash: "npm:^4.17.11" + mnemonist: "npm:^0.38.0" + mocha: "npm:^10.0.0" + p-map: "npm:^4.0.0" + picocolors: "npm:^1.1.0" + raw-body: "npm:^2.4.1" + resolve: "npm:1.17.0" + semver: "npm:^6.3.0" + solc: "npm:0.8.26" + source-map-support: "npm:^0.5.13" + stacktrace-parser: "npm:^0.1.10" + tinyglobby: "npm:^0.2.6" + tsort: "npm:0.0.1" + undici: "npm:^5.14.0" + uuid: "npm:^8.3.2" + ws: "npm:^7.4.6" + peerDependencies: + ts-node: "*" + typescript: "*" + peerDependenciesMeta: + ts-node: + optional: true + typescript: + optional: true + bin: + hardhat: internal/cli/bootstrap.js + checksum: d193d8dbd02aba9875fc4df23c49fe8cf441afb63382c9e248c776c75aca6e081e9b7b75fb262739f20bff152f9e0e4112bb22e3609dfa63ed4469d3ea46c0ca + languageName: node + linkType: hard + "hardhat@npm:~2.14.0": version: 2.14.1 resolution: "hardhat@npm:2.14.1" @@ -14618,7 +14865,7 @@ __metadata: languageName: node linkType: hard -"he@npm:1.2.0": +"he@npm:1.2.0, he@npm:^1.2.0": version: 1.2.0 resolution: "he@npm:1.2.0" bin: @@ -16387,6 +16634,13 @@ __metadata: languageName: node linkType: hard +"json-stream-stringify@npm:^3.1.4": + version: 3.1.6 + resolution: "json-stream-stringify@npm:3.1.6" + checksum: cb45e65143f4634ebb2dc0732410a942eaf86f88a7938b2f6397f4c6b96a7ba936e74d4d17db48c9221f669153996362b2ff50fe8c7fed8a7548646f98ae1f58 + languageName: node + linkType: hard + "json-stringify-safe@npm:^5.0.1, json-stringify-safe@npm:~5.0.1": version: 5.0.1 resolution: "json-stringify-safe@npm:5.0.1" @@ -17875,7 +18129,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^5.0.1": +"minimatch@npm:^5.0.1, minimatch@npm:^5.1.6": version: 5.1.6 resolution: "minimatch@npm:5.1.6" dependencies: @@ -18118,6 +18372,37 @@ __metadata: languageName: node linkType: hard +"mocha@npm:^10.8.2": + version: 10.8.2 + resolution: "mocha@npm:10.8.2" + dependencies: + ansi-colors: "npm:^4.1.3" + browser-stdout: "npm:^1.3.1" + chokidar: "npm:^3.5.3" + debug: "npm:^4.3.5" + diff: "npm:^5.2.0" + escape-string-regexp: "npm:^4.0.0" + find-up: "npm:^5.0.0" + glob: "npm:^8.1.0" + he: "npm:^1.2.0" + js-yaml: "npm:^4.1.0" + log-symbols: "npm:^4.1.0" + minimatch: "npm:^5.1.6" + ms: "npm:^2.1.3" + serialize-javascript: "npm:^6.0.2" + strip-json-comments: "npm:^3.1.1" + supports-color: "npm:^8.1.1" + workerpool: "npm:^6.5.1" + yargs: "npm:^16.2.0" + yargs-parser: "npm:^20.2.9" + yargs-unparser: "npm:^2.0.0" + bin: + _mocha: bin/_mocha + mocha: bin/mocha.js + checksum: 1f786290a32a1c234f66afe2bfcc68aa50fe9c7356506bd39cca267efb0b4714a63a0cb333815578d63785ba2fba058bf576c2512db73997c0cae0d659a88beb + languageName: node + linkType: hard + "mocha@npm:^4.0.1": version: 4.1.0 resolution: "mocha@npm:4.1.0" @@ -18210,7 +18495,7 @@ __metadata: languageName: node linkType: hard -"ms@npm:2.1.3, ms@npm:^2.1.1": +"ms@npm:2.1.3, ms@npm:^2.1.1, ms@npm:^2.1.3": version: 2.1.3 resolution: "ms@npm:2.1.3" checksum: d924b57e7312b3b63ad21fc5b3dc0af5e78d61a1fc7cfb5457edaf26326bf62be5307cc87ffb6862ef1c2b33b0233cdb5d4f01c4c958cc0d660948b65a287a48 @@ -19739,6 +20024,13 @@ __metadata: languageName: node linkType: hard +"picocolors@npm:^1.1.0": + version: 1.1.1 + resolution: "picocolors@npm:1.1.1" + checksum: e2e3e8170ab9d7c7421969adaa7e1b31434f789afb9b3f115f6b96d91945041ac3ceb02e9ec6fe6510ff036bcc0bf91e69a1772edc0b707e12b19c0f2d6bcf58 + languageName: node + linkType: hard + "picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.3.1": version: 2.3.1 resolution: "picomatch@npm:2.3.1" @@ -20681,6 +20973,13 @@ __metadata: languageName: node linkType: hard +"readdirp@npm:^4.0.1": + version: 4.0.2 + resolution: "readdirp@npm:4.0.2" + checksum: a16ecd8ef3286dcd90648c3b103e3826db2b766cdb4a988752c43a83f683d01c7059158d623cbcd8bdfb39e65d302d285be2d208e7d9f34d022d912b929217dd + languageName: node + linkType: hard + "readdirp@npm:~3.6.0": version: 3.6.0 resolution: "readdirp@npm:3.6.0" @@ -21653,6 +21952,15 @@ __metadata: languageName: node linkType: hard +"serialize-javascript@npm:^6.0.2": + version: 6.0.2 + resolution: "serialize-javascript@npm:6.0.2" + dependencies: + randombytes: "npm:^2.1.0" + checksum: 2dd09ef4b65a1289ba24a788b1423a035581bef60817bea1f01eda8e3bda623f86357665fe7ac1b50f6d4f583f97db9615b3f07b2a2e8cbcb75033965f771dd2 + languageName: node + linkType: hard + "serve-static@npm:1.14.2": version: 1.14.2 resolution: "serve-static@npm:1.14.2" @@ -22099,6 +22407,23 @@ __metadata: languageName: node linkType: hard +"solc@npm:0.8.26": + version: 0.8.26 + resolution: "solc@npm:0.8.26" + dependencies: + command-exists: "npm:^1.2.8" + commander: "npm:^8.1.0" + follow-redirects: "npm:^1.12.1" + js-sha3: "npm:0.8.0" + memorystream: "npm:^0.3.1" + semver: "npm:^5.5.0" + tmp: "npm:0.0.33" + bin: + solcjs: solc.js + checksum: 1eea35da99c228d0dc1d831c29f7819e7921b67824c889a5e5f2e471a2ef5856a15fabc0b5de067f5ba994fa36fb5a563361963646fe98dad58a0e4fa17c8b2d + languageName: node + linkType: hard + "solc@npm:^0.4.20": version: 0.4.26 resolution: "solc@npm:0.4.26" @@ -22376,7 +22701,7 @@ __metadata: languageName: node linkType: hard -"source-map-support@npm:^0.5.13, source-map-support@npm:^0.5.16": +"source-map-support@npm:^0.5.13, source-map-support@npm:^0.5.16, source-map-support@npm:^0.5.17": version: 0.5.21 resolution: "source-map-support@npm:0.5.21" dependencies: @@ -22902,7 +23227,7 @@ __metadata: languageName: node linkType: hard -"supports-color@npm:8.1.1": +"supports-color@npm:8.1.1, supports-color@npm:^8.1.1": version: 8.1.1 resolution: "supports-color@npm:8.1.1" dependencies: @@ -23270,6 +23595,16 @@ __metadata: languageName: node linkType: hard +"tinyglobby@npm:^0.2.6": + version: 0.2.10 + resolution: "tinyglobby@npm:0.2.10" + dependencies: + fdir: "npm:^6.4.2" + picomatch: "npm:^4.0.2" + checksum: ce946135d39b8c0e394e488ad59f4092e8c4ecd675ef1bcd4585c47de1b325e61ec6adfbfbe20c3c2bfa6fd674c5b06de2a2e65c433f752ae170aff11793e5ef + languageName: node + linkType: hard + "title-case@npm:^3.0.3": version: 3.0.3 resolution: "title-case@npm:3.0.3" @@ -23537,6 +23872,26 @@ __metadata: languageName: node linkType: hard +"ts-node@npm:^8.0.0": + version: 8.10.2 + resolution: "ts-node@npm:8.10.2" + dependencies: + arg: "npm:^4.1.0" + diff: "npm:^4.0.1" + make-error: "npm:^1.1.1" + source-map-support: "npm:^0.5.17" + yn: "npm:3.1.1" + peerDependencies: + typescript: ">=2.7" + bin: + ts-node: dist/bin.js + ts-node-script: dist/bin-script.js + ts-node-transpile-only: dist/bin-transpile.js + ts-script: dist/bin-script-deprecated.js + checksum: 628343f62fff2543b4559a93eb27005084aea7609945e77f311031c5e96c4099736646856e1792605b90e8007d2c060fe80783be21c94788d91d6f259aab92e2 + languageName: node + linkType: hard + "tsconfig-paths@npm:^4.2.0": version: 4.2.0 resolution: "tsconfig-paths@npm:4.2.0" @@ -23555,6 +23910,13 @@ __metadata: languageName: node linkType: hard +"tslib@npm:2.7.0": + version: 2.7.0 + resolution: "tslib@npm:2.7.0" + checksum: 469e1d5bf1af585742128827000711efa61010b699cb040ab1800bcd3ccdd37f63ec30642c9e07c4439c1db6e46345582614275daca3e0f4abae29b0083f04a6 + languageName: node + linkType: hard + "tslib@npm:^1.11.1, tslib@npm:^1.9.0, tslib@npm:^1.9.3": version: 1.14.1 resolution: "tslib@npm:1.14.1" @@ -23669,6 +24031,13 @@ __metadata: languageName: node linkType: hard +"type-detect@npm:^4.1.0": + version: 4.1.0 + resolution: "type-detect@npm:4.1.0" + checksum: df8157ca3f5d311edc22885abc134e18ff8ffbc93d6a9848af5b682730ca6a5a44499259750197250479c5331a8a75b5537529df5ec410622041650a7f293e2a + languageName: node + linkType: hard + "type-fest@npm:^0.13.1": version: 0.13.1 resolution: "type-fest@npm:0.13.1" @@ -23922,6 +24291,16 @@ __metadata: languageName: node linkType: hard +"typescript@npm:^5.6.3": + version: 5.6.3 + resolution: "typescript@npm:5.6.3" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 44f61d3fb15c35359bc60399cb8127c30bae554cd555b8e2b46d68fa79d680354b83320ad419ff1b81a0bdf324197b29affe6cc28988cd6a74d4ac60c94f9799 + languageName: node + linkType: hard + "typescript@patch:typescript@npm%3A^4.0.2#optional!builtin, typescript@patch:typescript@npm%3A^4.4.3#optional!builtin": version: 4.9.5 resolution: "typescript@patch:typescript@npm%3A4.9.5#optional!builtin::version=4.9.5&hash=289587" @@ -23942,6 +24321,16 @@ __metadata: languageName: node linkType: hard +"typescript@patch:typescript@npm%3A^5.6.3#optional!builtin": + version: 5.6.3 + resolution: "typescript@patch:typescript@npm%3A5.6.3#optional!builtin::version=5.6.3&hash=e012d7" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: ac8307bb06bbfd08ae7137da740769b7d8c3ee5943188743bb622c621f8ad61d244767480f90fbd840277fbf152d8932aa20c33f867dea1bb5e79b187ca1a92f + languageName: node + linkType: hard + "typewise-core@npm:^1.2, typewise-core@npm:^1.2.0": version: 1.2.0 resolution: "typewise-core@npm:1.2.0" @@ -24077,6 +24466,13 @@ __metadata: languageName: node linkType: hard +"undici-types@npm:~6.19.2": + version: 6.19.8 + resolution: "undici-types@npm:6.19.8" + checksum: 078afa5990fba110f6824823ace86073b4638f1d5112ee26e790155f481f2a868cc3e0615505b6f4282bdf74a3d8caad715fd809e870c2bb0704e3ea6082f344 + languageName: node + linkType: hard + "undici@npm:^5.14.0": version: 5.28.4 resolution: "undici@npm:5.28.4" @@ -25575,6 +25971,13 @@ __metadata: languageName: node linkType: hard +"workerpool@npm:^6.5.1": + version: 6.5.1 + resolution: "workerpool@npm:6.5.1" + checksum: 58e8e969782292cb3a7bfba823f1179a7615250a0cefb4841d5166234db1880a3d0fe83a31dd8d648329ec92c2d0cd1890ad9ec9e53674bb36ca43e9753cdeac + languageName: node + linkType: hard + "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0, wrap-ansi@npm:^7.0.0": version: 7.0.0 resolution: "wrap-ansi@npm:7.0.0" @@ -25889,7 +26292,7 @@ __metadata: languageName: node linkType: hard -"yargs-parser@npm:^20.2.2, yargs-parser@npm:^20.2.3": +"yargs-parser@npm:^20.2.2, yargs-parser@npm:^20.2.3, yargs-parser@npm:^20.2.9": version: 20.2.9 resolution: "yargs-parser@npm:20.2.9" checksum: 0685a8e58bbfb57fab6aefe03c6da904a59769bd803a722bb098bd5b0f29d274a1357762c7258fb487512811b8063fb5d2824a3415a0a4540598335b3b086c72 @@ -25912,7 +26315,7 @@ __metadata: languageName: node linkType: hard -"yargs-unparser@npm:2.0.0": +"yargs-unparser@npm:2.0.0, yargs-unparser@npm:^2.0.0": version: 2.0.0 resolution: "yargs-unparser@npm:2.0.0" dependencies: @@ -25924,7 +26327,7 @@ __metadata: languageName: node linkType: hard -"yargs@npm:16.2.0": +"yargs@npm:16.2.0, yargs@npm:^16.2.0": version: 16.2.0 resolution: "yargs@npm:16.2.0" dependencies: