-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Migration to Hardhat v3 #1192
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
base: main
Are you sure you want to change the base?
Migration to Hardhat v3 #1192
Conversation
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.
Saving this for easier access :D
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.
Went with this solution for now (naming it generic, so people can deploy everything here by default.... since the module path is hardcoded on package.json)
e.g. This works:
export default buildModule("ScaffoldEthDeployModule", m => {
const yourContract = m.contract("YourContract", ["0x0000000000000000000000000000000000000000"]);
const yourContract2 = m.contract("YourContract2", ["0x0000000000000000000000000000000000000000"]);
return { yourContract, yourContract };
});they say in their docs
You can create multiple modules in a single file, but each must have a unique ID. To deploy a module, you must export it using module.exports = or export default. As a best practice, we suggest maintaining one module per file, naming the file after the module ID.
But I couldn't make it work (creating more modules in the file + exporting both)
Note: they also have https://hardhat.org/ignition/docs/guides/scripts, where you can do more "complex" logic (e.g. console.logs of contract read data)
| chainType: "l1", | ||
| url: "https://mainnet.rpc.buidlguidl.com", | ||
| accounts: [deployerPrivateKey], | ||
| accounts: [configVariable("DEPLOYER_PRIVATE_KEY")], |
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.
yarn hardhat keystore set DEPLOYER_PRIVATE_KEY
We'd need to abstract this to the user for yarn generate etc.
Also: for the keystore you need a 8 character password. Unless you use the --dev flag, which doesn't ask for a password at all https://hardhat.org/docs/guides/configuration-variables#improving-ux-when-using-keystore-values-during-the-dev-process
|
|
||
| // If not set, it uses ours Alchemy's default API key. | ||
| // You can get your own at https://dashboard.alchemyapi.io | ||
| const providerApiKey = process.env.ALCHEMY_API_KEY || "cR4WnXePioePZ5fFrnSiR"; |
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 think we can use regular env vars for non-critical data (like this key) and then the keystore (configVariable) for PKs, etc.
Creating this draft so we can start tinkering & discussing:
For now:
yarn chainworkingyarn deployworkingToDo (will be adding more):
yarn deploymore generic. Before it deployed everything / tag-based. Now only the specified conttract.Known Issues:
[ YourContract ] Nothing new to deploy based on previous execution stored in ./ignition/deployments/chain-31337Fixes #1191