File tree Expand file tree Collapse file tree 3 files changed +27
-7
lines changed Expand file tree Collapse file tree 3 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,11 @@ pub enum EtherscanConfigError {
53
53
#[ error( transparent) ]
54
54
Unresolved ( #[ from] UnresolvedEnvVarError ) ,
55
55
56
- #[ error( "No known Etherscan API URL for config{0} with chain `{1}`. Please specify a `url`" ) ]
56
+ #[ error(
57
+ "No known Etherscan API URL for chain `{1}`. To fix this, please:\n
58
+ 1. Specify a `url` {0}\n
59
+ 2. Verify the chain `{1}` is correct"
60
+ ) ]
57
61
UnknownChain ( String , Chain ) ,
58
62
59
63
#[ error( "At least one of `url` or `chain` must be present{0}" ) ]
@@ -233,7 +237,7 @@ impl EtherscanConfig {
233
237
} ) ,
234
238
( Some ( chain) , None ) => ResolvedEtherscanConfig :: create ( key, chain, api_version)
235
239
. ok_or_else ( || {
236
- let msg = alias. map ( |a| format ! ( " `{a}`" ) ) . unwrap_or_default ( ) ;
240
+ let msg = alias. map ( |a| format ! ( "for `{a}`" ) ) . unwrap_or_default ( ) ;
237
241
EtherscanConfigError :: UnknownChain ( msg, chain)
238
242
} ) ,
239
243
( None , Some ( api_url) ) => Ok ( ResolvedEtherscanConfig {
Original file line number Diff line number Diff line change @@ -1429,13 +1429,20 @@ impl Config {
1429
1429
1430
1430
// etherscan fallback via API key
1431
1431
if let Some ( key) = self . etherscan_api_key . as_ref ( ) {
1432
- return Ok ( ResolvedEtherscanConfig :: create (
1432
+ match ResolvedEtherscanConfig :: create (
1433
1433
key,
1434
1434
chain. or ( self . chain ) . unwrap_or_default ( ) ,
1435
1435
default_api_version,
1436
- ) ) ;
1436
+ ) {
1437
+ Some ( config) => return Ok ( Some ( config) ) ,
1438
+ None => {
1439
+ return Err ( EtherscanConfigError :: UnknownChain (
1440
+ "" . to_string ( ) ,
1441
+ chain. unwrap_or_default ( ) ,
1442
+ ) ) ;
1443
+ }
1444
+ }
1437
1445
}
1438
-
1439
1446
Ok ( None )
1440
1447
}
1441
1448
Original file line number Diff line number Diff line change @@ -320,7 +320,11 @@ impl VerifyArgs {
320
320
. unwrap_or_default ( ) ;
321
321
322
322
if unique_versions. is_empty ( ) {
323
- eyre:: bail!( "No matching artifact found for {}" , contract. name) ;
323
+ eyre:: bail!(
324
+ "No matching artifact found for {}. This could be due to:\n \
325
+ - Compiler version mismatch - the contract was compiled with a different Solidity version than what's being used for verification",
326
+ contract. name
327
+ ) ;
324
328
} else if unique_versions. len ( ) > 1 {
325
329
warn ! (
326
330
"Ambiguous compiler versions found in cache: {}" ,
@@ -372,7 +376,12 @@ impl VerifyArgs {
372
376
. unwrap_or_default ( ) ;
373
377
374
378
if profiles. is_empty ( ) {
375
- eyre:: bail!( "No matching artifact found for {}" , contract. name) ;
379
+ eyre:: bail!(
380
+ "No matching artifact found for {} with compiler version {}. This could be due to:\n \
381
+ - Compiler version mismatch - the contract was compiled with a different Solidity version",
382
+ contract. name,
383
+ version
384
+ ) ;
376
385
} else if profiles. len ( ) > 1 {
377
386
eyre:: bail!(
378
387
"Ambiguous compilation profiles found in cache: {}, please specify the profile through `--compilation-profile` flag" ,
You can’t perform that action at this time.
0 commit comments