Remove the need to define a state variable for every address read from env.json - it's additional work for every deployed contract, and can lead to errors. Instead, move to using the _getAddressNotZero() function.
_getAddressNotZero() also uses the contracts deployed in the current sequence (and temporarily stored in deployedTo before writing to disk) during lookup
_getAddressNotZero() also reverts if the returned value is the zero address (which would indicate it has not been set), instead of having redundant code scattered everywhere
When a deployment is broadcast, write the addresses of the deployed contracts to env.json
Changes:
env.json
- it's additional work for every deployed contract, and can lead to errors. Instead, move to using the_getAddressNotZero()
function._getAddressNotZero()
also uses the contracts deployed in the current sequence (and temporarily stored indeployedTo
before writing to disk) during lookup_getAddressNotZero()
also reverts if the returned value is the zero address (which would indicate it has not been set), instead of having redundant code scattered everywhereenv.json