Skip to content

Commit

Permalink
load_current_chain
Browse files Browse the repository at this point in the history
  • Loading branch information
sanekmelnikov committed Oct 1, 2024
1 parent 006f827 commit 7e084a2
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Context;
use common::{config::global_config, forge::ForgeScriptArgs, logger, spinner::Spinner};
use common::{forge::ForgeScriptArgs, logger, spinner::Spinner};
use config::EcosystemConfig;
use xshell::Shell;

Expand All @@ -12,10 +12,9 @@ use crate::{
};

pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> {
let chain_name = global_config().chain_name.clone();
let ecosystem_config = EcosystemConfig::from_file(shell)?;
let chain_config = ecosystem_config
.load_chain(chain_name)
.load_current_chain()
.context(MSG_CHAIN_NOT_INITIALIZED)?;
let contracts = chain_config.get_contracts_config()?;
let secrets = chain_config.get_secrets_config()?;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Context;
use clap::{command, Parser, Subcommand};
use common::{config::global_config, logger, spinner::Spinner};
use common::{logger, spinner::Spinner};
use config::{ChainConfig, EcosystemConfig};
use xshell::Shell;

Expand Down Expand Up @@ -46,10 +46,9 @@ pub(crate) async fn run(args: GenesisCommand, shell: &Shell) -> anyhow::Result<(
}

pub async fn run_genesis(args: GenesisArgs, shell: &Shell) -> anyhow::Result<()> {
let chain_name = global_config().chain_name.clone();
let ecosystem_config = EcosystemConfig::from_file(shell)?;
let chain_config = ecosystem_config
.load_chain(chain_name)
.load_current_chain()
.context(MSG_CHAIN_NOT_INITIALIZED)?;
let args = args.fill_values_with_prompt(&chain_config);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use anyhow::Context;
use common::{
config::global_config,
logger,
server::{Server, ServerMode},
spinner::Spinner,
Expand All @@ -17,10 +16,9 @@ use crate::messages::{
};

pub async fn run(shell: &Shell) -> anyhow::Result<()> {
let chain_name = global_config().chain_name.clone();
let ecosystem_config = EcosystemConfig::from_file(shell)?;
let chain_config = ecosystem_config
.load_chain(chain_name)
.load_current_chain()
.context(MSG_CHAIN_NOT_INITIALIZED)?;

let spinner = Spinner::new(MSG_STARTING_GENESIS_SPINNER);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Context;
use common::{config::global_config, logger};
use common::logger;
use config::{
copy_configs, set_l1_rpc_url, update_from_chain_config,
ChainConfig, ContractsConfig, EcosystemConfig,
Expand Down Expand Up @@ -29,10 +29,9 @@ use crate::{
};

pub async fn run(args: InitConfigsArgs, shell: &Shell) -> anyhow::Result<()> {
let chain_name = global_config().chain_name.clone();
let ecosystem_config = EcosystemConfig::from_file(shell)?;
let chain_config = ecosystem_config
.load_chain(chain_name)
.load_current_chain()
.context(MSG_CHAIN_NOT_FOUND_ERR)?;
let args = args.fill_values_with_prompt(&chain_config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ pub async fn init(
spinner.finish();
}

// Deploy L2 contracts: L2 Shared Bridge, L2 Default Upgrader, etc. (run by L2 Governor)
// Deploy L2 contracts: L2SharedBridge, L2DefaultUpgrader, ... (run by L1 Governor)
deploy_l2_contracts::deploy_l2_contracts(
shell,
chain_config,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use anyhow::Context;
use common::{
config::global_config,
forge::{Forge, ForgeScriptArgs},
logger,
spinner::Spinner,
Expand All @@ -24,10 +23,9 @@ use crate::{
};

pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> {
let chain_name = global_config().chain_name.clone();
let ecosystem_config = EcosystemConfig::from_file(shell)?;
let chain_config = ecosystem_config
.load_chain(chain_name)
.load_current_chain()
.context(MSG_CHAIN_NOT_INITIALIZED)?;
let mut contracts = chain_config.get_contracts_config()?;
let secrets = chain_config.get_secrets_config()?;
Expand Down

0 comments on commit 7e084a2

Please sign in to comment.