question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Name collision for interfaces in Compound finance contracts prevents `brownie` from compiling

See original GitHub issue

Environment information

  • brownie Version: 1.10.6
  • ganache-cli Version: n/a
  • solc Version: 0.5.16
  • Python Version: 3.7
  • OS: osx

What was wrong?

I ran:

git clone https://github.com/compound-finance/compound-protocol.git

Then in a separate directory, I first initialised brownie:

poetry run brownie init

After that, I simlinked the contracts folder:

ln -s ../compound-protocol/contracts ./contracts

And tried to compile:

poetry run brownie compile

Getting the following error:

  File "brownie/_cli/__main__.py", line 60, in main
    importlib.import_module(f"brownie._cli.{cmd}").main()
  File "brownie/_cli/compile.py", line 37, in main
    project.load()
  File "brownie/project/main.py", line 656, in load
    return Project(name, project_path)
  File "brownie/project/main.py", line 160, in __init__
    self.load()
  File "brownie/project/main.py", line 170, in load
    self._sources = Sources(contract_sources, interface_sources)
  File "brownie/project/sources.py", line 53, in __init__
    + "\n  ".join(f"{k}: {', '.join(sorted(v))}" for k, v in collisions.items())
NamespaceCollision: Multiple contracts or interfaces with the same name
  PotLike: contracts/CDaiDelegate.sol, contracts/DAIInterestRateModelV3.sol

How can it be fixed?

It seems like brownie doesn’t support contracts with the same names, I wonder if it should be more permissive, perhaps namespacing contracts that appear in different files by prefixing with the filename (certainly for interfaces). In the compound example, these interfaces actually have different source code and are meant to be deployed as part of another contract.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Pet3riscommented, Aug 28, 2020

@iamdefinitelyahuman thanks and confirming that this update solves it for me ✅.

1reaction
iamdefinitelyahumancommented, Aug 25, 2020

Looking at the compound repo, it seems the collision is between an interface and an abstract contract. I think - might be able to apply a workaround without a major release, where collisions are OK so long as neither thing is a compilable contract. I’ll try to give it some bandwidth tomorrow, I have a new minor release almost ready anyway so can try to get this in as well.

In the mean time, it’s quick and dirty but you could just rename PotLike in one of the contracts. Or if you only need certain aspects of compound, try grabbing the verified, flattened sources from etherscan.

Read more comments on GitHub >

github_iconTop Results From Across the Web

eth-brownie/community - Gitter
Hey guys, i am running into byte code differences when trying to manually verify a vyper contract, (publish source flag doesn't work for...
Read more >
Compiling Contracts — Brownie 1.19.2 documentation
Each time the compiler runs, Brownie compares hashes of each contract source against hashes of the existing compiled versions. If a contract has...
Read more >
FxC - River Thames Conditions - Environment Agency - GOV.UK
Rich west soul contracts, Euro sign oracle database, Definicion de derechos ... Ohm gym cheng, Cl2o3 compound name, Symantec email archiving appliance, ...
Read more >
CREAK Data Explorer
Ammonia in glass cleaning solutions prevents streaks from forming. ... The name of protagonist in the Lord of Rings films is called Argon....
Read more >
The Compound on-Chain Protocol Based On Solidity Ethereum
The Compound Protocol is an Ethereum smart contract for supplying or borrowing assets. Through the cToken contracts, accounts on the blockchain supply ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found