Skip to content

Commit

Permalink
Preload chain config for set_token_multiplier_setter
Browse files Browse the repository at this point in the history
  • Loading branch information
matias-gonz committed Nov 22, 2024
1 parent 82b028c commit 4cb7a60
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion zkstack_cli/crates/zkstack/src/commands/chain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub(crate) async fn run(shell: &Shell, cmd: ChainCommands) -> anyhow::Result<()>
}
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@ 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;
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},
};
Expand All @@ -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
Expand All @@ -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(),
Expand Down

0 comments on commit 4cb7a60

Please sign in to comment.