Skip to content

Commit

Permalink
feature(networks): Adding deployment on zkSync (#13078)
Browse files Browse the repository at this point in the history
* adding zksync file

* wip

* fix deployment script

* wip

* lint

* undue change

* set zksync flag

* wip

* wip

* ignore cache files

* bump zksync libs

* bump zksync-solc

* remove dev deps

* comment upgredeable that throws on import

* move zksync deploy deps to helpers

* zkSync deploy tasks

* add zksync deps to helpers

* add zksync Sepolia network

* use tmp provider

* ignore artifacts

* use actual artifact in function

* move verification to helpers

* zksync verification

* zksync networks testnet support

* add `ethNetwork`in networks types

* parse zkync opts into hardhat network

* fix versions

* pass `deployOptions` to zksync upgrades

* avoid duplicate improt

* workaround to get `Deployer` class

* delete unwanted file

* make zksync compile step programmatic

* remove log

* remove `ethNetwork`

* allow zksync on local nets

* add manifest

* Update provider/src/types.ts

* parse network name properly

* add zksync mainnet manifest

* fix issue with `Deployer` - thanks to matter-labs/hardhat-zksync#711

* bump upgradable lib - fix matter-labs/hardhat-zksync/#753

* sepolia manifest - fixed in matter-labs/hardhat-zksync/#696

* add sepolia deployment

* add zksync deployment

* prevent verification fallback to testnet explorer

* remove sepolia

* remove zksync sepolia manifest

* add startBlock

* add multisig

* correct subgraph network name

* add subgraph endpoint

---------

Co-authored-by: Clément Renaud <[email protected]>
Co-authored-by: Clément Renaud <[email protected]>
  • Loading branch information
3 people authored Feb 14, 2024
1 parent aea5209 commit 73eeb62
Show file tree
Hide file tree
Showing 13 changed files with 5,904 additions and 1,937 deletions.
8 changes: 7 additions & 1 deletion governance/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
cache
contracts
artifacts
artifacts

# zksync
zk-artifacts
zk-cache
artifacts-zk
cache-zk
284 changes: 284 additions & 0 deletions governance/.upgradable/zkSync-era.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
{
"manifestVersion": "3.2",
"admin": {
"address": "0xdab03e5E7f51065F4c41945a0718Bed21Ef9A9EF",
"txHash": "0x86d758ffa577b99326b57d35240cb7904d22f17d7a13460b36cb3ac505f750a6"
},
"proxies": [
{
"address": "0x32CF553582159F12fBb1Ae1649b3670395610F24",
"txHash": "0x7af40bdb7142000fc3fe8aeb942a665d0ee88a5702bdbcfab28a2db49a33a836",
"kind": "transparent"
}
],
"impls": {
"1e08e5aeb4050c1e4057c7ed73ca81b9710d240e2d74086cc15337008288f4b6": {
"address": "0xb52E38541e709622D86142DC2D50e2eE94017a06",
"txHash": "0x4ede332025cc8d43558fa6585e09269e26a6a5ffc880d3aba5c27c4aa0da41a3",
"layout": {
"solcVersion": "0.8.21",
"storage": [
{
"label": "initialized",
"offset": 0,
"slot": "0",
"type": "t_bool",
"contract": "UnlockInitializable",
"src": "contracts/past-versions/UnlockV13.sol:1327"
},
{
"label": "initializing",
"offset": 1,
"slot": "0",
"type": "t_bool",
"contract": "UnlockInitializable",
"src": "contracts/past-versions/UnlockV13.sol:1332"
},
{
"label": "______gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)50_storage",
"contract": "UnlockContextUpgradeable",
"src": "contracts/past-versions/UnlockV13.sol:1406"
},
{
"label": "_owner",
"offset": 0,
"slot": "51",
"type": "t_address",
"contract": "UnlockOwnable",
"src": "contracts/past-versions/UnlockV13.sol:1435"
},
{
"label": "______gap",
"offset": 0,
"slot": "52",
"type": "t_array(t_uint256)50_storage",
"contract": "UnlockOwnable",
"src": "contracts/past-versions/UnlockV13.sol:1501"
},
{
"label": "grossNetworkProduct",
"offset": 0,
"slot": "102",
"type": "t_uint256",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2786"
},
{
"label": "totalDiscountGranted",
"offset": 0,
"slot": "103",
"type": "t_uint256",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2788"
},
{
"label": "locks",
"offset": 0,
"slot": "104",
"type": "t_mapping(t_address,t_struct(LockBalances)3109_storage)",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2791"
},
{
"label": "globalBaseTokenURI",
"offset": 0,
"slot": "105",
"type": "t_string_storage",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2795"
},
{
"label": "globalTokenSymbol",
"offset": 0,
"slot": "106",
"type": "t_string_storage",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2799"
},
{
"label": "publicLockAddress",
"offset": 0,
"slot": "107",
"type": "t_address",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2802"
},
{
"label": "uniswapOracles",
"offset": 0,
"slot": "108",
"type": "t_mapping(t_address,t_contract(IUniswapOracleV3)757)",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2806"
},
{
"label": "weth",
"offset": 0,
"slot": "109",
"type": "t_address",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2809"
},
{
"label": "udt",
"offset": 0,
"slot": "110",
"type": "t_address",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2812"
},
{
"label": "estimatedGasForPurchase",
"offset": 0,
"slot": "111",
"type": "t_uint256",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2815"
},
{
"label": "chainId",
"offset": 0,
"slot": "112",
"type": "t_uint256",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2818"
},
{
"label": "proxyAdminAddress",
"offset": 0,
"slot": "113",
"type": "t_address",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2821"
},
{
"label": "proxyAdmin",
"offset": 0,
"slot": "114",
"type": "t_contract(ProxyAdmin)3095",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2822"
},
{
"label": "_publicLockVersions",
"offset": 0,
"slot": "115",
"type": "t_mapping(t_address,t_uint16)",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2825"
},
{
"label": "_publicLockImpls",
"offset": 0,
"slot": "116",
"type": "t_mapping(t_uint16,t_address)",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2826"
},
{
"label": "publicLockLatestVersion",
"offset": 0,
"slot": "117",
"type": "t_uint16",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2827"
},
{
"label": "protocolFee",
"offset": 0,
"slot": "118",
"type": "t_uint256",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2830"
},
{
"label": "swapBurnerAddress",
"offset": 0,
"slot": "119",
"type": "t_address",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2833"
}
],
"types": {
"t_address": {
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]",
"numberOfBytes": "1600"
},
"t_bool": {
"label": "bool",
"numberOfBytes": "1"
},
"t_contract(IUniswapOracleV3)757": {
"label": "contract IUniswapOracleV3",
"numberOfBytes": "20"
},
"t_contract(ProxyAdmin)3095": {
"label": "contract ProxyAdmin",
"numberOfBytes": "20"
},
"t_mapping(t_address,t_contract(IUniswapOracleV3)757)": {
"label": "mapping(address => contract IUniswapOracleV3)",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_struct(LockBalances)3109_storage)": {
"label": "mapping(address => struct Unlock.LockBalances)",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_uint16)": {
"label": "mapping(address => uint16)",
"numberOfBytes": "32"
},
"t_mapping(t_uint16,t_address)": {
"label": "mapping(uint16 => address)",
"numberOfBytes": "32"
},
"t_string_storage": {
"label": "string",
"numberOfBytes": "32"
},
"t_struct(LockBalances)3109_storage": {
"label": "struct Unlock.LockBalances",
"members": [
{
"label": "deployed",
"type": "t_bool",
"offset": 0,
"slot": "0"
},
{
"label": "totalSales",
"type": "t_uint256",
"offset": 0,
"slot": "1"
},
{
"label": "yieldedDiscountTokens",
"type": "t_uint256",
"offset": 0,
"slot": "2"
}
],
"numberOfBytes": "96"
},
"t_uint16": {
"label": "uint16",
"numberOfBytes": "2"
},
"t_uint256": {
"label": "uint256",
"numberOfBytes": "32"
}
},
"namespaces": {}
}
}
}
}
19 changes: 18 additions & 1 deletion governance/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ const {
parseForkUrl,
} = require('@unlock-protocol/hardhat-helpers')

