Open shottah opened 2 years ago
This issue is also being tracked on Linear.
We use Linear to manage our development process, but we keep the conversations on Github.
LINEAR-ID: 349db0f4-ad3a-4636-b57b-a8ae442e7584
This issue was marked as stale because it didn't have any activity in the last 30 days. If you think it's still relevant, please leave a comment indicating so. Otherwise, it will be closed in 7 days.
Hi @matabeitt, thanks for reporting this.
Since we support circular dependencies in single-repository projects, I think it makes sense to also support it in monorepos.
I don't know when we'll be able to work on this though, so for the time being, one workaround would be to extract the interface to a different file (say, I.sol
), so that both A and B import I and there isn't a circular dependency anymore. I know this is not ideal, but maybe it can help you while you wait for a fix.
When using a monorepo with multiple projects, one or more smart contracts cannot import in a circular reference between projects. I need this because I would like ContractA to use ContractB interface in order to make an external call to ContractB.
Problem: ContractA cannot import ContractB where ContractA lives in ProjectA and ContractB lives in ProjectB if and only if ContractB also imports ContractA.
N.B. This issue does not occur if ContractA imports ContractB, and ContractB does not import ContractA, where ContractA and ContractB exist in separate monorepo packages.
I have the following monorepo structure.
The following contracts reference each other in order to call specific functions.
package1/ICO
package2/Router.sol
In the package definitions I have also included them as dependencies. These are resolved without issue.
package1/package.json
package2/package.json
Running
yarn hardhat compile
inproject2
orproject1
results in the following error: This throws with the error: