Skip to content

Commit 085f080

Browse files
authored
[eth] Add zksync mainnet (#682)
* [eth] Add zksync mainnet Also adds verify url for shimmer testnet * Bump client version * Update dummy value
1 parent d4551a0 commit 085f080

File tree

10 files changed

+882
-113
lines changed

10 files changed

+882
-113
lines changed

package-lock.json

Lines changed: 827 additions & 101 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

target_chains/ethereum/contracts/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ cache
77
!devnet-mnemonic.txt
88
cache-zk
99
artifacts-zk
10+
artifacts

target_chains/ethereum/contracts/Deploying.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,13 @@ contract or a new contract do the following steps in addition to the steps descr
191191
1. Update the [`hardhad.config.ts`](./hardhat.config.ts) file.
192192
2. Add the configuration files to `truffle-config.js` and `.env.prod.<network>` file as described above. Truffle
193193
config is required as the above deployment script still works in changing the contract (except upgrades).
194-
3. Run `npx hardhat compile` to compile the contracts.
195-
4. If you wish to deploy the contract run `npx hardhat deploy-zksync --script deploy/zkSyncDeploy` to deploy it to the new network. Otherwise
196-
run `npx hardhat deploy-zksync --script deploy/zkSyncDeployNewPythImpl.ts` to get a new implementation address. Then put it in
194+
3. Run `npx hardhat clean && npx hardhat compile` to have a clean compile the contracts.
195+
4. Prepare the enviornment:
196+
197+
- Export the secret recovery phrase for the deployment account. Please store it in a file and read
198+
the file into `MNEMONIC` environment variable like so: `export MNEMONIC=$(cat path/to/mnemonic)`.
199+
- Copy the correct env file (e.g: `.env.production.zksync`) to `.env`.
200+
201+
5. If you wish to deploy the contract run `npx hardhat deploy-zksync --network <network> --script deploy/zkSyncDeploy` to deploy it to the new network. Otherwise
202+
run `npx hardhat deploy-zksync --network <network> --script deploy/zkSyncDeployNewPythImpl.ts` to get a new implementation address. Then put it in
197203
`.<network>.new_impl` file and run the deployment script to handle the rest of the changes.

target_chains/ethereum/contracts/hardhat.config.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
1-
require("@matterlabs/hardhat-zksync-deploy");
2-
require("@matterlabs/hardhat-zksync-solc");
1+
import "@matterlabs/hardhat-zksync-deploy";
2+
import "@matterlabs/hardhat-zksync-solc";
3+
import "@nomiclabs/hardhat-etherscan";
4+
import "@openzeppelin/hardhat-upgrades";
5+
import "@matterlabs/hardhat-zksync-verify";
36

47
module.exports = {
58
zksolc: {
6-
version: "1.2.0",
9+
version: "1.3.1",
710
compilerSource: "binary",
811
settings: {
912
optimizer: {
1013
enabled: true,
1114
},
1215
},
1316
},
14-
defaultNetwork: "zkTestnet",
17+
defaultNetwork: "zkSyncTestnet",
1518
networks: {
16-
zkTestnet: {
19+
zkSyncTestnet: {
1720
url: "https://zksync2-testnet.zksync.dev", // URL of the zkSync network RPC
1821
ethNetwork: "goerli", // Can also be the RPC URL of the Ethereum network (e.g. `https://goerli.infura.io/v3/<API_KEY>`)
1922
zksync: true,
2023
chainId: 280,
24+
verifyURL:
25+
"https://zksync2-testnet-explorer.zksync.dev/contract_verification",
26+
},
27+
zkSyncMainnet: {
28+
url: "https://zksync2-mainnet.zksync.io",
29+
ethNetwork: "mainnet",
30+
zksync: true,
31+
chainId: 324,
32+
verifyURL:
33+
"https://zksync2-mainnet-explorer.zksync.io/contract_verification",
2134
},
2235
},
2336
solidity: {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{
3+
"contractName": "WormholeReceiver",
4+
"address": "0x8c1F69195793B93e8114FB1E8e11FBAB2BC8484A"
5+
},
6+
{
7+
"contractName": "PythUpgradable",
8+
"address": "0xf087c864AEccFb6A2Bf1Af6A0382B0d0f6c5D834"
9+
}
10+
]

target_chains/ethereum/contracts/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"@openzeppelin/test-helpers": "^0.5.15",
77
"@openzeppelin/truffle-upgrades": "^1.14.0",
88
"@truffle/hdwallet-provider": "^2.1.5",
9+
"@types/chai": "^4.3.4",
910
"chai": "^4.2.0",
1011
"mocha": "^8.2.1",
1112
"truffle": "^5.7.4",
@@ -24,10 +25,13 @@
2425
"license": "ISC",
2526
"dependencies": {
2627
"@certusone/wormhole-sdk": "^0.9.9",
27-
"@matterlabs/hardhat-zksync-deploy": "^0.6.1",
28-
"@matterlabs/hardhat-zksync-solc": "^0.3.13",
28+
"@matterlabs/hardhat-zksync-deploy": "^0.6.2",
29+
"@matterlabs/hardhat-zksync-solc": "^0.3.14",
30+
"@matterlabs/hardhat-zksync-verify": "^0.1.3",
31+
"@nomiclabs/hardhat-etherscan": "^3.1.2",
2932
"@openzeppelin/contracts": "^4.5.0",
3033
"@openzeppelin/contracts-upgradeable": "^4.5.2",
34+
"@openzeppelin/hardhat-upgrades": "^1.22.1",
3135
"@pythnetwork/pyth-multisig-wh-message-builder": "*",
3236
"@pythnetwork/pyth-sdk-solidity": "^2.2.0",
3337
"@pythnetwork/xc-governance-sdk": "*",
@@ -45,6 +49,6 @@
4549
"web3": "^1.2.2",
4650
"web3-eth-abi": "^1.2.2",
4751
"web3-utils": "^1.2.2",
48-
"zksync-web3": "^0.12.3"
52+
"zksync-web3": "^0.13.4"
4953
}
5054
}

target_chains/ethereum/contracts/scripts/receiverSubmitGuardianSetUpgrades.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

target_chains/ethereum/contracts/truffle-config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ module.exports = {
184184
shimmer_testnet: {
185185
provider: payerProvider(`https://json-rpc.evm.testnet.shimmer.network`),
186186
network_id: 1070,
187+
verify: {
188+
apiUrl: "https://explorer.evm.testnet.shimmer.network/api",
189+
explorerUrl: "https://explorer.evm.testnet.shimmer.network",
190+
apiKey: "there_should_be_a_dummy_value_here_to_avoid_error",
191+
},
187192
},
188193
gnosis: {
189194
provider: payerProvider(`https://rpc.gnosischain.com`),

target_chains/ethereum/sdk/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/pyth-evm-js",
3-
"version": "1.2.0",
3+
"version": "1.3.0",
44
"description": "Pyth Network EVM Utils in JS",
55
"homepage": "https://pyth.network",
66
"author": {

target_chains/ethereum/sdk/js/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ export const CONTRACT_ADDR: Record<string, string> = {
3636
base_goerli: "0x5955C1478F0dAD753C7E2B4dD1b4bC530C64749f",
3737
shimmer_testnet: "0x354bF866A4B006C9AF9d9e06d9364217A8616E12",
3838
chiado: "0xdDAf6D29b8bc81c1F0798a5e4c264ae89c16a72B", // Gnosis testnet
39+
zksync: "0xf087c864AEccFb6A2Bf1Af6A0382B0d0f6c5D834",
3940
};

0 commit comments

Comments
 (0)