This repository was archived by the owner on Apr 8, 2026. It is now read-only.
feat: write hardhat style artifacts to disk#38
Merged
gakonst merged 4 commits intofoundry-rs:developfrom May 30, 2022
Merged
Conversation
🦋 Changeset detectedLatest commit: 35848b2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Collaborator
Author
|
Will fix the tests, the version of nodejs used in ci doesn't have the |
Adds a function `writeArtifactsSync` that accepts an output directory and will write hardhat style artifacts to disk in that directory.
965cd92 to
35848b2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This will now write hardhat style artifacts to disk after running
hardhat compile.An example of how hardhat does this:
The layout of the artifacts mirrors the layout of the contract source, unlike
foundrywhich flattens all of the artifacts into a single top level directoryAs of this PR,
artifacts/build-infois not populated. I do not believe deps are compiled either unless they are used (the openzeppelin contracts in this example), hh seems to always compile them.I do think that having the functionality to build hardhat style artifacts would be more suited for
ethers-rsas the relative path to the source file is lost without looking at the forge artifact.ast.absolutePath(and having latest forge with gakonst/ethers-rs@54f1b9d ?).This errors if 2 contracts have the same name, see:
hardhat/packages/hardhat-forge/src/forge/artifacts.ts
Line 419 in 736941e
This is very helpful for making things just work with
hardhat deployandhardhat tasks.A few thoughts on the design:
.forge.writeArtifacts? and default it to true?ForgeArtifacts?Right now in a project I am using an alternative and very hacky method to write the hh artifacts to disk and have confirmed that with having them written to disk,
hardhat deployworks withanvil