-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve(hardhat): Autogenerate network config #833
base: master
Are you sure you want to change the base?
Conversation
Network config can be derived from the common network definitions that already exist upstream in the constants repository. This saves time when adding new chains and reduces duplication.
const name = network.name.replace(" ", "").toLowerCase(); | ||
const hubChainId = Object.values(MAINNET_CHAIN_IDs).includes(chainId) ? CHAIN_IDs.MAINNET : CHAIN_IDs.SEPOLIA; | ||
const chainDef = { | ||
url: network.publicRPC, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nb. depends on this PR: across-protocol/constants#88
}; | ||
|
||
// zkSync is a special snowflake. | ||
if ([CHAIN_IDs.ZK_SYNC, CHAIN_IDs.ZK_SYNC_SEPOLIA].includes(chainId)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would need to add Lens to this list. zkSync tooling is really annoying :\
accounts: { mnemonic }, | ||
companionNetworks: { l1: "mainnet" }, | ||
}, | ||
...networks, // autogenerated | ||
}, | ||
gasReporter: { enabled: process.env.REPORT_GAS !== undefined, currency: "USD" }, | ||
etherscan: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll be interested to see if we can autogenerate some of this config as well.
.filter((chainId) => PUBLIC_NETWORKS[chainId] !== undefined) | ||
.map((chainId) => { | ||
const network = PUBLIC_NETWORKS[chainId]; | ||
const name = network.name.replace(" ", "").toLowerCase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nb. might need to add some special handling for the -sepolia
chains.
Network config can be derived from the common network definitions that already exist upstream in the constants repository. This saves time when adding new chains and reduces duplication.