Skip to content
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

zkSyncEra Testnet config #383

Merged
merged 8 commits into from
Jun 22, 2023
Merged

zkSyncEra Testnet config #383

merged 8 commits into from
Jun 22, 2023

Conversation

moltam89
Copy link
Contributor

Description

Configuration for deploying on zkSyncTestnet.
According to the zkSync docs, hardhat-deploy version ^0.11.26 supports deployments on zkSync Era.

Therefore I've upgraded hardhat-deploy to 0.11.26.
Also, zkSync uses their own "hardhat-zksync-solc" compiler, which has to be imported in hardhat.config.ts.

After these changes, I could deploy to zkSyncTestnet with yarn deploy --network zkSyncTestnet and I could interact with the demo YourContract when I switched the targetNetwork to chains.zkSyncTestnet in scaffold.config.ts.

Let me know if you have any questions.

Best,
Tamas

Additional Information

Related Issues

#256

Your ENS/address: monyo.eth

Copy link
Member

@carletex carletex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @moltam89

Thanks for this. I left a few comments/questions.

Also...does the deploy script work as it is?

The docs say that you need to use the Deployer from
import { Deployer } from "@matterlabs/hardhat-zksync-deploy";

packages/hardhat/hardhat.config.ts Outdated Show resolved Hide resolved
packages/hardhat/hardhat.config.ts Show resolved Hide resolved
@moltam89
Copy link
Contributor Author

Hey @carletex

Also...does the deploy script work as it is?

I could deploy by yarn deploy --network zkSyncTestnet. Not sure if this is the proper answer, or you meant something else.

The docs say that you need to use the Deployer from
import { Deployer } from "@matterlabs/hardhat-zksync-deploy";

I think this would be only needed if we didn't use hardhat-deploy.
If we would import it, we could also deploy by "yarn hardhat deploy-zksync", but it would be different than how other networks are used.

@damianmarti
Copy link
Member

Thanks @moltam89

I added the zkSync mainnet config and I was able to deploy the contract to this network using yarn deploy --network zkSync

https://explorer.zksync.io/tx/0x041947bfa70bea288655ce64f4438114f69050f27b2eeafef5f895eb6b26d572

@damianmarti
Copy link
Member

Thanks @moltam89

I added the zkSync mainnet config and I was able to deploy the contract to this network using yarn deploy --network zkSync

https://explorer.zksync.io/tx/0x041947bfa70bea288655ce64f4438114f69050f27b2eeafef5f895eb6b26d572

And then I was able to set a new greeting from the debug page.

@moltam89
Copy link
Contributor Author

Hey @damianmarti ,

Great, thank you for testing this!

yarn.lock Show resolved Hide resolved
Copy link
Collaborator

@technophile-04 technophile-04 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it and works properly, Tysm @moltam89 looks a lot cleaner 🙌

I have added hardhat-zksync-verify at 3d3ceab...Reason: We already had hardhat-etherscan to which its goes in conjuction and it didn't required any API keys so thought its worth the verify feature by default

Here is the verified contract: https://goerli.explorer.zksync.io/address/0xC8796A82A7A03A333295938d54d8F7310d607be2#contract

PS: I tried deploying to sepolia yarn deploy --network sepolia and got some error the first time but after a second try it worked correctly, just can anyone just test once deploying to sepolia.

@carletex
Copy link
Member

My only concern about this PR is how many libraries it adds to yarn.lock. It seems like hardhat-zksync-solc adds @nomiclabs/hardhat-docker as a dependency. I'm not sure why this requires this dependency...

Yep, I think this was also one of the reasons Shiv closed the initial PR. We can't automatically add every single thing that could be useful on SE-2... we'd end with a massive project. That's why he suggested adding it as an extension in the CLI (#251)

In this particular case... I think ZkSyncEra is probably something that will be used and might be worth it to add it to the core.

Let me know what you all think!

@technophile-04
Copy link
Collaborator

Yep, I think this was also one of the reasons Shiv closed the initial PR. We can't automatically add every single thing that could be useful on SE-2... we'd end with a massive project. That's why he suggested adding it as an extension in the CLI (#251)

Yes !! I was even not going to suggest creating a PR to main at all and instead have it on just another branch until CLI but then I saw a couple of builds from BG member which was deployed to ZkSync so thought it might be worth the add to main

In this particular case... I think ZkSyncEra is probably something that will be used and might be worth it to add it to the core.

Yup

@damianmarti
Copy link
Member

@moltam89 @carletex There is another issue. If you want to replicate all the zkSync features (like a Paymaster) locally, you have to run a local zkSync node, which is not the same that running yarn chain. Maybe it's something we should add a note somewhere at least... https://era.zksync.io/docs/tools/hardhat/testing.html

@damianmarti damianmarti merged commit d81a32b into scaffold-eth:main Jun 22, 2023
@damianmarti
Copy link
Member

Thanks @moltam89!! Merged!

