I have a piece of code that deploys a contract. I would like to deploy this contract to two networks (lets say Goerli and MainnetEthereum). Inside a loop in hardhat script I can change the network using the following code:
for (const currNetwork of networksToDeploy) {
hre.changeNetwork(currNetwork);
const DToken = await DToken.deploy(...constructorArgs)
}
The network doesn't change, it double deploys it in Goerli (the first network). The loop is changing correctly but the provider on DToken.deploy
stays the same. Any ideas on how to change that?