Skip to content

Commit

Permalink
feat(forge): add --evm-version to verify-contract
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Feb 19, 2024
1 parent 2303c2d commit b562333
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion crates/cast/bin/cmd/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ pub struct RunArgs {
#[clap(flatten)]
rpc: RpcOpts,

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

/// Sets the number of assumed available compute units per second for this provider
///
/// default value: 330
Expand Down
2 changes: 2 additions & 0 deletions crates/forge/bin/cmd/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ impl CreateArgs {
root: None,
verifier: self.verifier.clone(),
via_ir: self.opts.via_ir,
evm_version: self.opts.compiler.evm_version,
show_standard_json_input: self.show_standard_json_input,
};

Expand Down Expand Up @@ -334,6 +335,7 @@ impl CreateArgs {
root: None,
verifier: self.verifier,
via_ir: self.opts.via_ir,
evm_version: self.opts.compiler.evm_version,
show_standard_json_input: self.show_standard_json_input,
};
println!("Waiting for {} to detect contract deployment...", verify.verifier.verifier);
Expand Down
1 change: 1 addition & 0 deletions crates/forge/bin/cmd/script/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ impl VerifyBundle {
root: None,
verifier: self.verifier.clone(),
via_ir: self.via_ir,
evm_version: None,
show_standard_json_input: false,
};

Expand Down
11 changes: 10 additions & 1 deletion crates/forge/bin/cmd/verify/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use alloy_primitives::Address;
use clap::{Parser, ValueHint};
use eyre::Result;
use foundry_cli::{opts::EtherscanOpts, utils::LoadConfig};
use foundry_compilers::info::ContractInfo;
use foundry_compilers::{info::ContractInfo, EvmVersion};
use foundry_config::{figment, impl_figment_convert, impl_figment_convert_cast, Config};
use provider::VerificationProviderType;
use reqwest::Url;
Expand Down Expand Up @@ -103,6 +103,12 @@ pub struct VerifyArgs {
#[clap(long)]
pub via_ir: bool,

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

#[clap(flatten)]
pub etherscan: EtherscanOpts,

Expand Down Expand Up @@ -134,6 +140,9 @@ impl figment::Provider for VerifyArgs {
figment::value::Value::serialize(optimizer_runs)?,
);
}
if let Some(evm_version) = self.evm_version {
dict.insert("evm_version".to_string(), figment::value::Value::serialize(evm_version)?);
}
if self.via_ir {
dict.insert("via_ir".to_string(), figment::value::Value::serialize(self.via_ir)?);
}
Expand Down

0 comments on commit b562333

Please sign in to comment.