[eth] Add zksync mainnet (#682)

* [eth] Add zksync mainnet

Also adds verify url for shimmer testnet

* Bump client version

* Update dummy value
This commit is contained in:
Ali Behjati 2023-03-13 11:42:46 +03:30 committed by GitHub
parent d4551a01ee
commit 085f08055a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 885 additions and 116 deletions

934
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,3 +7,4 @@ cache
!devnet-mnemonic.txt
cache-zk
artifacts-zk
artifacts

View File

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

View File

@ -1,9 +1,12 @@
require("@matterlabs/hardhat-zksync-deploy");
require("@matterlabs/hardhat-zksync-solc");
import "@matterlabs/hardhat-zksync-deploy";
import "@matterlabs/hardhat-zksync-solc";
import "@nomiclabs/hardhat-etherscan";
import "@openzeppelin/hardhat-upgrades";
import "@matterlabs/hardhat-zksync-verify";
module.exports = {
zksolc: {
version: "1.2.0",
version: "1.3.1",
compilerSource: "binary",
settings: {
optimizer: {
@ -11,13 +14,23 @@ module.exports = {
},
},
},
defaultNetwork: "zkTestnet",
defaultNetwork: "zkSyncTestnet",
networks: {
zkTestnet: {
zkSyncTestnet: {
url: "https://zksync2-testnet.zksync.dev", // URL of the zkSync network RPC
ethNetwork: "goerli", // Can also be the RPC URL of the Ethereum network (e.g. `https://goerli.infura.io/v3/<API_KEY>`)
zksync: true,
chainId: 280,
verifyURL:
"https://zksync2-testnet-explorer.zksync.dev/contract_verification",
},
zkSyncMainnet: {
url: "https://zksync2-mainnet.zksync.io",
ethNetwork: "mainnet",
zksync: true,
chainId: 324,
verifyURL:
"https://zksync2-mainnet-explorer.zksync.io/contract_verification",
},
},
solidity: {

View File

@ -0,0 +1,10 @@
[
{
"contractName": "WormholeReceiver",
"address": "0x8c1F69195793B93e8114FB1E8e11FBAB2BC8484A"
},
{
"contractName": "PythUpgradable",
"address": "0xf087c864AEccFb6A2Bf1Af6A0382B0d0f6c5D834"
}
]

View File

@ -6,6 +6,7 @@
"@openzeppelin/test-helpers": "^0.5.15",
"@openzeppelin/truffle-upgrades": "^1.14.0",
"@truffle/hdwallet-provider": "^2.1.5",
"@types/chai": "^4.3.4",
"chai": "^4.2.0",
"mocha": "^8.2.1",
"truffle": "^5.7.4",
@ -24,10 +25,13 @@
"license": "ISC",
"dependencies": {
"@certusone/wormhole-sdk": "^0.9.9",
"@matterlabs/hardhat-zksync-deploy": "^0.6.1",
"@matterlabs/hardhat-zksync-solc": "^0.3.13",
"@matterlabs/hardhat-zksync-deploy": "^0.6.2",
"@matterlabs/hardhat-zksync-solc": "^0.3.14",
"@matterlabs/hardhat-zksync-verify": "^0.1.3",
"@nomiclabs/hardhat-etherscan": "^3.1.2",
"@openzeppelin/contracts": "^4.5.0",
"@openzeppelin/contracts-upgradeable": "^4.5.2",
"@openzeppelin/hardhat-upgrades": "^1.22.1",
"@pythnetwork/pyth-multisig-wh-message-builder": "*",
"@pythnetwork/pyth-sdk-solidity": "^2.2.0",
"@pythnetwork/xc-governance-sdk": "*",
@ -45,6 +49,6 @@
"web3": "^1.2.2",
"web3-eth-abi": "^1.2.2",
"web3-utils": "^1.2.2",
"zksync-web3": "^0.12.3"
"zksync-web3": "^0.13.4"
}
}

View File

@ -21,6 +21,7 @@ module.exports = async function (callback) {
WormholeReceiver.address
);
// Upgrade set 0 to set 1
console.log("Upgrading to guardian set 1.");
await initialized.methods
.submitNewGuardianSet("0x" + GUARDIAN_SET_UPGRADE_1_VAA)
.send({
@ -29,6 +30,7 @@ module.exports = async function (callback) {
gasLimit: 2000000,
});
// Upgrade set 1 to set 2
console.log("Upgrading to guardian set 2.");
await initialized.methods
.submitNewGuardianSet("0x" + GUARDIAN_SET_UPGRADE_2_VAA)
.send({
@ -37,6 +39,7 @@ module.exports = async function (callback) {
gasLimit: 2000000,
});
// Upgrade set 2 to set 3
console.log("Upgrading to guardian set 3.");
await initialized.methods
.submitNewGuardianSet("0x" + GUARDIAN_SET_UPGRADE_3_VAA)
.send({

View File

@ -184,6 +184,11 @@ module.exports = {
shimmer_testnet: {
provider: payerProvider(`https://json-rpc.evm.testnet.shimmer.network`),
network_id: 1070,
verify: {
apiUrl: "https://explorer.evm.testnet.shimmer.network/api",
explorerUrl: "https://explorer.evm.testnet.shimmer.network",
apiKey: "there_should_be_a_dummy_value_here_to_avoid_error",
},
},
gnosis: {
provider: payerProvider(`https://rpc.gnosischain.com`),

View File

@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-evm-js",
"version": "1.2.0",
"version": "1.3.0",
"description": "Pyth Network EVM Utils in JS",
"homepage": "https://pyth.network",
"author": {

View File

@ -36,4 +36,5 @@ export const CONTRACT_ADDR: Record<string, string> = {
base_goerli: "0x5955C1478F0dAD753C7E2B4dD1b4bC530C64749f",
shimmer_testnet: "0x354bF866A4B006C9AF9d9e06d9364217A8616E12",
chiado: "0xdDAf6D29b8bc81c1F0798a5e4c264ae89c16a72B", // Gnosis testnet
zksync: "0xf087c864AEccFb6A2Bf1Af6A0382B0d0f6c5D834",
};