Skip to content

Commit

Permalink
Merge pull request #90 from foundry-rs/develop
Browse files Browse the repository at this point in the history
Develop -> Master Release PR
  • Loading branch information
tynes authored Jul 25, 2022
2 parents da4da60 + 2bfde5f commit 400a37b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/late-rivers-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@foundry-rs/hardhat-forge": patch
---

Add build_info_path config
5 changes: 5 additions & 0 deletions .changeset/lazy-news-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@foundry-rs/hardhat-forge": patch
---

Deserialize compiler output metadata in buildinfo
10 changes: 10 additions & 0 deletions packages/hardhat-forge/src/forge/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ export class ForgeArtifacts implements IArtifacts {
}

const buildInfo = fsExtra.readJsonSync(buildInfoPath) as BuildInfo;

// Handle ethers-solc serializing the metadata as a string
// when hardhat serializes it as an object
for (const contract of Object.values(buildInfo.output.contracts)) {
for (const output of Object.values(contract)) {
if (typeof (output as any).metadata === "string") {
(output as any).metadata = JSON.parse((output as any).metadata);
}
}
}
return buildInfo;
}

Expand Down
1 change: 1 addition & 0 deletions packages/hardhat-forge/test/project.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ describe("Integration tests", function () {
assert.exists(contract.abi);
assert.exists((contract as any).devdoc);
assert.exists((contract as any).metadata);
assert.typeOf((contract as any).metadata, "object");
assert.exists((contract as any).storageLayout);
assert.exists((contract as any).userdoc);
assert.exists(contract.evm);
Expand Down

0 comments on commit 400a37b

Please sign in to comment.