From 2652df5a3d7fe50f5665fceae07a442c69a0f860 Mon Sep 17 00:00:00 2001 From: Sam Goldman Date: Sun, 4 Dec 2022 16:25:20 -0500 Subject: [PATCH] fix circular dependency issue caused by `isContractDeployed`: --- .changeset/sweet-dragons-fix.md | 5 +++++ packages/core/src/fund.ts | 7 +++++-- .../core/src/languages/solidity/predeploys.ts | 15 ++++++--------- packages/core/src/utils.ts | 8 +++++++- 4 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 .changeset/sweet-dragons-fix.md diff --git a/.changeset/sweet-dragons-fix.md b/.changeset/sweet-dragons-fix.md new file mode 100644 index 000000000..eff306ad8 --- /dev/null +++ b/.changeset/sweet-dragons-fix.md @@ -0,0 +1,5 @@ +--- +'@chugsplash/core': patch +--- + +Fixes circular dependency issue caused by `isContractDeployed` diff --git a/packages/core/src/fund.ts b/packages/core/src/fund.ts index c7f5510b8..c62910155 100644 --- a/packages/core/src/fund.ts +++ b/packages/core/src/fund.ts @@ -1,7 +1,11 @@ import { OWNER_BOND_AMOUNT } from '@chugsplash/contracts' import { ethers } from 'ethers' -import { getChugSplashManagerReadOnly, getDefaultProxyAddress } from './utils' +import { + getChugSplashManagerReadOnly, + getDefaultProxyAddress, + isContractDeployed, +} from './utils' import { ChugSplashActionBundle, DeployImplementationAction, @@ -10,7 +14,6 @@ import { isSetImplementationAction, isSetStorageAction, } from './actions' -import { isContractDeployed } from './languages' import { EXECUTION_BUFFER_MULTIPLIER } from './constants' /** diff --git a/packages/core/src/languages/solidity/predeploys.ts b/packages/core/src/languages/solidity/predeploys.ts index f8f5ea1cf..526f4759b 100644 --- a/packages/core/src/languages/solidity/predeploys.ts +++ b/packages/core/src/languages/solidity/predeploys.ts @@ -1,7 +1,6 @@ import assert from 'assert' import { ethers } from 'ethers' -import { Provider } from '@ethersproject/abstract-provider' import { OWNER_BOND_AMOUNT, EXECUTOR_BOND_AMOUNT, @@ -29,7 +28,12 @@ import { import { Logger } from '@eth-optimism/common-ts' import { sleep } from '@eth-optimism/core-utils' -import { getChugSplashRegistry, getProxyAt, getProxyAdmin } from '../../utils' +import { + getChugSplashRegistry, + getProxyAt, + getProxyAdmin, + isContractDeployed, +} from '../../utils' export const initializeChugSplash = async ( provider: ethers.providers.JsonRpcProvider, @@ -280,13 +284,6 @@ export const doDeterministicDeploy = async ( return new ethers.Contract(address, options.contract.abi, options.signer) } -export const isContractDeployed = async ( - address: string, - provider: Provider -): Promise => { - return (await provider.getCode(address)) !== '0x' -} - export const monitorChugSplashSetup = async ( provider: ethers.providers.JsonRpcProvider ) => { diff --git a/packages/core/src/utils.ts b/packages/core/src/utils.ts index 66b84ec7a..3f0edd6d6 100644 --- a/packages/core/src/utils.ts +++ b/packages/core/src/utils.ts @@ -13,7 +13,6 @@ import { import { ParsedChugSplashConfig } from './config' import { ChugSplashActionBundle, ChugSplashActionType } from './actions' -import { isContractDeployed } from './languages' export const computeBundleId = ( bundleRoot: string, @@ -341,3 +340,10 @@ export const isProposer = async ( const ChugSplashManager = getChugSplashManagerReadOnly(provider, projectName) return ChugSplashManager.proposers(address) } + +export const isContractDeployed = async ( + address: string, + provider: providers.Provider +): Promise => { + return (await provider.getCode(address)) !== '0x' +}