Skip to content

Commit

Permalink
Changes after review: use EtherscanOpts, remove shor -e from evm_version
Browse files Browse the repository at this point in the history
  • Loading branch information
grandizzy committed Nov 11, 2024
1 parent 12bbe9e commit efb33c9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions crates/cast/bin/cmd/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cast::revm::primitives::EnvWithHandlerCfg;
use clap::Parser;
use eyre::{Result, WrapErr};
use foundry_cli::{
opts::RpcOpts,
opts::{EtherscanOpts, RpcOpts},
utils::{handle_traces, init_progress, TraceResult},
};
use foundry_common::{is_known_system_sender, SYSTEM_TRANSACTION_TYPE};
Expand Down Expand Up @@ -59,16 +59,16 @@ pub struct RunArgs {
label: Vec<String>,

/// Etherscan API key.
#[arg(long)]
pub etherscan_api_key: Option<String>,
#[command(flatten)]
etherscan: EtherscanOpts,

#[command(flatten)]
rpc: RpcOpts,

/// The EVM version to use.
///
/// Overrides the version specified in the config.
#[arg(long, short)]
#[arg(long)]
evm_version: Option<EvmVersion>,

/// Sets the number of assumed available compute units per second for this provider
Expand Down Expand Up @@ -102,7 +102,6 @@ impl RunArgs {
let figment = Into::<Figment>::into(&self.rpc).merge(&self);
let evm_opts = figment.extract::<EvmOpts>()?;
let mut config = Config::try_from(figment)?.sanitized();
config.etherscan_api_key = self.etherscan_api_key;

let compute_units_per_second =
if self.no_rate_limit { Some(u64::MAX) } else { self.compute_units_per_second };
Expand Down Expand Up @@ -274,6 +273,10 @@ impl figment::Provider for RunArgs {
map.insert("alphanet".into(), self.alphanet.into());
}

if let Some(etherscan_key) = &self.etherscan.key {
map.insert("etherscan_api_key".into(), etherscan_key.as_str().into());
}

if let Some(evm_version) = self.evm_version {
map.insert("evm_version".into(), figment::value::Value::serialize(evm_version)?);
}
Expand Down

0 comments on commit efb33c9

Please sign in to comment.