diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/accept_chain_ownership.rs b/zkstack_cli/crates/zkstack/src/commands/chain/accept_chain_ownership.rs index d107ccd75dd7..b98d81581272 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/accept_chain_ownership.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/accept_chain_ownership.rs @@ -1,23 +1,19 @@ use anyhow::Context; use common::{forge::ForgeScriptArgs, logger, spinner::Spinner}; -use config::zkstack_config::ZkStackConfig; +use config::ChainConfig; use xshell::Shell; use crate::{ accept_ownership::accept_admin, messages::{ - MSG_ACCEPTING_ADMIN_SPINNER, MSG_CHAIN_NOT_INITIALIZED, MSG_CHAIN_OWNERSHIP_TRANSFERRED, + MSG_ACCEPTING_ADMIN_SPINNER, MSG_CHAIN_OWNERSHIP_TRANSFERRED, MSG_L1_SECRETS_MUST_BE_PRESENTED, }, }; -pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> { - let ecosystem_config = ZkStackConfig::ecosystem(shell)?; - let chain_config = ecosystem_config - .load_current_chain() - .context(MSG_CHAIN_NOT_INITIALIZED)?; - let contracts = chain_config.get_contracts_config()?; - let secrets = chain_config.get_secrets_config()?; +pub async fn run(args: ForgeScriptArgs, shell: &Shell, chain: ChainConfig) -> anyhow::Result<()> { + let contracts = chain.get_contracts_config()?; + let secrets = chain.get_secrets_config()?; let l1_rpc_url = secrets .l1 .context(MSG_L1_SECRETS_MUST_BE_PRESENTED)? @@ -28,9 +24,9 @@ pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> { let spinner = Spinner::new(MSG_ACCEPTING_ADMIN_SPINNER); accept_admin( shell, - &chain_config.path_to_foundry(), + &chain.path_to_foundry(), contracts.l1.chain_admin_addr, - &chain_config.get_wallets_config()?.governor, + &chain.get_wallets_config()?.governor, contracts.l1.diamond_proxy_addr, &args, l1_rpc_url.clone(), diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs b/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs index 313b3a509050..f40472e4b8b1 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs @@ -1,8 +1,8 @@ use anyhow::Context; use common::{git, logger, spinner::Spinner}; use config::{ - copy_configs, traits::SaveConfigWithBasePath, update_from_chain_config, - zkstack_config::ZkStackConfig, + copy_configs, traits::SaveConfigWithBasePath, update_from_chain_config, ChainConfig, + EcosystemConfig, }; use ethers::utils::hex::ToHex; use xshell::Shell; @@ -12,9 +12,9 @@ use crate::{ args::build_transactions::BuildTransactionsArgs, register_chain::register_chain, }, messages::{ - MSG_BUILDING_CHAIN_REGISTRATION_TXNS_SPINNER, MSG_CHAIN_NOT_FOUND_ERR, - MSG_CHAIN_TRANSACTIONS_BUILT, MSG_CHAIN_TXN_MISSING_CONTRACT_CONFIG, - MSG_CHAIN_TXN_OUT_PATH_INVALID_ERR, MSG_PREPARING_CONFIG_SPINNER, MSG_SELECTED_CONFIG, + MSG_BUILDING_CHAIN_REGISTRATION_TXNS_SPINNER, MSG_CHAIN_TRANSACTIONS_BUILT, + MSG_CHAIN_TXN_MISSING_CONTRACT_CONFIG, MSG_CHAIN_TXN_OUT_PATH_INVALID_ERR, + MSG_ECOSYSTEM_CONFIG_INVALID_ERR, MSG_PREPARING_CONFIG_SPINNER, MSG_SELECTED_CONFIG, MSG_WRITING_OUTPUT_FILES_SPINNER, }, }; @@ -27,39 +27,41 @@ const SCRIPT_CONFIG_FILE_SRC: &str = "contracts/l1-contracts/script-config/register-hyperchain.toml"; const SCRIPT_CONFIG_FILE_DST: &str = "register-hyperchain.toml"; -pub(crate) async fn run(args: BuildTransactionsArgs, shell: &Shell) -> anyhow::Result<()> { - let config = ZkStackConfig::ecosystem(shell)?; - let chain_config = config - .load_current_chain() - .context(MSG_CHAIN_NOT_FOUND_ERR)?; +pub(crate) async fn run( + args: BuildTransactionsArgs, + shell: &Shell, + chain: ChainConfig, + ecosystem: Option, +) -> anyhow::Result<()> { + let ecosystem = ecosystem.context(MSG_ECOSYSTEM_CONFIG_INVALID_ERR)?; - let args = args.fill_values_with_prompt(config.default_chain.clone()); + let args = args.fill_values_with_prompt(ecosystem.default_chain.clone()); - git::submodule_update(shell, config.link_to_code.clone())?; + git::submodule_update(shell, ecosystem.link_to_code.clone())?; let spinner = Spinner::new(MSG_PREPARING_CONFIG_SPINNER); - copy_configs(shell, &config.link_to_code, &chain_config.configs)?; + copy_configs(shell, &ecosystem.link_to_code, &chain.configs)?; - logger::note(MSG_SELECTED_CONFIG, logger::object_to_string(&chain_config)); + logger::note(MSG_SELECTED_CONFIG, logger::object_to_string(&chain)); - let mut genesis_config = chain_config.get_genesis_config()?; - update_from_chain_config(&mut genesis_config, &chain_config)?; + let mut genesis_config = chain.get_genesis_config()?; + update_from_chain_config(&mut genesis_config, &chain)?; // Copy ecosystem contracts - let mut contracts_config = config + let mut contracts_config = ecosystem .get_contracts_config() .context(MSG_CHAIN_TXN_MISSING_CONTRACT_CONFIG)?; - contracts_config.l1.base_token_addr = chain_config.base_token.address; + contracts_config.l1.base_token_addr = chain.base_token.address; spinner.finish(); let spinner = Spinner::new(MSG_BUILDING_CHAIN_REGISTRATION_TXNS_SPINNER); - let wallets = config.get_wallets()?; + let wallets = ecosystem.get_wallets()?; let governor: String = wallets.governor.address.encode_hex_upper(); register_chain( shell, args.forge_args.clone(), - &chain_config, + &chain, &mut contracts_config, &wallets, args.l1_rpc_url.clone(), @@ -77,12 +79,12 @@ pub(crate) async fn run(args: BuildTransactionsArgs, shell: &Shell) -> anyhow::R .context(MSG_CHAIN_TXN_OUT_PATH_INVALID_ERR)?; shell.copy_file( - config.link_to_code.join(REGISTER_CHAIN_TXNS_FILE_SRC), + ecosystem.link_to_code.join(REGISTER_CHAIN_TXNS_FILE_SRC), args.out.join(REGISTER_CHAIN_TXNS_FILE_DST), )?; shell.copy_file( - config.link_to_code.join(SCRIPT_CONFIG_FILE_SRC), + ecosystem.link_to_code.join(SCRIPT_CONFIG_FILE_SRC), args.out.join(SCRIPT_CONFIG_FILE_DST), )?; spinner.finish(); diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs b/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs index 01536afeaf1f..e483511b89ef 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs @@ -18,17 +18,13 @@ use config::{ script_params::DEPLOY_L2_CONTRACTS_SCRIPT_PARAMS, }, traits::{ReadConfig, SaveConfig, SaveConfigWithBasePath}, - zkstack_config::ZkStackConfig, - ChainConfig, ContractsConfig, WalletsConfig, + ChainConfig, ContractsConfig, EcosystemConfig, WalletsConfig, }; use xshell::Shell; use zksync_basic_types::L2ChainId; use crate::{ - messages::{ - MSG_CHAIN_NOT_INITIALIZED, MSG_DEPLOYING_L2_CONTRACT_SPINNER, - MSG_L1_SECRETS_MUST_BE_PRESENTED, - }, + messages::{MSG_DEPLOYING_L2_CONTRACT_SPINNER, MSG_L1_SECRETS_MUST_BE_PRESENTED}, utils::forge::{check_the_balance, fill_forge_private_key}, }; @@ -45,88 +41,40 @@ pub async fn run( args: ForgeScriptArgs, shell: &Shell, deploy_option: Deploy2ContractsOption, + chain: ChainConfig, + ecosystem: EcosystemConfig, ) -> anyhow::Result<()> { - let ecosystem_config = ZkStackConfig::ecosystem(shell)?; - let chain_config = ecosystem_config - .load_current_chain() - .context(MSG_CHAIN_NOT_INITIALIZED)?; - - let mut contracts = chain_config.get_contracts_config()?; - let era_chain_id = ecosystem_config.era_chain_id; - let wallets = ecosystem_config.get_wallets()?; + let mut contracts = chain.get_contracts_config()?; + let era_chain_id = ecosystem.era_chain_id; + let wallets = ecosystem.get_wallets()?; let spinner = Spinner::new(MSG_DEPLOYING_L2_CONTRACT_SPINNER); match deploy_option { Deploy2ContractsOption::All => { - deploy_l2_contracts( - shell, - &chain_config, - era_chain_id, - &wallets, - &mut contracts, - args, - ) - .await?; + deploy_l2_contracts(shell, &chain, era_chain_id, &wallets, &mut contracts, args) + .await?; } Deploy2ContractsOption::Upgrader => { - deploy_upgrader( - shell, - &chain_config, - era_chain_id, - &wallets, - &mut contracts, - args, - ) - .await?; + deploy_upgrader(shell, &chain, era_chain_id, &wallets, &mut contracts, args).await?; } Deploy2ContractsOption::ConsensusRegistry => { - deploy_consensus_registry( - shell, - &chain_config, - era_chain_id, - &wallets, - &mut contracts, - args, - ) - .await?; + deploy_consensus_registry(shell, &chain, era_chain_id, &wallets, &mut contracts, args) + .await?; } Deploy2ContractsOption::Multicall3 => { - deploy_multicall3( - shell, - &chain_config, - era_chain_id, - &wallets, - &mut contracts, - args, - ) - .await?; + deploy_multicall3(shell, &chain, era_chain_id, &wallets, &mut contracts, args).await?; } Deploy2ContractsOption::TimestampAsserter => { - deploy_timestamp_asserter( - shell, - &chain_config, - era_chain_id, - &wallets, - &mut contracts, - args, - ) - .await?; + deploy_timestamp_asserter(shell, &chain, era_chain_id, &wallets, &mut contracts, args) + .await?; } Deploy2ContractsOption::InitiailizeBridges => { - initialize_bridges( - shell, - &chain_config, - era_chain_id, - &wallets, - &mut contracts, - args, - ) - .await? + initialize_bridges(shell, &chain, era_chain_id, &wallets, &mut contracts, args).await? } } - contracts.save_with_base_path(shell, &chain_config.configs)?; + contracts.save_with_base_path(shell, &chain.configs)?; spinner.finish(); Ok(()) diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/init/configs.rs b/zkstack_cli/crates/zkstack/src/commands/chain/init/configs.rs index 9595e91c7e3e..baa05fdd86fd 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/init/configs.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/init/configs.rs @@ -3,9 +3,7 @@ use common::logger; use config::{ copy_configs, set_l1_rpc_url, traits::{ReadConfig, SaveConfigWithBasePath}, - update_from_chain_config, - zkstack_config::ZkStackConfig, - ChainConfig, ContractsConfig, + update_from_chain_config, ChainConfig, ContractsConfig, EcosystemConfig, }; use ethers::types::Address; use xshell::Shell; @@ -19,7 +17,7 @@ use crate::{ portal::update_portal_config, }, messages::{ - MSG_CHAIN_CONFIGS_INITIALIZED, MSG_CHAIN_NOT_FOUND_ERR, MSG_CONSENSUS_CONFIG_MISSING_ERR, + MSG_CHAIN_CONFIGS_INITIALIZED, MSG_CONSENSUS_CONFIG_MISSING_ERR, MSG_PORTAL_FAILED_TO_CREATE_CONFIG_ERR, }, utils::{ @@ -28,12 +26,15 @@ use crate::{ }, }; -pub async fn run(args: InitConfigsArgs, shell: &Shell) -> anyhow::Result<()> { - let ecosystem_config = ZkStackConfig::ecosystem(shell)?; - let chain_config = ZkStackConfig::current_chain(shell).context(MSG_CHAIN_NOT_FOUND_ERR)?; - let args = args.fill_values_with_prompt(Some(ecosystem_config), &chain_config)?; +pub async fn run( + args: InitConfigsArgs, + shell: &Shell, + chain: ChainConfig, + ecosystem: Option, +) -> anyhow::Result<()> { + let args = args.fill_values_with_prompt(ecosystem, &chain)?; - init_configs(&args, shell, &chain_config).await?; + init_configs(&args, shell, &chain).await?; logger::outro(MSG_CHAIN_CONFIGS_INITIALIZED); Ok(()) diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs b/zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs index 9a61600b37d5..51f2d5c615b0 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs @@ -4,7 +4,6 @@ use common::{git, logger, spinner::Spinner}; use config::{ get_default_era_chain_id, traits::{ReadConfig, SaveConfigWithBasePath}, - zkstack_config::ZkStackConfig, ChainConfig, EcosystemConfig, WalletsConfig, }; use types::BaseToken; @@ -27,10 +26,9 @@ use crate::{ }, messages::{ msg_initializing_chain, MSG_ACCEPTING_ADMIN_SPINNER, MSG_CHAIN_INITIALIZED, - MSG_CHAIN_NOT_FOUND_ERR, MSG_DEPLOYING_PAYMASTER, MSG_GENESIS_DATABASE_ERR, - MSG_REGISTERING_CHAIN_SPINNER, MSG_SELECTED_CONFIG, - MSG_UPDATING_TOKEN_MULTIPLIER_SETTER_SPINNER, MSG_WALLETS_CONFIG_MUST_BE_PRESENT, - MSG_WALLET_TOKEN_MULTIPLIER_SETTER_NOT_FOUND, + MSG_DEPLOYING_PAYMASTER, MSG_GENESIS_DATABASE_ERR, MSG_REGISTERING_CHAIN_SPINNER, + MSG_SELECTED_CONFIG, MSG_UPDATING_TOKEN_MULTIPLIER_SETTER_SPINNER, + MSG_WALLETS_CONFIG_MUST_BE_PRESENT, MSG_WALLET_TOKEN_MULTIPLIER_SETTER_NOT_FOUND, }, }; @@ -52,23 +50,33 @@ pub struct ChainInitCommand { args: InitArgs, } -pub(crate) async fn run(args: ChainInitCommand, shell: &Shell) -> anyhow::Result<()> { +pub(crate) async fn run( + args: ChainInitCommand, + shell: &Shell, + chain: ChainConfig, + ecosystem: Option, +) -> anyhow::Result<()> { match args.command { - Some(ChainInitSubcommands::Configs(args)) => configs::run(args, shell).await, - None => run_init(args.args, shell).await, + Some(ChainInitSubcommands::Configs(args)) => { + configs::run(args, shell, chain, ecosystem).await + } + None => run_init(args.args, shell, chain, ecosystem).await, } } -async fn run_init(args: InitArgs, shell: &Shell) -> anyhow::Result<()> { - let ecosystem = ZkStackConfig::ecosystem(shell).ok(); - let chain_config = ZkStackConfig::current_chain(shell).context(MSG_CHAIN_NOT_FOUND_ERR)?; - let args = args.fill_values_with_prompt(ecosystem.clone(), &chain_config)?; +async fn run_init( + args: InitArgs, + shell: &Shell, + chain: ChainConfig, + ecosystem: Option, +) -> anyhow::Result<()> { + let args = args.fill_values_with_prompt(ecosystem.clone(), &chain)?; - logger::note(MSG_SELECTED_CONFIG, logger::object_to_string(&chain_config)); + logger::note(MSG_SELECTED_CONFIG, logger::object_to_string(&chain)); logger::info(msg_initializing_chain("")); - git::submodule_update(shell, chain_config.link_to_code.clone())?; + git::submodule_update(shell, chain.link_to_code.clone())?; - init(&args, shell, ecosystem, &chain_config).await?; + init(&args, shell, ecosystem, &chain).await?; logger::success(MSG_CHAIN_INITIALIZED); Ok(()) diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs b/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs index 5d0c39851baf..0260cc630713 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs @@ -14,7 +14,7 @@ use crate::{ args::create::ChainCreateArgs, deploy_l2_contracts::Deploy2ContractsOption, genesis::GenesisCommand, init::ChainInitCommand, }, - messages::MSG_CHAIN_NOT_FOUND_ERR, + messages::{MSG_CHAIN_NOT_FOUND_ERR, MSG_ECOSYSTEM_CONFIG_INVALID_ERR}, }; mod accept_chain_ownership; @@ -91,38 +91,85 @@ pub(crate) async fn run(shell: &Shell, cmd: ChainCommands) -> anyhow::Result<()> } let chain = ZkStackConfig::current_chain(shell).context(MSG_CHAIN_NOT_FOUND_ERR)?; + let ecosystem = ZkStackConfig::ecosystem(shell).ok(); match cmd { - ChainCommands::Create(args) => create::run(args, shell), - ChainCommands::Init(args) => init::run(*args, shell).await, - ChainCommands::BuildTransactions(args) => build_transactions::run(args, shell).await, + ChainCommands::Init(args) => init::run(*args, shell, chain, ecosystem).await, + ChainCommands::BuildTransactions(args) => { + build_transactions::run(args, shell, chain, ecosystem).await + } ChainCommands::Genesis(args) => genesis::run(args, shell, chain).await, ChainCommands::RegisterChain(args) => register_chain::run(args, shell).await, ChainCommands::DeployL2Contracts(args) => { - deploy_l2_contracts::run(args, shell, Deploy2ContractsOption::All).await + deploy_l2_contracts::run( + args, + shell, + Deploy2ContractsOption::All, + chain, + ecosystem.context(MSG_ECOSYSTEM_CONFIG_INVALID_ERR)?, + ) + .await + } + ChainCommands::AcceptChainOwnership(args) => { + accept_chain_ownership::run(args, shell, chain).await } - ChainCommands::AcceptChainOwnership(args) => accept_chain_ownership::run(args, shell).await, ChainCommands::DeployConsensusRegistry(args) => { - deploy_l2_contracts::run(args, shell, Deploy2ContractsOption::ConsensusRegistry).await + deploy_l2_contracts::run( + args, + shell, + Deploy2ContractsOption::ConsensusRegistry, + chain, + ecosystem.context(MSG_ECOSYSTEM_CONFIG_INVALID_ERR)?, + ) + .await } ChainCommands::DeployMulticall3(args) => { - deploy_l2_contracts::run(args, shell, Deploy2ContractsOption::Multicall3).await + deploy_l2_contracts::run( + args, + shell, + Deploy2ContractsOption::Multicall3, + chain, + ecosystem.context(MSG_ECOSYSTEM_CONFIG_INVALID_ERR)?, + ) + .await } ChainCommands::DeployTimestampAsserter(args) => { - deploy_l2_contracts::run(args, shell, Deploy2ContractsOption::TimestampAsserter).await + deploy_l2_contracts::run( + args, + shell, + Deploy2ContractsOption::TimestampAsserter, + chain, + ecosystem.context(MSG_ECOSYSTEM_CONFIG_INVALID_ERR)?, + ) + .await } ChainCommands::DeployUpgrader(args) => { - deploy_l2_contracts::run(args, shell, Deploy2ContractsOption::Upgrader).await + deploy_l2_contracts::run( + args, + shell, + Deploy2ContractsOption::Upgrader, + chain, + ecosystem.context(MSG_ECOSYSTEM_CONFIG_INVALID_ERR)?, + ) + .await } ChainCommands::InitializeBridges(args) => { - deploy_l2_contracts::run(args, shell, Deploy2ContractsOption::InitiailizeBridges).await + deploy_l2_contracts::run( + args, + shell, + Deploy2ContractsOption::InitiailizeBridges, + chain, + ecosystem.context(MSG_ECOSYSTEM_CONFIG_INVALID_ERR)?, + ) + .await } ChainCommands::DeployPaymaster(args) => deploy_paymaster::run(args, shell, chain).await, ChainCommands::UpdateTokenMultiplierSetter(args) => { - set_token_multiplier_setter::run(args, shell).await + set_token_multiplier_setter::run(args, shell, chain).await } ChainCommands::Server(args) => server::run(shell, args, chain).await, ChainCommands::ContractVerifier(args) => contract_verifier::run(shell, args, chain).await, ChainCommands::Consensus(cmd) => cmd.run(shell).await, + ChainCommands::Create(_) => unreachable!("Chain create is handled before loading chain"), } } diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/set_token_multiplier_setter.rs b/zkstack_cli/crates/zkstack/src/commands/chain/set_token_multiplier_setter.rs index 644d33e41805..aa52d3e86be1 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/set_token_multiplier_setter.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/set_token_multiplier_setter.rs @@ -7,9 +7,7 @@ use common::{ spinner::Spinner, wallets::Wallet, }; -use config::{ - forge_interface::script_params::ACCEPT_GOVERNANCE_SCRIPT_PARAMS, zkstack_config::ZkStackConfig, -}; +use config::{forge_interface::script_params::ACCEPT_GOVERNANCE_SCRIPT_PARAMS, ChainConfig}; use ethers::{abi::parse_abi, contract::BaseContract, utils::hex}; use lazy_static::lazy_static; use xshell::Shell; @@ -17,9 +15,9 @@ use zksync_basic_types::Address; use crate::{ messages::{ - MSG_CHAIN_NOT_INITIALIZED, MSG_L1_SECRETS_MUST_BE_PRESENTED, - MSG_TOKEN_MULTIPLIER_SETTER_UPDATED_TO, MSG_UPDATING_TOKEN_MULTIPLIER_SETTER_SPINNER, - MSG_WALLETS_CONFIG_MUST_BE_PRESENT, MSG_WALLET_TOKEN_MULTIPLIER_SETTER_NOT_FOUND, + MSG_L1_SECRETS_MUST_BE_PRESENTED, MSG_TOKEN_MULTIPLIER_SETTER_UPDATED_TO, + MSG_UPDATING_TOKEN_MULTIPLIER_SETTER_SPINNER, MSG_WALLETS_CONFIG_MUST_BE_PRESENT, + MSG_WALLET_TOKEN_MULTIPLIER_SETTER_NOT_FOUND, }, utils::forge::{check_the_balance, fill_forge_private_key}, }; @@ -33,20 +31,16 @@ lazy_static! { ); } -pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> { - let ecosystem_config = ZkStackConfig::ecosystem(shell)?; - let chain_config = ecosystem_config - .load_current_chain() - .context(MSG_CHAIN_NOT_INITIALIZED)?; - let contracts_config = chain_config.get_contracts_config()?; - let l1_url = chain_config +pub async fn run(args: ForgeScriptArgs, shell: &Shell, chain: ChainConfig) -> anyhow::Result<()> { + let contracts_config = chain.get_contracts_config()?; + let l1_url = chain .get_secrets_config()? .l1 .context(MSG_L1_SECRETS_MUST_BE_PRESENTED)? .l1_rpc_url .expose_str() .to_string(); - let token_multiplier_setter_address = chain_config + let token_multiplier_setter_address = chain .get_wallets_config() .context(MSG_WALLETS_CONFIG_MUST_BE_PRESENT)? .token_multiplier_setter @@ -56,8 +50,8 @@ pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> { let spinner = Spinner::new(MSG_UPDATING_TOKEN_MULTIPLIER_SETTER_SPINNER); set_token_multiplier_setter( shell, - &chain_config.path_to_foundry(), - &chain_config.get_wallets_config()?.governor, + &chain.path_to_foundry(), + &chain.get_wallets_config()?.governor, contracts_config.l1.chain_admin_addr, token_multiplier_setter_address, &args.clone(),