wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.18k stars 286 forks source link

Why are deployments loaded based on network name, and not only on chainId? #350

Closed samlaf closed 2 years ago

samlaf commented 2 years ago

Is your feature request related to a problem? Please describe. I was initially using a public endpoint, and deployed my contract using that endpoint. Now I just spinned my own node, and so created a new hardhat network config with name "my_node". When trying to load my previously deployed contract, I get a Uncaught Error: No Contract deployed with name Liquidator error. I thought hardhat-deployed only looked up deployments based on the .chainId file in the deployments folder, but it seems it actually looks at the hardcoded network name, which seems arbitrary to me.

image

Describe the solution you'd like Is there a good reason for this? Is there a reason why hardhat-deploy can't just look up previous deployments based on the .chainId file?

I tend to have many avalanche endpoints in my hardhat file: avalanche_moralis, avalanche_my_node, avalanche_ipc, etc. I need to copy the deployment and rename it for each one of these, which seems a bit bloated and unnecessary.

wighawag commented 2 years ago

I use this feature all the time to have different set of deployment on the same network.

If you need use different node for the same network you could probably configure it dynamicly in your hardhat config

samlaf commented 2 years ago

I see. Thanks :)