From 5dfe663e4fe18d08e6c2f259026d7f5e1220f1cc Mon Sep 17 00:00:00 2001 From: nicholaspai <9457025+nicholaspai@users.noreply.github.com> Date: Tue, 11 Jul 2023 17:36:59 -0400 Subject: [PATCH] WIP: Add deploy scripts for zksync (#309) - verification worked - deployment worked - deploy scripts don't work yet how the others do in the /deploy directory --- .upgradable/zkSync-testnet.json | 649 ++++++++++++++++++++++++++ deploy/consts.ts | 6 + hardhat.config.ts | 28 +- package.json | 10 +- scripts/deployZkSyncSpokePoolProxy.ts | 40 ++ yarn.lock | 143 ++++-- 6 files changed, 829 insertions(+), 47 deletions(-) create mode 100644 .upgradable/zkSync-testnet.json create mode 100644 scripts/deployZkSyncSpokePoolProxy.ts diff --git a/.upgradable/zkSync-testnet.json b/.upgradable/zkSync-testnet.json new file mode 100644 index 000000000..25704b40a --- /dev/null +++ b/.upgradable/zkSync-testnet.json @@ -0,0 +1,649 @@ +{ + "manifestVersion": "3.2", + "proxies": [ + { + "address": "0xE0B015E54d54fc84a6cB9B666099c46adE9335FF", + "txHash": "0xb9a30ba9791bd7ba9f4a332c436308b52bc93b0e5334809802197515398794eb", + "kind": "uups" + }, + { + "address": "0xe7cb3e167e7475dE1331Cf6E0CEb187654619E12", + "txHash": "0xa13ca7405a06990cdc0cded41a80ba5cbc8c330752b18a37e0af004df1c05363", + "kind": "uups" + } + ], + "impls": { + "bfea54823bb40872fab3505863f48ff1134e53ec6e566e00fbeb2ed86d58951c": { + "address": "0x21aa92c23BC2A0E2DaB0335F5f864757FE68c0A7", + "txHash": "0xebe0c98de6e88e6770454987b8e6dc9246da030474213094cca3ccf5dc9b7bce", + "layout": { + "solcVersion": "0.8.18", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC1967UpgradeUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:197" + }, + { + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage", + "contract": "UUPSUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:107" + }, + { + "label": "_status", + "offset": 0, + "slot": "101", + "type": "t_uint256", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:38" + }, + { + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:80" + }, + { + "label": "__gap", + "offset": 0, + "slot": "151", + "type": "t_array(t_uint256)1000_storage", + "contract": "MultiCallerUpgradeable", + "src": "contracts/upgradeable/MultiCallerUpgradeable.sol:46" + }, + { + "label": "_HASHED_NAME", + "offset": 0, + "slot": "1151", + "type": "t_bytes32", + "contract": "EIP712CrossChainUpgradeable", + "src": "contracts/upgradeable/EIP712CrossChainUpgradeable.sol:20" + }, + { + "label": "_HASHED_VERSION", + "offset": 0, + "slot": "1152", + "type": "t_bytes32", + "contract": "EIP712CrossChainUpgradeable", + "src": "contracts/upgradeable/EIP712CrossChainUpgradeable.sol:21" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1153", + "type": "t_array(t_uint256)1000_storage", + "contract": "EIP712CrossChainUpgradeable", + "src": "contracts/upgradeable/EIP712CrossChainUpgradeable.sol:84" + }, + { + "label": "crossDomainAdmin", + "offset": 0, + "slot": "2153", + "type": "t_address", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:50" + }, + { + "label": "hubPool", + "offset": 0, + "slot": "2154", + "type": "t_address", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:54" + }, + { + "label": "wrappedNativeToken", + "offset": 0, + "slot": "2155", + "type": "t_contract(WETH9Interface)9845", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:58" + }, + { + "label": "depositQuoteTimeBuffer", + "offset": 20, + "slot": "2155", + "type": "t_uint32", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:62" + }, + { + "label": "numberOfDeposits", + "offset": 24, + "slot": "2155", + "type": "t_uint32", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:65" + }, + { + "label": "pausedFills", + "offset": 28, + "slot": "2155", + "type": "t_bool", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:68" + }, + { + "label": "pausedDeposits", + "offset": 29, + "slot": "2155", + "type": "t_bool", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:69" + }, + { + "label": "rootBundles", + "offset": 0, + "slot": "2156", + "type": "t_array(t_struct(RootBundle)10137_storage)dyn_storage", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:72" + }, + { + "label": "enabledDepositRoutes", + "offset": 0, + "slot": "2157", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:75" + }, + { + "label": "relayFills", + "offset": 0, + "slot": "2158", + "type": "t_mapping(t_bytes32,t_uint256)", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:80" + }, + { + "label": "fillCounter", + "offset": 0, + "slot": "2159", + "type": "t_mapping(t_address,t_uint256)", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:86" + }, + { + "label": "depositCounter", + "offset": 0, + "slot": "2160", + "type": "t_mapping(t_address,t_uint256)", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:90" + }, + { + "label": "refundsRequested", + "offset": 0, + "slot": "2161", + "type": "t_mapping(t_bytes32,t_uint256)", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:95" + }, + { + "label": "__gap", + "offset": 0, + "slot": "2162", + "type": "t_array(t_uint256)1000_storage", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:1309" + }, + { + "label": "__gap", + "offset": 0, + "slot": "3162", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_owner", + "offset": 0, + "slot": "3212", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "3213", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_struct(RootBundle)10137_storage)dyn_storage": { + "label": "struct SpokePoolInterface.RootBundle[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)1000_storage": { + "label": "uint256[1000]", + "numberOfBytes": "32000" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(WETH9Interface)9845": { + "label": "contract WETH9Interface", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_bool))": { + "label": "mapping(address => mapping(uint256 => bool))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_uint256)": { + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_bool)": { + "label": "mapping(uint256 => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32" + }, + "t_struct(RootBundle)10137_storage": { + "label": "struct SpokePoolInterface.RootBundle", + "members": [ + { + "label": "slowRelayRoot", + "type": "t_bytes32", + "offset": 0, + "slot": "0" + }, + { + "label": "relayerRefundRoot", + "type": "t_bytes32", + "offset": 0, + "slot": "1" + }, + { + "label": "claimedBitmap", + "type": "t_mapping(t_uint256,t_uint256)", + "offset": 0, + "slot": "2" + } + ], + "numberOfBytes": "96" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "label": "uint32", + "numberOfBytes": "4" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + } + } + }, + "cebfa9d7fd2ae7393404528efcfb4168b77490d1a88d003982fb1acd929db0ac": { + "address": "0x02D2B95F631E0CF6c203E77f827381B0885F7822", + "txHash": "0x4517abab9ed95d1b48b418a30dc1212faf5b61a10a2e8ce85a2e48e12e65f1eb", + "layout": { + "solcVersion": "0.8.18", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC1967UpgradeUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:197" + }, + { + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage", + "contract": "UUPSUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:107" + }, + { + "label": "_status", + "offset": 0, + "slot": "101", + "type": "t_uint256", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:38" + }, + { + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:80" + }, + { + "label": "__gap", + "offset": 0, + "slot": "151", + "type": "t_array(t_uint256)1000_storage", + "contract": "MultiCallerUpgradeable", + "src": "contracts/upgradeable/MultiCallerUpgradeable.sol:46" + }, + { + "label": "_HASHED_NAME", + "offset": 0, + "slot": "1151", + "type": "t_bytes32", + "contract": "EIP712CrossChainUpgradeable", + "src": "contracts/upgradeable/EIP712CrossChainUpgradeable.sol:20" + }, + { + "label": "_HASHED_VERSION", + "offset": 0, + "slot": "1152", + "type": "t_bytes32", + "contract": "EIP712CrossChainUpgradeable", + "src": "contracts/upgradeable/EIP712CrossChainUpgradeable.sol:21" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1153", + "type": "t_array(t_uint256)1000_storage", + "contract": "EIP712CrossChainUpgradeable", + "src": "contracts/upgradeable/EIP712CrossChainUpgradeable.sol:84" + }, + { + "label": "crossDomainAdmin", + "offset": 0, + "slot": "2153", + "type": "t_address", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:50" + }, + { + "label": "hubPool", + "offset": 0, + "slot": "2154", + "type": "t_address", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:54" + }, + { + "label": "wrappedNativeToken", + "offset": 0, + "slot": "2155", + "type": "t_contract(WETH9Interface)21554", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:58" + }, + { + "label": "depositQuoteTimeBuffer", + "offset": 20, + "slot": "2155", + "type": "t_uint32", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:62" + }, + { + "label": "numberOfDeposits", + "offset": 24, + "slot": "2155", + "type": "t_uint32", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:65" + }, + { + "label": "pausedFills", + "offset": 28, + "slot": "2155", + "type": "t_bool", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:68" + }, + { + "label": "pausedDeposits", + "offset": 29, + "slot": "2155", + "type": "t_bool", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:69" + }, + { + "label": "rootBundles", + "offset": 0, + "slot": "2156", + "type": "t_array(t_struct(RootBundle)21858_storage)dyn_storage", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:72" + }, + { + "label": "enabledDepositRoutes", + "offset": 0, + "slot": "2157", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:75" + }, + { + "label": "relayFills", + "offset": 0, + "slot": "2158", + "type": "t_mapping(t_bytes32,t_uint256)", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:80" + }, + { + "label": "fillCounter", + "offset": 0, + "slot": "2159", + "type": "t_mapping(t_address,t_uint256)", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:86" + }, + { + "label": "depositCounter", + "offset": 0, + "slot": "2160", + "type": "t_mapping(t_address,t_uint256)", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:90" + }, + { + "label": "refundsRequested", + "offset": 0, + "slot": "2161", + "type": "t_mapping(t_bytes32,t_uint256)", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:95" + }, + { + "label": "__gap", + "offset": 0, + "slot": "2162", + "type": "t_array(t_uint256)1000_storage", + "contract": "SpokePool", + "src": "contracts/SpokePool.sol:1309" + }, + { + "label": "__gap", + "offset": 0, + "slot": "3162", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_owner", + "offset": 0, + "slot": "3212", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "3213", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_struct(RootBundle)21858_storage)dyn_storage": { + "label": "struct SpokePoolInterface.RootBundle[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)1000_storage": { + "label": "uint256[1000]", + "numberOfBytes": "32000" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(WETH9Interface)21554": { + "label": "contract WETH9Interface", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_bool))": { + "label": "mapping(address => mapping(uint256 => bool))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_uint256)": { + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_bool)": { + "label": "mapping(uint256 => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32" + }, + "t_struct(RootBundle)21858_storage": { + "label": "struct SpokePoolInterface.RootBundle", + "members": [ + { + "label": "slowRelayRoot", + "type": "t_bytes32", + "offset": 0, + "slot": "0" + }, + { + "label": "relayerRefundRoot", + "type": "t_bytes32", + "offset": 0, + "slot": "1" + }, + { + "label": "claimedBitmap", + "type": "t_mapping(t_uint256,t_uint256)", + "offset": 0, + "slot": "2" + } + ], + "numberOfBytes": "96" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "label": "uint32", + "numberOfBytes": "4" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + } + } + } + } +} diff --git a/deploy/consts.ts b/deploy/consts.ts index 9a3112068..e06448466 100644 --- a/deploy/consts.ts +++ b/deploy/consts.ts @@ -59,6 +59,12 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string } matic: "0x499d11E0b6eAC7c0593d8Fb292DCBbF815Fb29Ae", // Dummy: Polygon's testnet is goerli l2WrappedMatic: "0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889", // Dummy: Polygon's testnet is goerli }, + 280: { + weth: "0x20b28B1e4665FFf290650586ad76E977EAb90c5D", + }, + 324: { + weth: "0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91", + }, }; export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string } } = { diff --git a/hardhat.config.ts b/hardhat.config.ts index d8729d7d1..1202915a3 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -3,10 +3,12 @@ import * as dotenv from "dotenv"; import { HardhatUserConfig } from "hardhat/config"; import { getNodeUrl, getMnemonic } from "@uma/common"; -import "@nomiclabs/hardhat-etherscan"; // Must be above hardhat-upgrades +import "@nomicfoundation/hardhat-verify"; // Must be above hardhat-upgrades import "@nomiclabs/hardhat-waffle"; import "@typechain/hardhat"; import "@matterlabs/hardhat-zksync-solc"; +import "@matterlabs/hardhat-zksync-verify"; +import "@matterlabs/hardhat-zksync-upgradable"; import "hardhat-gas-reporter"; import "solidity-coverage"; import "hardhat-deploy"; @@ -46,16 +48,11 @@ const config: HardhatUserConfig = { }, }, zksolc: { - version: "1.1.0", - compilerSource: "docker", + version: "latest", settings: { optimizer: { enabled: true, }, - experimental: { - dockerImage: "matterlabs/zksolc", - tag: "v1.1.0", - }, }, }, networks: { @@ -68,11 +65,21 @@ const config: HardhatUserConfig = { }, "zksync-goerli": { chainId: 280, - url: "https://zksync2-testnet.zksync.dev", + url: "https://testnet.era.zksync.dev", saveDeployments: true, accounts: { mnemonic }, - companionNetworks: { l1: "goerli" }, + ethNetwork: "goerli", + zksync: true, + verifyURL: "https://zksync2-testnet-explorer.zksync.dev/contract_verification", + }, + zksync: { + chainId: 324, + url: "https://mainnet.era.zksync.dev", + saveDeployments: true, + accounts: { mnemonic }, + ethNetwork: "mainnet", zksync: true, + verifyURL: "https://zksync2-mainnet-explorer.zksync.io/contract_verification", }, kovan: { url: getNodeUrl("kovan", true, 42), @@ -156,12 +163,11 @@ const config: HardhatUserConfig = { rinkeby: process.env.ETHERSCAN_API_KEY!, goerli: process.env.ETHERSCAN_API_KEY!, optimisticEthereum: process.env.OPTIMISM_ETHERSCAN_API_KEY!, - optimisticGoerli: process.env.OPTIMISM_ETHERSCAN_API_KEY!, arbitrumOne: process.env.ARBITRUM_ETHERSCAN_API_KEY!, - arbitrumGoerli: process.env.ARBITRUM_ETHERSCAN_API_KEY!, polygon: process.env.POLYGON_ETHERSCAN_API_KEY!, polygonMumbai: process.env.POLYGON_ETHERSCAN_API_KEY!, }, + customChains: [], }, namedAccounts: { deployer: 0 }, typechain: { diff --git a/package.json b/package.json index c2d3f86cb..30f39ba88 100644 --- a/package.json +++ b/package.json @@ -41,13 +41,17 @@ "@openzeppelin/contracts-upgradeable": "4.8.3", "@uma/common": "^2.29.0", "@uma/contracts-node": "^0.3.18", - "@uma/core": "^2.41.0" + "@uma/core": "^2.41.0", + "zksync-web3": "^0.14.3" }, "devDependencies": { - "@matterlabs/hardhat-zksync-solc": "^0.3.6", + "@matterlabs/hardhat-zksync-deploy": "^0.6.3", + "@matterlabs/hardhat-zksync-solc": "^0.4.0", + "@matterlabs/hardhat-zksync-upgradable": "^0.1.0", + "@matterlabs/hardhat-zksync-verify": "^0.2.0", "@matterlabs/zksync-contracts": "^0.2.4", + "@nomicfoundation/hardhat-verify": "^1.0.3", "@nomiclabs/hardhat-ethers": "^2.2.3", - "@nomiclabs/hardhat-etherscan": "^3.1.7", "@nomiclabs/hardhat-waffle": "2.0.3", "@openzeppelin/hardhat-upgrades": "^1.22.0", "@pinata/sdk": "^2.1.0", diff --git a/scripts/deployZkSyncSpokePoolProxy.ts b/scripts/deployZkSyncSpokePoolProxy.ts new file mode 100644 index 000000000..fc5366add --- /dev/null +++ b/scripts/deployZkSyncSpokePoolProxy.ts @@ -0,0 +1,40 @@ +import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; +import { Wallet } from "zksync-web3"; +import { L1_ADDRESS_MAP } from "../deploy/consts"; +require("dotenv").config(); + +import * as hre from "hardhat"; + +async function main() { + const contractName = "Ethereum_SpokePool"; + console.log("Deploying " + contractName + "..."); + + const chainId = await hre.getChainId(); + if (chainId !== "280") throw new Error("This script can only be run on zkSync testnet (chainId 280)"); + + // mnemonic for local node rich wallet + const testMnemonic = process.env.MNEMONIC ?? ""; + const zkWallet = Wallet.fromMnemonic(testMnemonic); + + const deployer = new Deployer(hre, zkWallet); + + const contract = await deployer.loadArtifact(contractName); + const proxy = await hre.zkUpgrades.deployProxy( + deployer.zkWallet, + contract, + [1_000_000, "0x0e2817C49698cc0874204AeDf7c72Be2Bb7fCD5d", L1_ADDRESS_MAP[chainId].weth], + { initializer: "initialize" } + ); + + await proxy.deployed(); + console.log(contractName + " deployed to:", proxy.address); + + // proxy.connect(zkWallet); + // const value = await box.retrieve(); + // console.log('Box value is: ', value.toNumber()); +} + +main().catch((error) => { + console.error(error); + process.exitCode = 1; +}); diff --git a/yarn.lock b/yarn.lock index a4267848a..00db66c7d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1986,13 +1986,51 @@ dependencies: "@openzeppelin/contracts" "^4.2.0" -"@matterlabs/hardhat-zksync-solc@^0.3.6": - version "0.3.6" - resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-solc/-/hardhat-zksync-solc-0.3.6.tgz#4f27105baf00764a6430d03e1c8a8f178c44a805" - integrity sha512-iuGmNk9QrqG5RDIup4FD/47VGnZoKX7DhST8JRKuh1844KlKoZuEPs0JF2FVQclotUATvEXhOV3XXcv4lo7Myw== +"@matterlabs/hardhat-zksync-deploy@^0.6.3": + version "0.6.3" + resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-deploy/-/hardhat-zksync-deploy-0.6.3.tgz#833b208373e7037bf43671054328d82511444e2a" + integrity sha512-FB+2xFL/80JJwlGna+aHA6dk4ONrMFqThTZATYVJUAKooA0Aw5qmpmM8B3qsNB4LLzHSO/EmVrHIcLaPv8hYwQ== + dependencies: + chalk "4.1.2" + +"@matterlabs/hardhat-zksync-solc@0.3.17": + version "0.3.17" + resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-solc/-/hardhat-zksync-solc-0.3.17.tgz#72f199544dc89b268d7bfc06d022a311042752fd" + integrity sha512-aZgQ0yfXW5xPkfuEH1d44ncWV4T2LzKZd0VVPo4PL5cUrYs2/II1FaEDp5zsf3FxOR1xT3mBsjuSrtJkk4AL8Q== dependencies: "@nomiclabs/hardhat-docker" "^2.0.0" - dockerode "^3.3.1" + chalk "4.1.2" + dockerode "^3.3.4" + +"@matterlabs/hardhat-zksync-solc@^0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-solc/-/hardhat-zksync-solc-0.4.0.tgz#4f0352398a9de9144fd2c0e32295e212318e164c" + integrity sha512-lCHozNmgLco7WOKSCG0FaywAT2Hdymlb2EZF3J4ly4gMVkz54LXXXFLtibggWH5OdYmYkMLGRvUdq8w/ilJUjQ== + dependencies: + "@nomiclabs/hardhat-docker" "^2.0.0" + chalk "4.1.2" + dockerode "^3.3.4" + fs-extra "^11.1.1" + semver "^7.5.1" + +"@matterlabs/hardhat-zksync-upgradable@^0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-upgradable/-/hardhat-zksync-upgradable-0.1.0.tgz#f6787161e7be9f8678ce5405dd82b3dc10ed2431" + integrity sha512-1MhZh8JUJq1QWuQ1zFj1iRgTOj5wrnkqe7TUmkM+S84YgVHivLmbofkC4YtkQKgRtlUwCeTDHz2dr/baIWLwfQ== + dependencies: + "@matterlabs/hardhat-zksync-deploy" "^0.6.3" + "@matterlabs/hardhat-zksync-solc" "^0.4.0" + dockerode "^3.3.4" + +"@matterlabs/hardhat-zksync-verify@^0.2.0": + version "0.2.0" + resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-verify/-/hardhat-zksync-verify-0.2.0.tgz#a0c6b897202057873355b680244f72f573d86a97" + integrity sha512-iUwxhPlNk+HWe+UadLqQzdDb2fammbKYoz8wqVuyr9jygFUf8JNPLWDZOS0KCQgRn/dmT22+i9nSREOg66bAHA== + dependencies: + "@matterlabs/hardhat-zksync-solc" "0.3.17" + axios "^1.4.0" + chalk "4.1.2" + dockerode "^3.3.4" "@matterlabs/zksync-contracts@^0.2.4": version "0.2.4" @@ -2315,6 +2353,21 @@ mcl-wasm "^0.7.1" rustbn.js "~0.2.0" +"@nomicfoundation/hardhat-verify@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-verify/-/hardhat-verify-1.0.3.tgz#573b326fe0f58dcdc527e8c11bd5a6336eb52bc4" + integrity sha512-KUj4O/Hd8QB6cr/rxEmRG0zcDjRUNYhWbjtGGwE4lUNuaEhVIDt/cHGJtF/A6lANQR0mpaxC6fwojhzice/ykQ== + dependencies: + "@ethersproject/abi" "^5.1.2" + "@ethersproject/address" "^5.0.2" + cbor "^8.1.0" + chalk "^2.4.2" + debug "^4.1.1" + lodash.clonedeep "^4.5.0" + semver "^6.3.0" + table "^6.8.0" + undici "^5.14.0" + "@nomicfoundation/solidity-analyzer-darwin-arm64@0.1.0": version "0.1.0" resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-darwin-arm64/-/solidity-analyzer-darwin-arm64-0.1.0.tgz#83a7367342bd053a76d04bbcf4f373fef07cf760" @@ -2418,22 +2471,6 @@ semver "^6.3.0" undici "^4.14.1" -"@nomiclabs/hardhat-etherscan@^3.1.7": - version "3.1.7" - resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-3.1.7.tgz#72e3d5bd5d0ceb695e097a7f6f5ff6fcbf062b9a" - integrity sha512-tZ3TvSgpvsQ6B6OGmo1/Au6u8BrAkvs1mIC/eURA3xgIfznUZBhmpne8hv7BXUzw9xNL3fXdpOYgOQlVMTcoHQ== - dependencies: - "@ethersproject/abi" "^5.1.2" - "@ethersproject/address" "^5.0.2" - cbor "^8.1.0" - chalk "^2.4.2" - debug "^4.1.1" - fs-extra "^7.0.1" - lodash "^4.17.11" - semver "^6.3.0" - table "^6.8.0" - undici "^5.14.0" - "@nomiclabs/hardhat-truffle5@^2.0.0": version "2.0.5" resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-truffle5/-/hardhat-truffle5-2.0.5.tgz#28a4c33a0ebbca3e48f50e12824a3a94ed557916" @@ -4359,6 +4396,15 @@ axios@^0.21.1: dependencies: follow-redirects "^1.14.0" +axios@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f" + integrity sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA== + dependencies: + follow-redirects "^1.15.0" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" @@ -5543,6 +5589,14 @@ chalk-pipe@^3.0.0: chalk "^3.0.0" css-color-names "^1.0.0" +chalk@4.1.2, chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" @@ -5571,14 +5625,6 @@ chalk@^3.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - change-case@3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/change-case/-/change-case-3.0.2.tgz#fd48746cce02f03f0a672577d1d3a8dc2eceb037" @@ -6574,10 +6620,10 @@ dockerode@^2.5.8: docker-modem "^1.0.8" tar-fs "~1.16.3" -dockerode@^3.3.1: - version "3.3.4" - resolved "https://registry.yarnpkg.com/dockerode/-/dockerode-3.3.4.tgz#875de614a1be797279caa9fe27e5637cf0e40548" - integrity sha512-3EUwuXnCU+RUlQEheDjmBE0B7q66PV9Rw5NiH1sXwINq0M9c5ERP9fxgkw36ZHOtzf4AGEEYySnkx/sACC9EgQ== +dockerode@^3.3.4: + version "3.3.5" + resolved "https://registry.yarnpkg.com/dockerode/-/dockerode-3.3.5.tgz#7ae3f40f2bec53ae5e9a741ce655fff459745629" + integrity sha512-/0YNa3ZDNeLr/tSckmD69+Gq+qVNhvKfAHNeZJBnp7EOP6RGKV8ORrJHkUn20So5wU+xxT7+1n5u8PjHbfjbSA== dependencies: "@balena/dockerignore" "^1.0.2" docker-modem "^3.0.0" @@ -8469,6 +8515,11 @@ follow-redirects@^1.12.1, follow-redirects@^1.14.0: resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7" integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w== +follow-redirects@^1.15.0: + version "1.15.2" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" + integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== + for-each@^0.3.3, for-each@~0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" @@ -8579,6 +8630,15 @@ fs-extra@^10.0.0: jsonfile "^6.0.1" universalify "^2.0.0" +fs-extra@^11.1.1: + version "11.1.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.1.1.tgz#da69f7c39f3b002378b0954bb6ae7efdc0876e2d" + integrity sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + fs-extra@^4.0.2, fs-extra@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" @@ -12921,6 +12981,11 @@ proxy-addr@~2.0.7: forwarded "0.2.0" ipaddr.js "1.9.1" +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" @@ -13822,6 +13887,13 @@ semver@^7.2.1, semver@^7.3.4, semver@^7.3.5: dependencies: lru-cache "^6.0.0" +semver@^7.5.1: + version "7.5.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.3.tgz#161ce8c2c6b4b3bdca6caadc9fa3317a4c4fe88e" + integrity sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ== + dependencies: + lru-cache "^6.0.0" + semver@~5.4.1: version "5.4.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" @@ -17233,6 +17305,11 @@ yocto-queue@^0.1.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== +zksync-web3@^0.14.3: + version "0.14.3" + resolved "https://registry.yarnpkg.com/zksync-web3/-/zksync-web3-0.14.3.tgz#64ac2a16d597464c3fc4ae07447a8007631c57c9" + integrity sha512-hT72th4AnqyLW1d5Jlv8N2B/qhEnl2NePK2A3org7tAa24niem/UAaHMkEvmWI3SF9waYUPtqAtjpf+yvQ9zvQ== + zksync-web3@^0.7.8: version "0.7.11" resolved "https://registry.yarnpkg.com/zksync-web3/-/zksync-web3-0.7.11.tgz#1d829eda9b220b94a3d7e3ab29a2b37ab789a276"