From 6a0119536bae9e4d28732afdd3f7211c37003469 Mon Sep 17 00:00:00 2001 From: Sonny Scroggin Date: Mon, 20 Nov 2023 20:50:59 -0600 Subject: [PATCH] Do not error if the source code is not verified --- src/contract.rs | 8 -------- tests/it/contract.rs | 12 ------------ 2 files changed, 20 deletions(-) diff --git a/src/contract.rs b/src/contract.rs index 3940b1a..42e0655 100644 --- a/src/contract.rs +++ b/src/contract.rs @@ -391,14 +391,6 @@ impl Client { self.create_query("contract", "getsourcecode", HashMap::from([("address", address)])); let response = self.get(&query).await?; - // Source code is not verified - if response.contains("Contract source code not verified") { - if let Some(ref cache) = self.cache { - cache.set_source(address, None); - } - return Err(EtherscanError::ContractCodeNotVerified(address)); - } - let response: Response = self.sanitize_response(response)?; let result = response.result; diff --git a/tests/it/contract.rs b/tests/it/contract.rs index 53608ee..80f7902 100644 --- a/tests/it/contract.rs +++ b/tests/it/contract.rs @@ -49,18 +49,6 @@ async fn can_fetch_contract_source_code() { .await } -#[tokio::test] -#[serial] -async fn can_get_error_on_unverified_contract() { - init_tracing(); - run_with_client(Chain::mainnet(), |client| async move { - let addr = "0xb5c31a0e22cae98ac08233e512bd627885aa24e5".parse().unwrap(); - let err = client.contract_source_code(addr).await.unwrap_err(); - assert!(matches!(err, EtherscanError::ContractCodeNotVerified(_))); - }) - .await -} - /// Query a contract that has a single string source entry instead of underlying JSON metadata. #[tokio::test] #[serial]