Skip to content

Commit

Permalink
fix(pg): Fix issue where ChugSplash not initialized when executing lo…
Browse files Browse the repository at this point in the history
…cally (sphinx-labs#494)
  • Loading branch information
RPate97 authored Feb 11, 2023
1 parent e4446ae commit 5ffd3cc
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/popular-baboons-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chugsplash/plugins': patch
---

Fix issue where ChugSplash not initialized when executing locally
33 changes: 27 additions & 6 deletions packages/plugins/src/hardhat/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,10 @@ export const chugsplashDeployTask = async (
const spinner = ora({ isSilent: silent })

const provider = hre.ethers.provider
const signer = provider.getSigner()
const signer = hre.ethers.provider.getSigner()
const signerAddress = await signer.getAddress()
await initializeChugSplash(hre.ethers.provider, signer, signerAddress)

const remoteExecution =
(await getChainId(provider)) !== hre.network.config.chainId

Expand Down Expand Up @@ -228,7 +230,10 @@ export const chugsplashRegisterTask = async (
const { configPath, silent, owner } = args

const provider = hre.ethers.provider
const signer = provider.getSigner()
const signer = hre.ethers.provider.getSigner()
const signerAddress = await signer.getAddress()
await initializeChugSplash(hre.ethers.provider, signer, signerAddress)

const userConfig = readUserChugSplashConfig(configPath)
const artifactPaths = await getArtifactPaths(
hre,
Expand Down Expand Up @@ -290,7 +295,9 @@ export const chugsplashProposeTask = async (
}

const provider = hre.ethers.provider
const signer = provider.getSigner()
const signer = hre.ethers.provider.getSigner()
const signerAddress = await signer.getAddress()
await initializeChugSplash(hre.ethers.provider, signer, signerAddress)

const userConfig = readUserChugSplashConfig(configPath)

Expand Down Expand Up @@ -357,7 +364,9 @@ export const chugsplashApproveTask = async (
const { configPath, noWithdraw, silent, skipMonitorStatus } = args

const provider = hre.ethers.provider
const signer = provider.getSigner()
const signer = hre.ethers.provider.getSigner()
const signerAddress = await signer.getAddress()
await initializeChugSplash(hre.ethers.provider, signer, signerAddress)

const canonicalConfigPath = hre.config.paths.canonicalConfigs
const deploymentFolder = hre.config.paths.deployments
Expand Down Expand Up @@ -401,6 +410,10 @@ task(TASK_CHUGSPLASH_APPROVE)
subtask(TASK_CHUGSPLASH_LIST_ALL_PROJECTS)
.setDescription('Lists all existing ChugSplash projects')
.setAction(async (_, hre) => {
const signer = hre.ethers.provider.getSigner()
const signerAddress = await signer.getAddress()
await initializeChugSplash(hre.ethers.provider, signer, signerAddress)

const ChugSplashRegistry = getChugSplashRegistry(
hre.ethers.provider.getSigner()
)
Expand Down Expand Up @@ -490,6 +503,9 @@ subtask(TASK_CHUGSPLASH_LIST_BUNDLES)
hre
) => {
const signer = hre.ethers.provider.getSigner()
const signerAddress = await signer.getAddress()
await initializeChugSplash(hre.ethers.provider, signer, signerAddress)

const ChugSplashRegistry = getChugSplashRegistry(signer)

const ChugSplashManager = new ethers.Contract(
Expand Down Expand Up @@ -615,7 +631,10 @@ export const monitorTask = async (
const { configPath, noWithdraw, silent, newOwner } = args

const provider = hre.ethers.provider
const signer = provider.getSigner()
const signer = hre.ethers.provider.getSigner()
const signerAddress = await signer.getAddress()
await initializeChugSplash(hre.ethers.provider, signer, signerAddress)

const canonicalConfigPath = hre.config.paths.canonicalConfigs
const deploymentFolder = hre.config.paths.deployments

Expand Down Expand Up @@ -666,7 +685,9 @@ export const chugsplashFundTask = async (
const { amount, silent, configPath, autoEstimate } = args

const provider = hre.ethers.provider
const signer = provider.getSigner()
const signer = hre.ethers.provider.getSigner()
const signerAddress = await signer.getAddress()
await initializeChugSplash(hre.ethers.provider, signer, signerAddress)

const userConfig = readUserChugSplashConfig(configPath)
const artifactPaths = await getArtifactPaths(
Expand Down

0 comments on commit 5ffd3cc

Please sign in to comment.