Skip to content

Commit

Permalink
Improve fork settings (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
penandlim committed Sep 7, 2022
1 parent 1eadcbf commit eb53ff2
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions tasks/node.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "hardhat-deploy"
import { task } from "hardhat/config"
import { NetworkUserConfig } from "hardhat/types"
import { MULTISIG_ADDRESSES, PROD_DEPLOYER_ADDRESS } from "../utils/accounts"
import {
compareDeployments,
convertDeploymentsToSimpleAddressMap,
Expand All @@ -26,15 +27,15 @@ task("node", "Starts a JSON-RPC server on top of Hardhat Network").setAction(
const networkName = taskArgs.fork
console.log(`Found matching network name, ${networkName}`)

// Workaround for hardhat-deploy issue #115 https://github.com/wighawag/hardhat-deploy/issues/115
// Workaround for hardhat-deploy issue #115
// https://github.com/wighawag/hardhat-deploy/issues/115
process.env["HARDHAT_DEPLOY_FORK"] = networkName
const externalDeploymentsFolder = `deployments/${networkName}`

if ("url" in network) {
console.log(`Forking ${networkName} from RPC: ${network.url}`)

// Set the task arguments for the super call
taskArgs.noReset = true
taskArgs.fork = network.url

console.log(
Expand All @@ -56,6 +57,21 @@ task("node", "Starts a JSON-RPC server on top of Hardhat Network").setAction(
hre.config.networks.localhost.verify = network.verify
}

// Override namedAccounts settings so that in fork mode, we use
// production deployer address as "deployer"
// production multisig address of that chain as "multisig"
hre.config.namedAccounts = {
...hre.config.namedAccounts,
deployer: {
[String(network.chainId)]: PROD_DEPLOYER_ADDRESS,
},
multisig: {
[String(network.chainId)]:
MULTISIG_ADDRESSES[String(network.chainId)],
},
}

// Set external deployments path to copy over deployments before starting node
hre.config.external = {
...hre.config.external,
deployments: {
Expand Down

0 comments on commit eb53ff2

Please sign in to comment.