Skip to content

Commit

Permalink
Removed local argument, added HARDHAT_NETWORK to .env.example
Browse files Browse the repository at this point in the history
  • Loading branch information
RPate97 committed Nov 14, 2022
1 parent a43e0e3 commit e862925
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 51 deletions.
5 changes: 5 additions & 0 deletions .changeset/plenty-tigers-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chugsplash/plugins': patch
---

Remove local flag
1 change: 1 addition & 0 deletions packages/executor/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ IPFS_API_KEY_SECRET=<ipfs api key to retrieve config file>
OPT_ETHERSCAN_API_KEY=<Optimism Etherscan API key>
ETH_ETHERSCAN_API_KEY=<Ethereum Etherscan API key>
INFURA_API_KEY=<Infura Project API Key>
HARDHAT_NETWORK=<Target hardhat network, used for verification>
7 changes: 2 additions & 5 deletions packages/plugins/src/hardhat/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@ import { writeHardhatSnapshotId } from './utils'
* @param hre Hardhat Runtime Environment.
* @param contractName Name of the contract in the config file.
*/
export const deployConfigs = async (
hre: any,
silent: boolean,
local: boolean
) => {
export const deployConfigs = async (hre: any, silent: boolean) => {
const local = (await getChainId(hre.ethers.provider)) === 31337 ? true : false
const fileNames = fs.readdirSync(hre.config.paths.chugsplash)
for (const fileName of fileNames) {
await deployConfig(hre, fileName, silent, local)
Expand Down
69 changes: 23 additions & 46 deletions packages/plugins/src/hardhat/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,23 +212,16 @@ subtask(TASK_CHUGSPLASH_FETCH)

task(TASK_CHUGSPLASH_DEPLOY)
.addFlag('silent', "Hide all of ChugSplash's output")
.addOptionalParam<boolean>(
'local',
'Enable local execution within the CLI',
true,
types.boolean
)
.setAction(
async (
args: {
silent: boolean
local: boolean
},
hre: any
) => {
const signer = await hre.ethers.getSigner()
await deployChugSplashPredeploys(hre, signer)
await deployConfigs(hre, args.silent, args.local)
await deployConfigs(hre, args.silent)
}
)

Expand Down Expand Up @@ -1085,19 +1078,12 @@ task(TASK_NODE)
"Completely disable all of ChugSplash's activity."
)
.addFlag('silent', "Hide all of ChugSplash's output")
.addOptionalParam<boolean>(
'local',
'Enable local execution within the CLI',
true,
types.boolean
)
.setAction(
async (
args: {
setupInternals: boolean
disableChugsplash: boolean
silent: boolean
local: boolean
},
hre: any,
runSuper
Expand All @@ -1106,7 +1092,7 @@ task(TASK_NODE)
const deployer = await hre.ethers.getSigner()
await deployChugSplashPredeploys(hre, deployer)
if (!args.setupInternals) {
await deployConfigs(hre, args.silent, args.local)
await deployConfigs(hre, args.silent)
}
await writeHardhatSnapshotId(hre)
}
Expand All @@ -1116,39 +1102,30 @@ task(TASK_NODE)

task(TASK_TEST)
.addFlag('show', 'Show ChugSplash deployment information')
.addOptionalParam<boolean>(
'local',
'Enable local execution within the CLI',
true,
types.boolean
)
.setAction(
async (args: { show: boolean; local: boolean }, hre: any, runSuper) => {
if ((await getChainId(hre.ethers.provider)) === 31337) {
try {
const snapshotIdPath = path.join(
path.basename(hre.config.paths.deployed),
hre.network.name === 'localhost' ? 'localhost' : 'hardhat',
'.snapshotId'
)
const snapshotId = fs.readFileSync(snapshotIdPath, 'utf8')
const snapshotReverted = await hre.network.provider.send(
'evm_revert',
[snapshotId]
)
if (!snapshotReverted) {
throw new Error('Snapshot failed to be reverted.')
}
} catch {
await deployChugSplashPredeploys(hre, await hre.ethers.getSigner())
await deployConfigs(hre, !args.show, args.local)
} finally {
await writeHardhatSnapshotId(hre)
.setAction(async (args: { show: boolean }, hre: any, runSuper) => {
if ((await getChainId(hre.ethers.provider)) === 31337) {
try {
const snapshotIdPath = path.join(
path.basename(hre.config.paths.deployed),
hre.network.name === 'localhost' ? 'localhost' : 'hardhat',
'.snapshotId'
)
const snapshotId = fs.readFileSync(snapshotIdPath, 'utf8')
const snapshotReverted = await hre.network.provider.send('evm_revert', [
snapshotId,
])
if (!snapshotReverted) {
throw new Error('Snapshot failed to be reverted.')
}
} catch {
await deployChugSplashPredeploys(hre, await hre.ethers.getSigner())
await deployConfigs(hre, !args.show)
} finally {
await writeHardhatSnapshotId(hre)
}
await runSuper(args)
}
)
await runSuper(args)
})

task(TASK_RUN).setAction(async (args, hre: any, runSuper) => {
await hre.run(TASK_CHUGSPLASH_DEPLOY, hre)
Expand Down

0 comments on commit e862925

Please sign in to comment.