pub fn etch_foundry_artifact_or_create(
cache: &mut EvmCache,
target: Address,
artifact_path: impl AsRef<Path>,
deployer: Address,
constructor_args: impl AsRef<[u8]>,
) -> DeployResult<EtchedContract>Expand description
Deploy a Foundry artifact and copy its runtime bytecode to target, creating
a default target account when it does not already exist.
Prefer etch_foundry_artifact for forked/live contract addresses whose
storage, balance, or nonce should be preserved.
§Errors
Returns an error if the artifact cannot be loaded (see
load_foundry_creation_code), if the deployment reverts or halts, or if
copying the runtime bytecode to target fails, for example when the
deployed contract has empty runtime bytecode (see
FoundryArtifact::etch_or_create).
§Panics
Must run on a multi-thread tokio runtime; the deployment panics on a current-thread runtime when the fork DB attempts a synchronous RPC fetch.