Skip to content

Commit

Permalink
Merge pull request bgd-labs#35 from bgd-labs/feat/zksync
Browse files Browse the repository at this point in the history
Feat/zksync
  • Loading branch information
sendra authored Nov 8, 2024
2 parents 0c14d60 + c7b8ecf commit 9e65335
Show file tree
Hide file tree
Showing 32 changed files with 370 additions and 46 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ RPC_ZKEVM=https://polygon-zkevm.drpc.org
RPC_ZKEVM_TESTNET=https://rpc.public.zkevm-test.net
RPC_SCROLL=https://rpc.scroll.io
RPC_SCROLL_TESTNET=https://sepolia-rpc.scroll.io
RPC_ZK_SYNC=https://mainnet.era.zksync.io
RPC_ZK_SYNC_TESTNET=https://sepolia.era.zksync.dev

# Etherscan api keys for verification & download utils
ETHERSCAN_API_KEY_MAINNET=
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ node_modules
broadcast/
.DS_Store
/input.json
zkout/
2 changes: 2 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[submodule "lib/solidity-utils"]
path = lib/solidity-utils
url = https://github.com/bgd-labs/solidity-utils
branch = feat/zksync
[submodule "lib/aave-token-v3"]
path = lib/aave-token-v3
url = https://github.com/bgd-labs/aave-token-v3
Expand All @@ -17,3 +18,4 @@
[submodule "lib/aave-delivery-infrastructure"]
path = lib/aave-delivery-infrastructure
url = https://github.com/bgd-labs/aave-delivery-infrastructure
branch = feat/zksync
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ custom_polygon-testnet := --with-gas-price 20000000000 # 5 gwei
custom_avalanche := --with-gas-price 27000000000 # 27 gwei
custom_metis-testnet := --legacy --verifier-url https://goerli.explorer.metisdevops.link/api/
custom_metis := --verifier-url https://andromeda-explorer.metis.io/api/

custom_zksync := --zksync
custom_zksync-testnet := --legacy --zksync

# params:
# 1 - path/file_name
Expand Down Expand Up @@ -99,7 +100,7 @@ write-json-addresses :; forge script scripts/WriteAddresses.s.sol:WriteDeployedA


deploy-initial-test:
$(call deploy_fn,InitialDeployments,gnosis)
$(call deploy_fn,InitialDeployments,zksync)

# Deploy Governance contracts
deploy-governance-test:
Expand All @@ -123,14 +124,14 @@ set-vm-as-ccf-sender-test:
$(call deploy_fn,VotingMachine/Set_VM_as_CCF_Sender,ethereum avalanche polygon binance)

deploy-executor-lvl1-test:
$(call deploy_fn,Payloads/Deploy_ExecutorLvl1,ethereum avalanche polygon binance)
$(call deploy_fn,Payloads/Deploy_ExecutorLvl1,zksync)

deploy-executor-lvl2-test:
$(call deploy_fn,Payloads/Deploy_ExecutorLvl2,ethereum)

## Deploy execution chain contracts
deploy-payloads-controller-chain-test:
$(call deploy_fn,Payloads/Deploy_PayloadsController,gnosis)
$(call deploy_fn,Payloads/Deploy_PayloadsController,zksync)

## Deploy Governance Voting Portal
deploy-voting-portals-test:
Expand All @@ -147,7 +148,7 @@ set-vp-as_ccf-senders-test:

## Deploy Contract Helpers
deploy-helper-contracts-test:
$(call deploy_fn,Deploy_ContractHelpers,gnosis)
$(call deploy_fn,Deploy_ContractHelpers,zksync)

deploy-full-key-test:
make deploy-initial-test
Expand Down Expand Up @@ -217,10 +218,10 @@ update-voting-config:
$(call deploy_fn,helpers/GovernanceSetVotingConfig,ethereum)

deploy-payload:
$(call deploy_fn,helpers/CreatePayload,polygon)
$(call deploy_fn,helpers/CreatePayload,zksync)

register-payload:
$(call deploy_fn,helpers/RegisterPayload,polygon)
$(call deploy_fn,helpers/RegisterPayload,zksync)

create-proposal:
$(call deploy_fn,helpers/CreateProposal,ethereum)
Expand Down
27 changes: 27 additions & 0 deletions deployments/cc/mainnet/pre_prod_zksync.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"arbAdapter": "0x0000000000000000000000000000000000000000",
"baseAdapter": "0x0000000000000000000000000000000000000000",
"ccipAdapter": "0x0000000000000000000000000000000000000000",
"chainId": 324,
"clEmergencyOracle": "0x0000000000000000000000000000000000000000",
"create3Factory": "0x0000000000000000000000000000000000000000",
"crossChainController": "0xEFB85c47F666829e9dD9Ad56fC2ca0E5C2569e17",
"crossChainControllerImpl": "0x93aF5EA45d7eDCD37EFd601C943592b71A2F3682",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"gnosisAdapter": "0x0000000000000000000000000000000000000000",
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"hlAdapter": "0x0000000000000000000000000000000000000000",
"lzAdapter": "0x0000000000000000000000000000000000000000",
"metisAdapter": "0x0000000000000000000000000000000000000000",
"mockDestination": "0x63Ba24d305dCBEd249E9808e4855387bd62424Cc",
"opAdapter": "0x0000000000000000000000000000000000000000",
"owner": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"polAdapter": "0x0000000000000000000000000000000000000000",
"proxyAdmin": "0xb4b3048fD1a6e2e488b51A8a831181D528B9C5c5",
"proxyFactory": "0x8Ef21C75Ce360078cAD162565ED0c27617eCccE0",
"sameChainAdapter": "0x0000000000000000000000000000000000000000",
"scrollAdapter": "0x0000000000000000000000000000000000000000",
"wormholeAdapter": "0x0000000000000000000000000000000000000000",
"zkevmAdapter": "0x0000000000000000000000000000000000000000",
"zksyncAdapter": "0x53Cc59f9F3F4093ecBd2E9e366B35056022eCc8B"
}
27 changes: 27 additions & 0 deletions deployments/cc/mainnet/zksync.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"arbAdapter": "0x0000000000000000000000000000000000000000",
"baseAdapter": "0x0000000000000000000000000000000000000000",
"ccipAdapter": "0x0000000000000000000000000000000000000000",
"chainId": 324,
"clEmergencyOracle": "0x0000000000000000000000000000000000000000",
"create3Factory": "0x0000000000000000000000000000000000000000",
"crossChainController": "0x800813f4714BC7A0a95310e3fB9e4f18872CA92C",
"crossChainControllerImpl": "0x2b6D63bf3e0abC405C50e00A015c4EE47780a42f",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"gnosisAdapter": "0x0000000000000000000000000000000000000000",
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"hlAdapter": "0x0000000000000000000000000000000000000000",
"lzAdapter": "0x0000000000000000000000000000000000000000",
"metisAdapter": "0x0000000000000000000000000000000000000000",
"mockDestination": "0x0000000000000000000000000000000000000000",
"opAdapter": "0x0000000000000000000000000000000000000000",
"owner": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"polAdapter": "0x0000000000000000000000000000000000000000",
"proxyAdmin": "0x158d6c497317367CEa3CBAb0BD84E6de236F060D",
"proxyFactory": "0x8Ef21C75Ce360078cAD162565ED0c27617eCccE0",
"sameChainAdapter": "0x0000000000000000000000000000000000000000",
"scrollAdapter": "0x0000000000000000000000000000000000000000",
"wormholeAdapter": "0x0000000000000000000000000000000000000000",
"zkevmAdapter": "0x0000000000000000000000000000000000000000",
"zksyncAdapter": "0x1BC5C10CAe378fDbd7D52ec4F9f34590a619c68E"
}
27 changes: 27 additions & 0 deletions deployments/cc/testnet/zksync_sep.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"arbAdapter": "0x0000000000000000000000000000000000000000",
"baseAdapter": "0x0000000000000000000000000000000000000000",
"ccipAdapter": "0x0000000000000000000000000000000000000000",
"chainId": 300,
"clEmergencyOracle": "0x0000000000000000000000000000000000000000",
"create3Factory": "0x0000000000000000000000000000000000000000",
"crossChainController": "0x77430FCd47F62A9706CAca6300563c6B27885F5F",
"crossChainControllerImpl": "0xb8e9DFC71C1d232db103E7ae72bF0CF70c03F912",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"gnosisAdapter": "0x0000000000000000000000000000000000000000",
"guardian": "0x6D603081563784dB3f83ef1F65Cc389D94365Ac9",
"hlAdapter": "0x0000000000000000000000000000000000000000",
"lzAdapter": "0x0000000000000000000000000000000000000000",
"metisAdapter": "0x0000000000000000000000000000000000000000",
"mockDestination": "0x3676a657F22Ea4A6Eb3A51Da7233A37E8D604967",
"opAdapter": "0x0000000000000000000000000000000000000000",
"owner": "0x6D603081563784dB3f83ef1F65Cc389D94365Ac9",
"polAdapter": "0x0000000000000000000000000000000000000000",
"proxyAdmin": "0x91123BA04bEDd58195C985B28F1F99d4a15E1910",
"proxyFactory": "0xcd1416eA758CFf55b7aBA279632446A4272800AB",
"sameChainAdapter": "0x0000000000000000000000000000000000000000",
"scrollAdapter": "0x0000000000000000000000000000000000000000",
"wormholeAdapter": "0x0000000000000000000000000000000000000000",
"zkevmAdapter": "0x0000000000000000000000000000000000000000",
"zksyncAdapter": "0x013D88537bFdb7984700D44a8c0427D13d352D90"
}
2 changes: 1 addition & 1 deletion deployments/gov/mainnet/pre_prod_eth.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dataWarehouse": "0x0000000000000000000000000000000000000000",
"executorLvl1": "0x0000000000000000000000000000000000000000",
"executorLvl2": "0x0000000000000000000000000000000000000000",
"governance": "0x0000000000000000000000000000000000000000",
"governance": "0xac55366fE98D068C8dEeA1b82f3697AA7bacA056",
"governanceDataHelper": "0x0000000000000000000000000000000000000000",
"governanceImpl": "0x0000000000000000000000000000000000000000",
"governancePowerStrategy": "0x0000000000000000000000000000000000000000",
Expand Down
25 changes: 25 additions & 0 deletions deployments/gov/mainnet/pre_prod_zksync.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"aavePool": "0x0000000000000000000000000000000000000000",
"chainId": 324,
"create3Factory": "0x0000000000000000000000000000000000000000",
"dataWarehouse": "0x0000000000000000000000000000000000000000",
"executorLvl1": "0x03a646A1b512c3eC5F1AD689d72C8eE85f56a12d",
"executorLvl2": "0x0000000000000000000000000000000000000000",
"governance": "0x0000000000000000000000000000000000000000",
"governanceDataHelper": "0x0000000000000000000000000000000000000000",
"governanceImpl": "0x0000000000000000000000000000000000000000",
"governancePowerStrategy": "0x0000000000000000000000000000000000000000",
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"metaDelegateHelper": "0x0000000000000000000000000000000000000000",
"owner": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"payloadsController": "0x87CB4c9D5D1Bf3b1A87b90Fc552CfE605E4d0EE4",
"payloadsControllerDataHelper": "0x0000000000000000000000000000000000000000",
"payloadsControllerImpl": "0x50a1F6eDbd606bA5032743636788494BB4120c23",
"votingMachine": "0x0000000000000000000000000000000000000000",
"votingMachineDataHelper": "0x0000000000000000000000000000000000000000",
"votingPortal_Eth_Avax": "0x0000000000000000000000000000000000000000",
"votingPortal_Eth_BNB": "0x0000000000000000000000000000000000000000",
"votingPortal_Eth_Eth": "0x0000000000000000000000000000000000000000",
"votingPortal_Eth_Pol": "0x0000000000000000000000000000000000000000",
"votingStrategy": "0x0000000000000000000000000000000000000000"
}
25 changes: 25 additions & 0 deletions deployments/gov/mainnet/zksync.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"aavePool": "0x0000000000000000000000000000000000000000",
"chainId": 324,
"create3Factory": "0x0000000000000000000000000000000000000000",
"dataWarehouse": "0x0000000000000000000000000000000000000000",
"executorLvl1": "0x04cE39789e11a49595cD0ECEf6f4Bd54ABF4d020",
"executorLvl2": "0x0000000000000000000000000000000000000000",
"governance": "0x0000000000000000000000000000000000000000",
"governanceDataHelper": "0x0000000000000000000000000000000000000000",
"governanceImpl": "0x0000000000000000000000000000000000000000",
"governancePowerStrategy": "0x0000000000000000000000000000000000000000",
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"metaDelegateHelper": "0x0000000000000000000000000000000000000000",
"owner": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"payloadsController": "0x2E79349c3F5e4751E87b966812C9E65E805996F1",
"payloadsControllerDataHelper": "0xe28A3235DCF1Acb8397B546bd588bAAFD7081505",
"payloadsControllerImpl": "0x6721e4f2120057a9121887d51Aa50AC6c0B73610",
"votingMachine": "0x0000000000000000000000000000000000000000",
"votingMachineDataHelper": "0x0000000000000000000000000000000000000000",
"votingPortal_Eth_Avax": "0x0000000000000000000000000000000000000000",
"votingPortal_Eth_BNB": "0x0000000000000000000000000000000000000000",
"votingPortal_Eth_Eth": "0x0000000000000000000000000000000000000000",
"votingPortal_Eth_Pol": "0x0000000000000000000000000000000000000000",
"votingStrategy": "0x0000000000000000000000000000000000000000"
}
25 changes: 25 additions & 0 deletions deployments/gov/testnet/zksync_sep.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"aavePool": "0x0000000000000000000000000000000000000000",
"chainId": 300,
"create3Factory": "0x0000000000000000000000000000000000000000",
"dataWarehouse": "0x0000000000000000000000000000000000000000",
"executorLvl1": "0xd164aef755eaD13Cb2eEFc4c0C046dC6eD88fF43",
"executorLvl2": "0x0000000000000000000000000000000000000000",
"governance": "0x0000000000000000000000000000000000000000",
"governanceDataHelper": "0x0000000000000000000000000000000000000000",
"governanceImpl": "0x0000000000000000000000000000000000000000",
"governancePowerStrategy": "0x0000000000000000000000000000000000000000",
"guardian": "0x6D603081563784dB3f83ef1F65Cc389D94365Ac9",
"metaDelegateHelper": "0x0000000000000000000000000000000000000000",
"owner": "0x6D603081563784dB3f83ef1F65Cc389D94365Ac9",
"payloadsController": "0xcDBc0150cB96d31346C6aBda19234CFbFd17D7b6",
"payloadsControllerDataHelper": "0x0D0C441a5967C7Dfa16f9dA04AE7fa491B8AFE08",
"payloadsControllerImpl": "0x25EC9de38eDD2b7c2823af02C1B22992fED7F622",
"votingMachine": "0x0000000000000000000000000000000000000000",
"votingMachineDataHelper": "0x0000000000000000000000000000000000000000",
"votingPortal_Eth_Avax": "0x0000000000000000000000000000000000000000",
"votingPortal_Eth_BNB": "0x0000000000000000000000000000000000000000",
"votingPortal_Eth_Eth": "0x0000000000000000000000000000000000000000",
"votingPortal_Eth_Pol": "0x0000000000000000000000000000000000000000",
"votingStrategy": "0x0000000000000000000000000000000000000000"
}
15 changes: 14 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ ffi = true

#https://github.com/foundry-rs/foundry/issues/4060

[profile.default.zksync]
src = 'src'
libs = ['lib']
fallback_oz = true
mode = "3"
zksolc="1.4.1"

[rpc_endpoints]
ethereum="${RPC_MAINNET}"
Expand All @@ -38,6 +44,8 @@ zkevm="${RPC_ZKEVM}"
zkevm-testnet="${RPC_ZKEVM_TESTNET}"
scroll="${RPC_SCROLL}"
scroll-testnet="${RPC_SCROLL_TESTNET}"
zksync="${RPC_ZK_SYNC}"
zksync-testnet="${RPC_ZK_SYNC_TESTNET}"

[etherscan]
ethereum={key="${ETHERSCAN_API_KEY_MAINNET}", chain=1 }
Expand All @@ -62,7 +70,12 @@ zkevm={key="${ETHERSCAN_API_KEY_ZKEVM}",chain=1101}
zkevm-testnet={key="${ETHERSCAN_API_KEY_ZKEVM}",chain=1442}
scroll={key="${ETHERSCAN_API_KEY_SCROLL}", chain=534352, utl='https://api.scrollscan.com/api/'}
scroll-testnet={key="${ETHERSCAN_API_KEY_SCROLL}", chain=534351, url='https://api-sepolia.scrollscan.com/api/'}

zksync={key="${ETHERSCAN_API_KEY_ZK_SYNC}", chain=324}
zksync-testnet={key="${ETHERSCAN_API_KEY_ZK_SYNC}", chain=300, url='https://api-sepolia-era.zksync.network/api'}


# See more config options https://github.com/gakonst/foundry/tree/master/config
[fuzz]
no_zksync_reserved_addresses = true
[invariant]
no_zksync_reserved_addresses = true
2 changes: 1 addition & 1 deletion lib/aave-delivery-infrastructure
24 changes: 16 additions & 8 deletions scripts/Deploy_ContractHelpers.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,19 @@ abstract contract BaseContractHelpers is GovBaseScript {
GovDeployerHelpers.Addresses memory addresses
) internal override {
if (addresses.governance != address(0)) {
addresses.governanceDataHelper = address(
new GovernanceDataHelper{salt: Constants.GOV_DATA_HELPER_SALT}()
);
addresses.metaDelegateHelper = address(
new MetaDelegateHelper{salt: Constants.MD_DATA_HELPER_SALT}()
);
addresses.governanceDataHelper = address(new GovernanceDataHelper());
addresses.metaDelegateHelper = address(new MetaDelegateHelper());
}

if (addresses.votingMachine != address(0)) {
addresses.votingMachineDataHelper = address(
new VotingMachineDataHelper{salt: Constants.VM_DATA_HELPER_SALT}()
new VotingMachineDataHelper()
);
}

if (addresses.payloadsController != address(0)) {
addresses.payloadsControllerDataHelper = address(
new PayloadsControllerDataHelper{salt: Constants.PC_DATA_HELPER_SALT}()
new PayloadsControllerDataHelper()
);
}
}
Expand Down Expand Up @@ -100,6 +96,12 @@ contract Scroll is BaseContractHelpers {
}
}

