Skip to content

Commit 0880384

Browse files
committed
cargo fmt
1 parent 2f356f9 commit 0880384

5 files changed

Lines changed: 25 additions & 16 deletions

File tree

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use log::{Level, error, warn};
44
use std::env::var;
55
use std::process::exit;
66

7-
use deterministic_deployer_evm::utils::print_intro::print_intro_log;
87
use deterministic_deployer_evm::client::wallet_client::create_deployers;
98
use deterministic_deployer_evm::data::contracts::create_contract_spec_from_args;
109
use deterministic_deployer_evm::helpers::contract_searcher::resolve_contract;
@@ -16,6 +15,7 @@ use deterministic_deployer_evm::types::constants::Constants;
1615
use deterministic_deployer_evm::types::errors::CliError;
1716
use deterministic_deployer_evm::utils::create_keystore::load_or_create_keystore;
1817
use deterministic_deployer_evm::utils::deploy::run_deployments;
18+
use deterministic_deployer_evm::utils::print_intro::print_intro_log;
1919
use deterministic_deployer_evm::utils::read_buf::parse_args;
2020
use deterministic_deployer_evm::utils::verifier::run_verifications;
2121

src/utils/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ pub mod create_keystore;
44
pub mod deploy;
55
pub mod init_explorers;
66
pub mod init_rpc;
7+
pub mod print_intro;
78
pub mod read_buf;
89
pub mod verifier;
9-
pub mod print_intro;

src/utils/print_intro.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const INTRO: &str = r"
2424
(_______| |_______)
2525
";
2626

27-
2827
pub fn print_intro_log() {
2928
println!("\x1b[32m{INTRO}\x1b[0m");
30-
}
29+
}

src/utils/read_buf.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,9 @@ fn print_usage() {
289289
eprintln!(" --address <hex> Contract address (hex, with or without 0x)");
290290
eprintln!(" --verify Enable contract verification");
291291
eprintln!(" --keystore Create and use an encrypted keystore");
292-
eprintln!(" --source-chain <chain> Chain with verified source (for cross-chain verification)");
292+
eprintln!(
293+
" --source-chain <chain> Chain with verified source (for cross-chain verification)"
294+
);
293295
eprintln!(
294296
" --constructor-args <hex> ABI-encoded constructor arguments (hex, with or without 0x)"
295297
);

src/utils/verifier.rs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
use serde_json::{Map, Value, from_str};
12
use std::borrow::Cow;
23
use std::env::var;
34
use std::fs::read_to_string;
45
use std::process::Command;
56
use std::process::Output;
67
use std::sync::Arc;
78
use std::time::Duration;
8-
use serde_json::{Value, Map, from_str};
99

1010
use alloy::primitives::{Address, hex};
1111
use alloy::transports::http::reqwest;
@@ -14,7 +14,10 @@ use log::{error, info, warn};
1414
use tokio::task::{JoinSet, spawn_blocking};
1515
use tokio::time::sleep;
1616

17-
use crate::types::config::{Chain, ContractSpec, EtherscanResponse, PublicClient, WalletClient, SourceCodeResult, GetSourceCodeResponse};
17+
use crate::types::config::{
18+
Chain, ContractSpec, EtherscanResponse, GetSourceCodeResponse, PublicClient, SourceCodeResult,
19+
WalletClient,
20+
};
1821
use crate::types::constants::Constants;
1922
use crate::types::errors::VerifierError;
2023

@@ -25,10 +28,7 @@ fn find_contract_file(source_json: &str, contract_name: &str) -> Option<String>
2528
let parsed: Value = from_str(source_json).ok()?;
2629
let sources: &Map<String, Value> = parsed.get("sources")?.as_object()?;
2730
let suffix: String = format!("{contract_name}.sol");
28-
sources
29-
.keys()
30-
.find(|k| k.ends_with(&suffix))
31-
.cloned()
31+
sources.keys().find(|k| k.ends_with(&suffix)).cloned()
3232
}
3333

3434
async fn fetch_verified_source(
@@ -53,22 +53,30 @@ async fn fetch_verified_source(
5353
.map_err(|e| VerifierError::HttpError(name, e.to_string()))?;
5454

5555
if resp.status != "1" || resp.result.is_empty() {
56-
return Err(VerifierError::NotVerifiedOnSource(format!("chain_id {chain_id}")));
56+
return Err(VerifierError::NotVerifiedOnSource(format!(
57+
"chain_id {chain_id}"
58+
)));
5759
}
5860

59-
let mut source: SourceCodeResult = resp.result.into_iter().next()
61+
let mut source: SourceCodeResult = resp
62+
.result
63+
.into_iter()
64+
.next()
6065
.ok_or_else(|| VerifierError::NotVerifiedOnSource(format!("chain_id {chain_id}")))?;
6166

6267
if source.source_code.is_empty() || source.contract_name.is_empty() {
63-
return Err(VerifierError::NotVerifiedOnSource(format!("chain_id {chain_id}")));
68+
return Err(VerifierError::NotVerifiedOnSource(format!(
69+
"chain_id {chain_id}"
70+
)));
6471
}
6572

6673
if source.source_code.starts_with("{{") && source.source_code.ends_with("}}") {
6774
source.source_code = source.source_code[1..source.source_code.len() - 1].to_string();
6875
}
6976

7077
if !source.contract_name.contains(':') {
71-
let contract_file: Option<String> = find_contract_file(&source.source_code, &source.contract_name);
78+
let contract_file: Option<String> =
79+
find_contract_file(&source.source_code, &source.contract_name);
7280
if let Some(file) = contract_file {
7381
source.contract_name = format!("{file}:{}", source.contract_name);
7482
}
@@ -479,4 +487,4 @@ pub async fn run_verifications(
479487
error!("Verification task panicked: {e}");
480488
}
481489
}
482-
}
490+
}

0 commit comments

Comments
 (0)