wighawag / hardhat-deploy

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

is there a way to find out if a contract was deployed in this run in a subsequent script? #135

Closed tzapu closed 3 years ago

tzapu commented 3 years ago

or to save some data that a script running later in the same run can check? i have a couple of contracts that depend on eachother, after create i need to set each other s addresses which is fine in a separate script. what confuses me is that if one of the contracts gets modified and the other doesn't then the script won t work (as one of the contracts is already set and can be set only once). if i could save some kind of data on deploy, or invalidate a deployment, or if i could tell one of the contracts was deployed and trigger a redeploy of the other, i could rerun the scripts when needed ... not sure how to tackle this one, any suggestion is welcome

tzapu commented 3 years ago

linkedData looks like it might be helpful, but would still be interested if there would be any other ways to sort the above

wighawag commented 3 years ago

Feel like what you are trying to do could be a separate scripts, not a a deploy script, no ?

hardhat-deploy is designed for idempotent deploy script, that can be rexecuted multiple times without issues. this is useful when a tx is pending and you need to rexecute the whole thing

wighawag commented 3 years ago

Closing this for now, feel free to reopen if you have more info

tzapu commented 3 years ago

you re right, ofc, a separate script is way better for this, thanks