Skip to main content

etch_foundry_artifact

Function etch_foundry_artifact 

Source
pub fn etch_foundry_artifact(
    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.

target must already have non-empty runtime bytecode. Its storage, balance, and nonce are preserved. If target is missing or has no runtime bytecode, this returns an error. Use etch_foundry_artifact_or_create for synthetic simulation addresses.

§Errors

Returns an error if the artifact cannot be loaded (see load_foundry_creation_code), if target is missing or has no runtime bytecode, if the deployment reverts or halts, or if copying the runtime bytecode to target fails (see FoundryArtifact::etch).

§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.