foundry_common::contracts

Function get_contract_name

Source
pub fn get_contract_name(id: &str) -> &str
Expand description

Returns contract name for a given contract identifier.

Artifact/Contract identifier can take the following form: <artifact file name>:<contract name>, the artifact file name is the name of the json file of the contract’s artifact and the contract name is the name of the solidity contract, like SafeTransferLibTest.json:SafeTransferLibTest

This returns the contract name part

§Example

use foundry_common::*;
assert_eq!(
    "SafeTransferLibTest",
    get_contract_name("SafeTransferLibTest.json:SafeTransferLibTest")
);