Commit 29a33b96 authored by Maurelian's avatar Maurelian Committed by Kelvin Fichter

fix(contracts): Use chainId to detect hh environments

parent c3db334f
/* Imports: External */
import { hexStringEquals, awaitCondition } from '@eth-optimism/core-utils'
import { DeployFunction } from 'hardhat-deploy/dist/types'
import { defaultHardhatNetworkParams } from 'hardhat/internal/core/config/default-config'
/* Imports: Internal */
import { getContractFromArtifact } from '../src/hardhat-deploy-ethers'
......@@ -71,15 +72,11 @@ const deployFn: DeployFunction = async (hre) => {
(4) Wait for the deploy process to continue.
`)
// Check if the hardhat runtime environment has the owner of the AddressManager. This will only
// happen in CI. If this is the case, we can skip directly to transferring ownership over to the
// AddressDictator contract.
const hreSigners = await hre.ethers.getSigners()
const hreHasOwner = hreSigners.some((signer) => {
return hexStringEquals(signer.address, currentOwner)
})
if (hreHasOwner) {
// Hardhat has the owner loaded into it, we can skip directly to transferOwnership.
// Only execute this step if we're on the hardhat chain ID. This will only happen in CI. If this
// is the case, we can skip directly to transferring ownership over to the AddressDictator
// contract.
const { chainId } = await hre.ethers.provider.getNetwork()
if (chainId === defaultHardhatNetworkParams.chainId) {
const owner = await hre.ethers.getSigner(currentOwner)
await Lib_AddressManager.connect(owner).transferOwnership(
AddressDictator.address
......
......@@ -2,6 +2,7 @@
import { DeployFunction } from 'hardhat-deploy/dist/types'
import { ethers } from 'ethers'
import { hexStringEquals, awaitCondition } from '@eth-optimism/core-utils'
import { defaultHardhatNetworkParams } from 'hardhat/internal/core/config/default-config'
/* Imports: Internal */
import { getContractDefinition } from '../src/contract-defs'
......@@ -82,16 +83,10 @@ const deployFn: DeployFunction = async (hre) => {
(4) Wait for the deploy process to continue.
`)
// Check if the hardhat runtime environment has the owner of the proxy. This will only
// happen in CI. If this is the case, we can skip directly to transferring ownership over to the
// ChugSplashDictator contract.
const hreSigners = await hre.ethers.getSigners()
const hreHasOwner = hreSigners.some((signer) => {
return hexStringEquals(signer.address, currentOwner)
})
if (hreHasOwner) {
// Hardhat has the owner loaded into it, we can skip directly to transferOwnership.
// Check if if we're on the hardhat chain ID. This will only happen in CI. If this is the case, we
// can skip directly to transferring ownership over to the ChugSplashDictator contract.
const { chainId } = await hre.ethers.provider.getNetwork()
if (chainId === defaultHardhatNetworkParams.chainId) {
const owner = await hre.ethers.getSigner(currentOwner)
await Proxy__OVM_L1StandardBridge.connect(owner).setOwner(
ChugSplashDictator.address
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment