Skip to content

Commit

Permalink
fix(core): Add foundry specific messages
Browse files Browse the repository at this point in the history
  • Loading branch information
RPate97 committed Jan 22, 2023
1 parent 2e41b30 commit d481925
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .changeset/silent-ducks-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chugsplash/core': patch
---

Add foundry specific messages
28 changes: 16 additions & 12 deletions packages/core/src/messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ npx hardhat chugsplash-register --network <network> --owner <ownerAddress> --con
} else {
// TODO - output foundry error
throw new Error(`This project has not been registered on ${networkName}.
To register the project on this network...
To register the project on this network, call the register function from your script:
TODO: Finish foundry error message`)
chugsplash.register("${configPath}", false);
`)
}
}

Expand All @@ -52,9 +53,10 @@ npx hardhat chugsplash-cancel --network <network> --config-path ${configPath}
)
} else {
// TODO - output foundry error
throw new Error(`Project is currently active. You must cancel the project in order to withdraw funds...
throw new Error(`Project is currently active. You must cancel the project in order to withdraw funds:
TODO: Finish foundry error message`)
chugsplash.cancel("${configPath}");
`)
}
}

Expand All @@ -79,13 +81,14 @@ npx hardhat chugsplash-approve --network <network> --config-path ${configPath}`
} else {
// TODO - output foundry error
if (amount.gt(0)) {
return `Project successfully proposed on ${networkName}. Fund and approve the deployment...
return `Project successfully proposed on ${networkName}. To fund and approve the deployment, call the following functions from your script:
TODO: Finish foundry success message`
chugsplash.fund("${configPath}", ${amount} ether, false);
chugsplas.approve("${configPath}", false, false);`
} else {
return `Project successfully proposed and funded on ${networkName}. Approve the deployment...
return `Project successfully proposed and funded on ${networkName}. To approve the deployment, call the following function from your script:
TODO: Finish foundry success message`
chugsplas.approve("${configPath}", false, false);`
}
}
}
Expand All @@ -111,13 +114,14 @@ npx hardhat chugsplash-approve --network <network> --config-path ${configPath}`
} else {
// TODO - output foundry error
if (amount.gt(0)) {
return `Project has already been proposed on ${networkName}. Fund and approve the deployment...
return `Project has already been proposed on ${networkName}. To fund and approve the deployment, call the following functions from your script:
TODO: Finish foundry success message`
chugsplash.fund("${configPath}", ${amount} ether, false);
chugsplas.approve("${configPath}", false, false);`
} else {
return `Project has already been proposed and funded on ${networkName}. Approve the deployment using the command:
return `Project has already been proposed and funded on ${networkName}. To approve the deployment, call the following function from your script:
TODO: Finish foundry success message`
chugsplas.approve("${configPath}", false, false);`
}
}
}
20 changes: 10 additions & 10 deletions packages/core/src/tasks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ export const chugsplashApproveAbstractTask = async (
const signerAddress = await signer.getAddress()

if (!(await isProjectRegistered(signer, projectName))) {
await errorProjectNotRegistered(provider, configPath, 'hardhat')
await errorProjectNotRegistered(provider, configPath, integration)
}

const projectOwnerAddress = await getProjectOwnerAddress(signer, projectName)
Expand Down Expand Up @@ -587,7 +587,7 @@ Please send more ETH to ${await signer.getAddress()} on ${networkName} then try
}

if (!(await isProjectRegistered(signer, projectName))) {
await errorProjectNotRegistered(provider, configPath, 'hardhat')
await errorProjectNotRegistered(provider, configPath, integration)
}

spinner.start(
Expand Down Expand Up @@ -909,7 +909,7 @@ export const chugsplashMonitorAbstractTask = async (
remoteExecution: boolean,
stream: NodeJS.WritableStream = process.stderr
) => {
const networkName = await resolveNetworkName(provider, 'hardhat')
const networkName = await resolveNetworkName(provider, integration)
const spinner = ora({ isSilent: silent, stream })
spinner.start(`Loading project information...`)

Expand All @@ -928,7 +928,7 @@ export const chugsplashMonitorAbstractTask = async (
(await isProjectRegistered(signer, parsedConfig.options.projectName)) ===
false
) {
await errorProjectNotRegistered(provider, configPath, 'hardhat')
await errorProjectNotRegistered(provider, configPath, integration)
}

// Get the bundle info by calling the commit subtask locally (i.e. without publishing the
Expand Down Expand Up @@ -1029,7 +1029,7 @@ export const chugsplashCancelAbstractTask = async (
spinner.start(`Cancelling ${projectName} on ${networkName}.`)

if (!(await isProjectRegistered(signer, projectName))) {
await errorProjectNotRegistered(provider, configPath, 'hardhat')
await errorProjectNotRegistered(provider, configPath, integration)
}

const projectOwnerAddress = await getProjectOwnerAddress(signer, projectName)
Expand Down Expand Up @@ -1107,7 +1107,7 @@ export const chugsplashWithdrawAbstractTask = async (
)

if (!(await isProjectRegistered(signer, projectName))) {
await errorProjectNotRegistered(provider, configPath, 'hardhat')
await errorProjectNotRegistered(provider, configPath, integration)
}

const projectOwnerAddress = await getProjectOwnerAddress(signer, projectName)
Expand Down Expand Up @@ -1265,7 +1265,7 @@ export const chugsplashListProposersAbstractTask = async (
(await isProjectRegistered(signer, parsedConfig.options.projectName)) ===
false
) {
await errorProjectNotRegistered(provider, configPath, 'hardhat')
await errorProjectNotRegistered(provider, configPath, integration)
}

const ChugSplashManager = getChugSplashManager(
Expand Down Expand Up @@ -1342,7 +1342,7 @@ export const chugsplashAddProposersAbstractTask = async (
(await isProjectRegistered(signer, parsedConfig.options.projectName)) ===
false
) {
await errorProjectNotRegistered(provider, configPath, 'hardhat')
await errorProjectNotRegistered(provider, configPath, integration)
}

const ChugSplashManager = getChugSplashManager(
Expand Down Expand Up @@ -1425,7 +1425,7 @@ export const chugsplashClaimProxyAbstractTask = async (
(await isProjectRegistered(signer, parsedConfig.options.projectName)) ===
false
) {
await errorProjectNotRegistered(provider, configPath, 'hardhat')
await errorProjectNotRegistered(provider, configPath, integration)
}

const owner = await getProjectOwnerAddress(
Expand Down Expand Up @@ -1498,7 +1498,7 @@ export const chugsplashTransferOwnershipAbstractTask = async (
(await isProjectRegistered(signer, parsedConfig.options.projectName)) ===
false
) {
await errorProjectNotRegistered(provider, configPath, 'hardhat')
await errorProjectNotRegistered(provider, configPath, integration)
}

spinner.succeed('Project registration detected')
Expand Down

0 comments on commit d481925

Please sign in to comment.