kmjones1979 added a commit that referenced this pull request Jul 3, 2023
* Update SE-2 nomenclautre  (#317)

* Fix autoConnect when contract not deployed (#292)

* oxford comma lol

* Fix icon visibility on dark mode in EtherInput (#320)

* Update README: Add Vercel ENV var to disable type/lint checking (#327)

* Fix typo (#334)

Fix typo at code snippet

* README: Updated SE-2 custom hook section (#330)

Co-authored-by: KcPele <fidekg123@gmail.com>
Co-authored-by: Shiv Bhonde <shivbhonde04@gmail.com>
Co-authored-by: Carlos Sánchez <oceanrdn@gmail.com>

* Remove duplicated HINT on README (#335)

* PR and Issue templates (#329)

* Native currency symbol and price as per target network (#322)

* useAppStore => useGlobalState (#338)

* Event history filter type (#333)

* fix: event history filter type

Fixes #332

* fix: make scaffold event history config separate type

* fix: prettier broke due to invalid syntax

* fix: ts error after generating contract

* Indexed prop + example

---------

Co-authored-by: Carlos Sánchez <oceanrdn@gmail.com>

* Update README: custom hooks section (#339)

* fix: assert type as Abi to avoid ts error (#350)

* fix: assert type as Abi to avoid ts error

Fixes #344

* assert type as Abi to avoid ts error on useScaffoldContract

---------

Co-authored-by: Carlos Sánchez <oceanrdn@gmail.com>

* Fix useEffect filter dep on event hook (#349)

* Block confirmation options / callback for useScaffoldContractWrite (#348)

* Patch useLocalStorage setting the right initial value to avoid a hydration error (#356)

Co-authored-by: sverps <sverps@gmail.com>

* Save selected contract to local storage (#326)

* Save selected contract to local storage

* refactor: Replaced native localStorage with useLocalStorage from usehooks-ts

* Fixed empty string parameter error.

* Updated parameter requirements to fix issue.

* Fixed error.

* Fixed parameter assignment error.

* Use useLocalStorage to save selected contract

---------

Co-authored-by: Damian <damianmarti@gmail.com>

* Refactor meta tags into separate component and add default thumbnail / image (#359)

* Hotfix: thumbnail.png => thumbnail.jpg

* Local Block Explorer (#351)

Co-authored-by: Shiv Bhonde <shivbhonde04@gmail.com>

* Fix daisyUI dropdown on IOS (#342)

* allow `overrides` in useScaffoldContractWrite (#345)

* allow overrides for useScaffoldContractWrite

* spread overrides and restConfig separately

* feat: proactively disable read hook when it would result in error (#250)

Fixes #249

Co-authored-by: Shiv Bhonde | shivbhonde.eth <shivbhonde04@gmail.com>

* Size prop on Address component (#365)


Co-authored-by: Carlos Sánchez <oceanrdn@gmail.com>

* Generate TS ABIs from deploy script (#368)

* enable solidity optimizer by default (#360)

* fix(Balance): font-size of symbol should be relative to current font-size, not document root (#375)

* fix(contract.ts): very long abi's now no longer go over type instantiation limit (#377)

Fixes #374

* fix(contract.ts): improve missing config check (#372)

Fixes #371

* fix listner types error when contracts missing (#379)

* zkSyncEra Testnet config (#383)

* Upgrade hardhat-deploy to 0.11.26 where zkSync is supported

* Dependency for @matterlabs/hardhat-zksync-solc

* Add zkSyncEraTestnet to networks

* Import @matterlabs/hardhat-zksync-solc

* Add artifacts-zk and cache-zk to gitignore

* yarn install

* Add zkSync mainnet config

* add hardhat-zksync-verify for contract verification

---------

Co-authored-by: moltam89 <moltam89@gmail.com>
Co-authored-by: Damian <damianmarti@gmail.com>
Co-authored-by: Shiv Bhonde <shivbhonde04@gmail.com>

* allow writeAsync by useScaffoldContractWrite to be called with updated args (#385)

* update wagmi & rainbow for walletConnectV2 (#381)

* meged changes from main, additional configuration in subgraph.yaml

---------

Co-authored-by: Shiv Bhonde | shivbhonde.eth <shivbhonde04@gmail.com>
Co-authored-by: Austin Griffith <austin@ethereum.org>
Co-authored-by: Kevin Joshi <kevinjoshi46b@gmail.com>
Co-authored-by: Carlos Sánchez <oceanrdn@gmail.com>
Co-authored-by: AlehN <natsevsky@gmail.com>
Co-authored-by: Pablo Alayeto <55535804+Pabl0cks@users.noreply.github.com>
Co-authored-by: KcPele <fidekg123@gmail.com>
Co-authored-by: Samuel | solidixen.eth <sverps@gmail.com>
Co-authored-by: Eda Akturk <edakturk96@gmail.com>
Co-authored-by: Tamas Molnar <tamas.molnar@liferay.com>
Co-authored-by: Damian Martinelli <damianmarti@gmail.com>
Co-authored-by: Alexander <a00112699@gmail.com>
Co-authored-by: port <108868128+portdeveloper@users.noreply.github.com>
Co-authored-by: moltam89 <moltam89@gmail.com>
@moltam89
Copy link
Contributor Author

moltam89 commented Jul 5, 2023

Hi @technophile-04

I have added hardhat-zksync-verify at 3d3ceab...Reason: We already had hardhat-etherscan to which its goes in conjuction and it didn't required any API keys so thought its worth the verify feature by default

I tried to verify with yarn verify --network zkSyncTestnet, but I run into this error:
Network with chainId: 280 not supported. You can specify the url manually via --api-url .

How did you run the contract verification?

Thanks,
Tamas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants