| 312 | } |
| 313 | |
| 314 | fn get_deployment_tx_from_etherscan( |
| 315 | config: &DVFConfig, |
| 316 | address: &Address, |
| 317 | ) -> Result<EtherscanCreationTransaction, ValidationError> { |
| 318 | let url = format!( |
| 319 | "{}?module=contract&action=getcontractcreation&contractaddresses={:?}&apikey={}", |
| 320 | config.get_etherscan_api_url()?, |
| 321 | address, |
| 322 | config.get_etherscan_api_key()? |
| 323 | ); |
| 324 | debug!("Etherscan URL: {}", url); |
| 325 | |
| 326 | // Send the GET request |
| 327 | let mut response = get(&url)?; |
| 328 | |
| 329 | // Read the response into a string |
| 330 | let mut buffer = String::new(); |
| 331 | response.read_to_string(&mut buffer)?; |
| 332 | |
| 333 | let result: EtherscanResult = serde_json::from_str(&buffer)?; |
| 334 | debug!("Etherscan contract creation response: {}", buffer); |
| 335 | // Parse the response as a JSON list |
| 336 | let mut transactions: Vec<EtherscanCreationTransaction> = |
| 337 | serde_json::from_value(result.result)?; |
| 338 | let transaction = transactions.remove(0); |
| 339 | |
| 340 | Ok(transaction) |
| 341 | } |
| 342 | |
| 343 | fn send_blocking_web3_post( |
| 344 | config: &DVFConfig, |