Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

feat(solc): emit artifacts for standalone source files #1296

Merged

Conversation

mattsse
Copy link
Collaborator

@mattsse mattsse commented May 20, 2022

Motivation

standalone sources don't contain any ContractDefinition (contract, lib, interface) and solc only includes those files in the sources list of its output.
However the ast of these files is still valuable for other tools such as slither See foundry-rs/foundry#1646

so we need to also generate an artifact for those.

Solution

We keep track of all source files that we could attribute to a Contract. if a source file was not referenced by a contract and the ast is not empty and does not include any ContractDefinition we also generate a basic artifact that only includes the id and ast

cc @mds1 @montyly

PR Checklist

  • Added Tests
  • Added Documentation
  • Updated the changelog

@gakonst gakonst merged commit 75835a9 into gakonst:master May 22, 2022
mattsse added a commit to mattsse/ethers-rs that referenced this pull request May 28, 2022
* feat(solc): emit artifact files for sources with no contracts

* test(solc): add tests for emitting standalone sources

* chore: update CHANGELOG

* style: check ast is some
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants