Skip to content

Commit

Permalink
feat: deployment of multicall3 on L2 by zk_toolbox (#2872)
Browse files Browse the repository at this point in the history
For complex atomic operations on consensus registry.
Should be merged after
matter-labs/era-contracts#805
Tested manually by running `cargo -p zk_inception -- e init --dev`,
which populated the multicall3 address in contract.yaml to non-zero
value.
  • Loading branch information
pompon0 authored Sep 16, 2024
1 parent 73c0b7c commit 6d4090f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contracts
7 changes: 7 additions & 0 deletions zk_toolbox/crates/config/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::{
deploy_ecosystem::output::DeployL1Output,
deploy_l2_contracts::output::{
ConsensusRegistryOutput, DefaultL2UpgradeOutput, InitializeBridgeOutput,
Multicall3Output,
},
register_chain::output::RegisterChainOutput,
},
Expand Down Expand Up @@ -102,6 +103,11 @@ impl ContractsConfig {
self.l2.default_l2_upgrader = default_upgrade_output.l2_default_upgrader;
Ok(())
}

pub fn set_multicall3(&mut self, multicall3_output: &Multicall3Output) -> anyhow::Result<()> {
self.l2.multicall3 = Some(multicall3_output.multicall3);
Ok(())
}
}

impl FileConfigWithDefaultName for ContractsConfig {
Expand Down Expand Up @@ -152,4 +158,5 @@ pub struct L2Contracts {
pub testnet_paymaster_addr: Address,
pub default_l2_upgrader: Address,
pub consensus_registry: Option<Address>,
pub multicall3: Option<Address>,
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::traits::ZkToolboxConfig;
impl ZkToolboxConfig for InitializeBridgeOutput {}
impl ZkToolboxConfig for DefaultL2UpgradeOutput {}
impl ZkToolboxConfig for ConsensusRegistryOutput {}
impl ZkToolboxConfig for Multicall3Output {}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct InitializeBridgeOutput {
Expand All @@ -23,3 +24,8 @@ pub struct ConsensusRegistryOutput {
pub consensus_registry_implementation: Address,
pub consensus_registry_proxy: Address,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Multicall3Output {
pub multicall3: Address,
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ use config::{
forge_interface::{
deploy_l2_contracts::{
input::DeployL2ContractsInput,
output::{ConsensusRegistryOutput, DefaultL2UpgradeOutput, InitializeBridgeOutput},
output::{
ConsensusRegistryOutput, DefaultL2UpgradeOutput, InitializeBridgeOutput,
Multicall3Output,
},
},
script_params::DEPLOY_L2_CONTRACTS_SCRIPT_PARAMS,
},
Expand Down Expand Up @@ -205,6 +208,7 @@ pub async fn deploy_l2_contracts(
contracts_config.set_l2_shared_bridge(&InitializeBridgeOutput::read(shell, out)?)?;
contracts_config.set_default_l2_upgrade(&DefaultL2UpgradeOutput::read(shell, out)?)?;
contracts_config.set_consensus_registry(&ConsensusRegistryOutput::read(shell, out)?)?;
contracts_config.set_multicall3(&Multicall3Output::read(shell, out)?)?;
Ok(())
},
)
Expand Down

0 comments on commit 6d4090f

Please sign in to comment.