Skip to content

Commit

Permalink
fix(create): infer contract from just contract name (foundry-rs#295)
Browse files Browse the repository at this point in the history
previously you had to specify the full path, and it'd panic if you only provided a name
  • Loading branch information
gakonst authored and clifton committed Dec 27, 2021
1 parent a289bac commit e4d7d61
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cli/src/cmd/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ impl CreateArgs {
let mut contract_artifact = None;

for (name, artifact) in compiled.into_artifacts() {
let artifact_contract_name = name.split(':').collect::<Vec<_>>()[1];
// if the contract name
let mut split = name.split(':');
let mut artifact_contract_name =
split.next().ok_or_else(|| eyre::Error::msg("no contract name provided"))?;
if let Some(new_name) = split.next() {
artifact_contract_name = new_name;
};

if artifact_contract_name == self.contract.name {
if has_found_contract {
Expand Down

0 comments on commit e4d7d61

Please sign in to comment.