get_artifact_code

Function get_artifact_code 

Source
fn get_artifact_code(
    state: &Cheatcodes,
    path: &str,
    deployed: bool,
) -> Result<Bytes>
Expand description

Returns the bytecode from a JSON artifact file.

Can parse following input formats:

  • path/to/artifact.json
  • path/to/contract.sol
  • path/to/contract.sol:ContractName
  • path/to/contract.sol:ContractName:0.8.23
  • path/to/contract.sol:0.8.23
  • ContractName
  • ContractName:0.8.23

This function is safe to use with contracts that have library dependencies. alloy_json_abi::ContractObject validates bytecode during JSON parsing and will reject artifacts with unlinked library placeholders.