MCPcopy Create free account
hub / github.com/ChainSecurity/deployment_validation / get_deployment

Function get_deployment

lib/web3.rs:469–501  ·  view source on GitHub ↗
(
    config: &DVFConfig,
    address: &Address,
)

Source from the content-addressed store, hash-verified

467}
468
469pub fn get_deployment(
470 config: &DVFConfig,
471 address: &Address,
472) -> Result<(u64, String), ValidationError> {
473 // First try etherscan
474 if let Ok(deployment_tx) = get_deployment_tx_from_etherscan(config, address) {
475 let deployment_tx_hash = deployment_tx.tx_hash;
476 debug!("Etherscan Deployment Tx: {}", deployment_tx_hash);
477 let deployment_block_num = get_block_number_for_tx(config, deployment_tx_hash.as_str())?;
478 return Ok((deployment_block_num, deployment_tx_hash));
479 } else if let Ok(deployment_tx_hash) = get_deployment_tx_from_graphql(config, address) {
480 debug!("GraphQL Deployment Tx: {}", deployment_tx_hash);
481 let deployment_block_num = get_block_number_for_tx(config, deployment_tx_hash.as_str())?;
482 return Ok((deployment_block_num, deployment_tx_hash));
483 } else {
484 let current_block_num = get_eth_block_number(config)?;
485 if current_block_num < 100 {
486 if let Ok((deployment_block_num, deployment_tx_hash)) =
487 get_deployment_from_parity_trace(config, address, current_block_num)
488 {
489 return Ok((deployment_block_num, deployment_tx_hash));
490 }
491 if let Ok((deployment_block_num, deployment_tx_hash)) =
492 get_deployment_from_geth_trace(config, address, current_block_num)
493 {
494 return Ok((deployment_block_num, deployment_tx_hash));
495 }
496 }
497 }
498 Err(ValidationError::from(
499 "Could not find deployment transaction.",
500 ))
501}
502
503#[derive(Debug, Serialize, Deserialize)]
504struct Web3Result {

Callers 2

get_deployment_blockFunction · 0.85
processFunction · 0.85

Tested by

no test coverage detected