@@ -41,8 +41,8 @@ static DRPC_KEYS: LazyLock<Vec<&'static str>> = LazyLock::new(|| {
41
41
] )
42
42
} ) ;
43
43
44
- // List of etherscan keys for mainnet
45
- static ETHERSCAN_MAINNET_KEYS : LazyLock < Vec < & ' static str > > = LazyLock :: new ( || {
44
+ // List of etherscan keys.
45
+ static ETHERSCAN_KEYS : LazyLock < Vec < & ' static str > > = LazyLock :: new ( || {
46
46
shuffled ( vec ! [
47
47
"MCAUM7WPE9XP5UQMZPCKIBUJHPM1C24FP6" ,
48
48
"JW6RWCG2C5QF8TANH4KC7AYIF1CX7RB5D1" ,
@@ -54,8 +54,6 @@ static ETHERSCAN_MAINNET_KEYS: LazyLock<Vec<&'static str>> = LazyLock::new(|| {
54
54
"A15KZUMZXXCK1P25Y1VP1WGIVBBHIZDS74" ,
55
55
"3IA6ASNQXN8WKN7PNFX7T72S9YG56X9FPG" ,
56
56
"ZUB97R31KSYX7NYVW6224Q6EYY6U56H591" ,
57
- // Optimism
58
- // "JQNGFHINKS1W7Y5FRXU4SPBYF43J3NYK46",
59
57
] )
60
58
} ) ;
61
59
@@ -139,7 +137,7 @@ fn archive_urls(is_ws: bool) -> &'static [String] {
139
137
140
138
/// Returns the next etherscan api key.
141
139
pub fn next_etherscan_api_key ( ) -> String {
142
- let key = next ( & ETHERSCAN_MAINNET_KEYS ) . to_string ( ) ;
140
+ let key = next ( & ETHERSCAN_KEYS ) . to_string ( ) ;
143
141
eprintln ! ( "--- next_etherscan_api_key() = {key} ---" ) ;
144
142
key
145
143
}
@@ -188,6 +186,7 @@ fn next_url(is_ws: bool, chain: NamedChain) -> String {
188
186
mod tests {
189
187
use super :: * ;
190
188
use alloy_primitives:: address;
189
+ use foundry_block_explorers:: EtherscanApiVersion ;
191
190
use foundry_config:: Chain ;
192
191
193
192
#[ tokio:: test]
@@ -196,7 +195,7 @@ mod tests {
196
195
let address = address ! ( "0xdAC17F958D2ee523a2206206994597C13D831ec7" ) ;
197
196
let mut first_abi = None ;
198
197
let mut failed = Vec :: new ( ) ;
199
- for ( i, & key) in ETHERSCAN_MAINNET_KEYS . iter ( ) . enumerate ( ) {
198
+ for ( i, & key) in ETHERSCAN_KEYS . iter ( ) . enumerate ( ) {
200
199
println ! ( "trying key {i} ({key})" ) ;
201
200
202
201
let client = foundry_block_explorers:: Client :: builder ( )
@@ -231,4 +230,32 @@ mod tests {
231
230
panic ! ( "failed keys: {failed:#?}" ) ;
232
231
}
233
232
}
233
+
234
+ #[ tokio:: test]
235
+ #[ ignore = "run manually" ]
236
+ async fn test_etherscan_keys_compatibility ( ) {
237
+ let address = address ! ( "0x111111125421cA6dc452d289314280a0f8842A65" ) ;
238
+ let ehterscan_key = "JQNGFHINKS1W7Y5FRXU4SPBYF43J3NYK46" ;
239
+ let client = foundry_block_explorers:: Client :: builder ( )
240
+ . with_api_key ( ehterscan_key)
241
+ . chain ( Chain :: optimism_mainnet ( ) )
242
+ . unwrap ( )
243
+ . build ( )
244
+ . unwrap ( ) ;
245
+ if client. contract_abi ( address) . await . is_ok ( ) {
246
+ panic ! ( "v1 Optimisim key should not work with v2 version" )
247
+ }
248
+
249
+ let client = foundry_block_explorers:: Client :: builder ( )
250
+ . with_api_key ( ehterscan_key)
251
+ . with_api_version ( EtherscanApiVersion :: V1 )
252
+ . chain ( Chain :: optimism_mainnet ( ) )
253
+ . unwrap ( )
254
+ . build ( )
255
+ . unwrap ( ) ;
256
+ match client. contract_abi ( address) . await {
257
+ Ok ( _) => { }
258
+ Err ( _) => panic ! ( "v1 Optimisim key should work with v1 version" ) ,
259
+ } ;
260
+ }
234
261
}
0 commit comments