-
Notifications
You must be signed in to change notification settings - Fork 589
Open
Description
Environment information
brownieVersion: 1.21.0ganache-cliVersion: x.x.x (irrelevant)solcVersion: 0.7.6- Python Version: 3.12.4
- OS: osx
What was wrong?
I'm using a contract (say MyContract) that is deployed with the library also being deployed (not compiled into the contract). The library is in libraries/. When I want to verify this, I'm getting the following crash:
❯ brownie console --network bsc-main
Brownie v1.21.0 - Python development framework for Ethereum
VaultsDevProject is the active project.
Brownie environment is ready.
>>> cc = MyContract
>>> c = cc[-1]
>>> cc.publish_source(c)
File "<console>", line 1, in <module>
File "brownie/network/contract.py", line 335, in publish_source
contract_info = self.get_verification_info()
File "brownie/network/contract.py", line 305, in get_verification_info
self._flattener = Flattener(source_fp, self._name, remaps, compiler_settings)
File "brownie/project/flattener.py", line 32, in __init__
self.traverse(primary_source_fp)
File "brownie/project/flattener.py", line 74, in traverse
self.sources[name] = IMPORT_PATTERN.sub(repl, source)
File "brownie/project/flattener.py", line 71, in <lambda>
+ f'"{self.path_to_name(sanitize(m.group("path")))}"'
File "brownie/project/flattener.py", line 44, in path_to_name
return "contracts/" + pth.split("/contracts/")[1]
IndexError: list index out of range
Guessing from the code, it seems that brownie expects my library at contracts/, where it is not.
How can it be fixed?
Use a better method for tracing dependencies that hard-coding "/contracts/" as a separator. Actually include all the dirs where source files might be.
Metadata
Metadata
Assignees
Labels
No labels