@@ -267,9 +267,8 @@ impl EtherscanVerificationProvider {
267267 || ( verifier_type. is_sourcify ( ) && etherscan_key. is_some ( ) ) ;
268268 let etherscan_config = config. get_etherscan_config_with_chain ( Some ( chain) ) ?;
269269
270- let etherscan_api_url = verifier_url. or ( None ) . map ( str:: to_owned) ;
271-
272- let api_url = etherscan_api_url. as_deref ( ) ;
270+ let api_url =
271+ verifier_url. or_else ( || etherscan_config. as_ref ( ) . map ( |c| c. api_url . as_str ( ) ) ) ;
273272 let base_url = etherscan_config
274273 . as_ref ( )
275274 . and_then ( |c| c. browser_url . as_deref ( ) )
@@ -492,10 +491,8 @@ mod tests {
492491
493492 let etherscan = EtherscanVerificationProvider :: default ( ) ;
494493 let client = etherscan. client ( & args. etherscan , & args. verifier , & config) . unwrap ( ) ;
495- assert_eq ! (
496- client. etherscan_api_url( ) . as_str( ) ,
497- "https://api.etherscan.io/v2/api?chainid=80002"
498- ) ;
494+ // Custom URL from foundry.toml should be used
495+ assert_eq ! ( client. etherscan_api_url( ) . as_str( ) , "https://amoy.polygonscan.com/" ) ;
499496
500497 assert ! ( format!( "{client:?}" ) . contains( "dummykey" ) ) ;
501498
@@ -552,10 +549,8 @@ mod tests {
552549
553550 let client = etherscan. client ( & args. etherscan , & args. verifier , & config) . unwrap ( ) ;
554551
555- assert_eq ! (
556- client. etherscan_api_url( ) . as_str( ) ,
557- "https://api.etherscan.io/v2/api?chainid=80002"
558- ) ;
552+ // Custom URL from foundry.toml should be used
553+ assert_eq ! ( client. etherscan_api_url( ) . as_str( ) , "https://amoy.polygonscan.com/" ) ;
559554 assert ! ( format!( "{client:?}" ) . contains( "dummykey" ) ) ;
560555
561556 let args: VerifyArgs = VerifyArgs :: parse_from ( [
0 commit comments