Skip to content

Commit 94b5d31

Browse files
authored
fix: forge create to use config values for verify preflight check (#6467)
1 parent 494acc7 commit 94b5d31

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

crates/forge/bin/cmd/create.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl CreateArgs {
172172
) -> Result<()> {
173173
// NOTE: this does not represent the same `VerifyArgs` that would be sent after deployment,
174174
// since we don't know the address yet.
175-
let verify = verify::VerifyArgs {
175+
let mut verify = verify::VerifyArgs {
176176
address: Default::default(),
177177
contract: self.contract.clone(),
178178
compiler_version: None,
@@ -193,6 +193,13 @@ impl CreateArgs {
193193
verifier: self.verifier.clone(),
194194
show_standard_json_input: self.show_standard_json_input,
195195
};
196+
197+
// Check config for Etherscan API Keys to avoid preflight check failing if no
198+
// ETHERSCAN_API_KEY value set.
199+
let config = verify.load_config_emit_warnings();
200+
verify.etherscan.key =
201+
config.get_etherscan_config_with_chain(Some(chain.into()))?.map(|c| c.key);
202+
196203
verify.verification_provider()?.preflight_check(verify).await?;
197204
Ok(())
198205
}

0 commit comments

Comments
 (0)