wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.2k stars 296 forks source link

hardhat network saveDeployments #309

Closed e-roy closed 2 years ago

e-roy commented 2 years ago

I'm trying to save to the deployments folder with the hardhat network. If I use this in my hardhat.config file, nothing is saved to the deployments folder

const defaultNetwork = "hardhat";

module.exports = {
  solidity: "0.8.10",
  defaultNetwork,

  networks: {
    hardhat: {
      saveDeployments: true,
      chainId: 31337,
    },
  }
}

If I changed defaultNetwork to localhost

const defaultNetwork = "localhost";

then a localhost folder is created.

Is this the expected behavior? And how can I save creating a hardhat folder?

wighawag commented 2 years ago

It is expected behavior, hardhat network is an in memory network only and has no rpc endpoint available,

e-roy commented 2 years ago

Thank you for the reply. Interesting, I thought localhost would have the same result.

I changed my hardhat.config file to this

const defaultNetwork = "localhost";

module.exports = {
  solidity: "0.8.10",
  defaultNetwork,
  networks: {
    localhost: {
      chainId: 31337,
    },
  }
}

and got the results I was looking for while I'm running a hardhat node. I'll have to look into this more to get a better understanding 😀

Thank you for maintaining such an awesome plugin! I'm using it in this project I'm building https://www.npmjs.com/package/create-web3