// zksync
if (process.env.ZK_SYNC) {
require('@matterlabs/hardhat-zksync-solc')
require('@matterlabs/hardhat-zksync-verify')
require('@matterlabs/hardhat-zksync-upgradable')
}

const settings = {
optimizer: {
enabled: true,
Expand Down Expand Up @@ -41,6 +48,7 @@ if (process.env.TENDERLY_FORK) {
accounts: networks.mainnet.accounts,
}
}

// tasks
require('./tasks/balance')
require('./tasks/safe')
Expand All @@ -54,7 +62,7 @@ require('./tasks/lock')
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
const config = {
networks,
etherscan,
solidity: {
Expand All @@ -64,3 +72,12 @@ module.exports = {
enabled: true,
},
}

if (process.env.ZK_SYNC) {
config.zksolc = {
version: 'latest',
settings: {},
}
}

module.exports = config
10 changes: 7 additions & 3 deletions governance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
"description": "Scripts for the management of the Unlock Protocol",
"private": true,
"dependencies": {
"@matterlabs/hardhat-zksync-deploy": "1.1.2",
"@matterlabs/hardhat-zksync-solc": "1.1.0",
"@matterlabs/hardhat-zksync-upgradable": "1.2.4",
"@matterlabs/hardhat-zksync-verify": "1.3.0",
"@nomicfoundation/hardhat-ethers": "3.0.5",
"@nomicfoundation/hardhat-network-helpers": "1.0.10",
"@nomicfoundation/hardhat-verify": "2.0.4",
"@nomiclabs/hardhat-ethers": "2.2.3",
"@nomiclabs/hardhat-etherscan": "3.1.8",
"@openzeppelin/hardhat-upgrades": "3.0.2",
"@openzeppelin/upgrades-core": "1.32.2",
"@safe-global/api-kit": "2.0.0",
Expand All @@ -19,10 +22,11 @@
"@unlock-protocol/hardhat-plugin": "workspace:^",
"@unlock-protocol/networks": "workspace:./packages/networks",
"eslint": "8.54.0",
"ethers": "6.9.0",
"ethers": "6.10.0",
"fs-extra": "11.2.0",
"hardhat": "2.19.5",
"solhint": "4.1.1"
"solhint": "4.1.1",
"zksync-ethers": "6.1.0"
},
"scripts": {
"test": "hardhat test",
Expand Down
9 changes: 7 additions & 2 deletions packages/hardhat-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
"lint": "eslint --resolve-plugins-relative-to ../eslint-config --ext .ts,.js src/"
},
"dependencies": {
"@matterlabs/hardhat-zksync-deploy": "1.1.2",
"@matterlabs/hardhat-zksync-solc": "1.1.0",
"@matterlabs/hardhat-zksync-upgradable": "1.2.1",
"@matterlabs/hardhat-zksync-verify": "1.3.0",
"@nomiclabs/hardhat-ethers": "2.2.3",
"@nomiclabs/hardhat-waffle": "2.0.6",
"@openzeppelin/hardhat-upgrades": "1.28.0",
"@uniswap/permit2-sdk": "1.2.0",
"@uniswap/sdk-core": "4.0.9",
"@uniswap/smart-order-router": "3.19.2",
Expand All @@ -24,8 +27,10 @@
"@unlock-protocol/networks": "workspace:^",
"@unlock-protocol/tsconfig": "workspace:^",
"@unlock-protocol/types": "workspace:^",
"ethers": "6.10.0",
"hardhat": "2.19.5",
"typescript": "5.3.3"
"typescript": "5.3.3",
"zksync-ethers": "6.1.0"
},
"devDependencies": {
"copyfiles": "2.4.1",
Expand Down
Loading

0 comments on commit 73eeb62

Please sign in to comment.