contract Zksync is BaseContractHelpers {
function TRANSACTION_NETWORK() public pure override returns (uint256) {
return ChainIds.ZK_SYNC;
}
}

contract Ethereum_testnet is BaseContractHelpers {
function TRANSACTION_NETWORK() public pure override returns (uint256) {
return TestNetChainIds.ETHEREUM_SEPOLIA;
Expand Down Expand Up @@ -141,3 +143,9 @@ contract Binance_testnet is BaseContractHelpers {
return TestNetChainIds.BNB_TESTNET;
}
}

contract Zksync_testnet is BaseContractHelpers {
function TRANSACTION_NETWORK() public pure override returns (uint256) {
return TestNetChainIds.ZK_SYNC_SEPOLIA;
}
}
4 changes: 4 additions & 0 deletions scripts/GovBaseScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ library GovDeployerHelpers {
return './deployments/gov/mainnet/zkevm.json';
} else if (chainId == ChainIds.SCROLL) {
return './deployments/gov/mainnet/zkevm.json';
} else if (chainId == ChainIds.ZK_SYNC) {
return './deployments/gov/mainnet/zksync.json';
}
if (chainId == TestNetChainIds.ETHEREUM_SEPOLIA) {
return './deployments/gov/testnet/sep.json';
Expand All @@ -93,6 +95,8 @@ library GovDeployerHelpers {
return './deployments/gov/testnet/zkevm_go.json';
} else if (chainId == TestNetChainIds.SCROLL_SEPOLIA) {
return './deployments/gov/testnet/scroll_sepolia.json';
} else if (chainId == TestNetChainIds.ZK_SYNC_SEPOLIA) {
return './deployments/gov/testnet/zksync_sep.json';
} else {
revert('chain id is not supported');
}
Expand Down
Loading

0 comments on commit 9e65335

Please sign in to comment.