Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: forge create to use config values for verify preflight check #6467

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion crates/forge/bin/cmd/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl CreateArgs {
) -> Result<()> {
// NOTE: this does not represent the same `VerifyArgs` that would be sent after deployment,
// since we don't know the address yet.
let verify = verify::VerifyArgs {
let mut verify = verify::VerifyArgs {
address: Default::default(),
contract: self.contract.clone(),
compiler_version: None,
Expand All @@ -192,6 +192,13 @@ impl CreateArgs {
verifier: self.verifier.clone(),
show_standard_json_input: self.show_standard_json_input,
};

// Check config for Etherscan API Keys to avoid preflight check failing if no
// ETHERSCAN_API_KEY value set.
let config = verify.load_config_emit_warnings();
verify.etherscan.key =
config.get_etherscan_config_with_chain(Some(chain.into()))?.map(|c| c.key);

verify.verification_provider()?.preflight_check(verify).await?;
Ok(())
}
Expand Down