wighawag / hardhat-deploy

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

export-all json output format #325

Open drortirosh opened 2 years ago

drortirosh commented 2 years ago

in continuation of #248 , I'm still confused about the output of --export-all:

The current export format is:

{
  "5": [
    {
      "name": "goerli",
      "chainId": "5",
      "contracts": {}
    }
  ]
}

and I'm trying to understand the need for an array per chain. The chain "name" is a unique key (both in hardhat.config file, and as a folder under deployments so it seems the simpler format should be:

{
  "goerli": {
    "name": "goerli",
    "chainId": "5",
    "contracts": {}
  }
}

The only possible "downside" is that if you keep 2 configurations deployed on the same network (e.g. goerli-prod, goerli-stage), they would appear as separate "top-level" entries in the all-networks file, instead of lumped together as array elements under "chainId":5

wighawag commented 2 years ago

name is not the chain name but the network name, and in hardhat you can have multiple network name for the same chain.

I use a lot for having different deployment on testnet or even keep tracking of multiple version on one chain

wighawag commented 2 years ago

The rationale for the key being the chainId, is that for frontend that let you chose a specific network per chain.

You read it from the current chain and see you have an array with length > 1