diff --git a/.changeset/fast-mangos-smoke.md b/.changeset/fast-mangos-smoke.md new file mode 100644 index 000000000000..3d930d04893a --- /dev/null +++ b/.changeset/fast-mangos-smoke.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/hardhat-deploy-config': patch +--- + +Support JSON-formatted deploy configs diff --git a/packages/contracts-bedrock/hardhat.config.ts b/packages/contracts-bedrock/hardhat.config.ts index e07578243e41..106bc67294c3 100644 --- a/packages/contracts-bedrock/hardhat.config.ts +++ b/packages/contracts-bedrock/hardhat.config.ts @@ -46,6 +46,11 @@ const config: HardhatUserConfig = { url: process.env.L1_RPC || '', accounts: [process.env.PRIVATE_KEY_DEPLOYER || ethers.constants.HashZero], }, + deployer: { + chainId: Number(process.env.CHAIN_ID), + url: process.env.L1_RPC || '', + accounts: [process.env.PRIVATE_KEY_DEPLOYER || ethers.constants.HashZero], + }, }, foundry: { buildInfo: true, diff --git a/packages/hardhat-deploy-config/src/plugin.ts b/packages/hardhat-deploy-config/src/plugin.ts index 725c379671a1..42f405e1d6eb 100644 --- a/packages/hardhat-deploy-config/src/plugin.ts +++ b/packages/hardhat-deploy-config/src/plugin.ts @@ -1,4 +1,5 @@ import * as path from 'path' +import * as fs from 'fs' import { extendEnvironment, extendConfig } from 'hardhat/config' import { @@ -28,9 +29,16 @@ const normalizePath = ( export const loadDeployConfig = (hre: HardhatRuntimeEnvironment): any => { let config: any try { - config = + const base = `${hre.config.paths.deployConfig}/${hre.network.name}` + if (fs.existsSync(`${base}.ts`)) { // eslint-disable-next-line @typescript-eslint/no-var-requires - require(`${hre.config.paths.deployConfig}/${hre.network.name}.ts`).default + config = require(`${base}.ts`).default + } else if (fs.existsSync(`${base}.json`)) { + // eslint-disable-next-line @typescript-eslint/no-var-requires + config = require(`${base}.json`) + } else { + throw new Error('not found') + } } catch (err) { throw new Error( `error while loading deploy config for network: ${hre.network.name}, ${err}`