(
key_store: PersistentKeyStore<EthKeyAddress>,
config: &DeployConfig,
progress_callback: Option<F>,
)
| 72 | } |
| 73 | |
| 74 | pub(crate) async fn deploy_contracts_with_progress<F>( |
| 75 | key_store: PersistentKeyStore<EthKeyAddress>, |
| 76 | config: &DeployConfig, |
| 77 | progress_callback: Option<F>, |
| 78 | ) -> anyhow::Result<DeployedContracts> |
| 79 | where |
| 80 | F: Fn(&str, &str, usize, usize) + Send + Sync, |
| 81 | { |
| 82 | // Retrieve the key info for the provided "from" address. |
| 83 | let key_info: ipc_wallet::EvmKeyInfo = |
| 84 | key_store.get(&config.from.into())?.ok_or_else(|| { |
| 85 | anyhow!( |
| 86 | "address {} does not have a private key in key store", |
| 87 | config.from |
| 88 | ) |
| 89 | })?; |
| 90 | |
| 91 | let (artifacts_path, _maybe_tempdir) = match &config.artifacts_path { |
| 92 | Some(path) => (path.clone(), None), |
| 93 | None => { |
| 94 | let (temp_dir, path) = contracts_artifacts::extract_to_tempdir()?; |
| 95 | (path, Some(temp_dir)) |
| 96 | } |
| 97 | }; |
| 98 | |
| 99 | let hardhat = Hardhat::new(artifacts_path); |
| 100 | |
| 101 | let mut deployer = EthContractDeployer::new( |
| 102 | hardhat, |
| 103 | &config.url, |
| 104 | key_info.private_key(), |
| 105 | config.chain_id, |
| 106 | )?; |
| 107 | |
| 108 | let deployed_contracts = deployer |
| 109 | .deploy_all_with_progress(config.subnet_creation_privilege.into(), progress_callback) |
| 110 | .await?; |
| 111 | |
| 112 | Ok(deployed_contracts) |
| 113 | } |
| 114 | |
| 115 | /// Shared deploy config for both CLI flags and YAML. |
| 116 | /// |
no test coverage detected