eth-brownie / brownie

A Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine.
https://eth-brownie.readthedocs.io
MIT License
2.63k stars 549 forks source link

Not Compiling with solc 0.7.4 #848

Closed jio-gl closed 3 years ago

jio-gl commented 3 years ago

Environment information

What was wrong?

I am trying to use Brownie with compile solc 0.7.4, just testing the example Token.

Is not working when I use Inheritance.

Please include information like:

SafeMath.sol:

pragma solidity ^0.7.4;

library SafeMath {
...
}

Token.sol:

pragma solidity ^0.7.4;

// SPDX-License-Identifier: MIT

import "./SafeMath.sol";

contract Token {
...
}

MyToken.sol:

pragma solidity ^0.7.4;

import "./Token.sol";

abstract contract MyToken is Token {

         address public owner;

         function bla() public returns (uint256) {
                  return 0;
                  }

                  constructor() {
        owner = msg.sender;
    }
}

` $ brownie compile Brownie v1.11.12 - Python development framework for Ethereum

Compiling contracts... Solc version: 0.7.4 Optimizer: Enabled Runs: 200 EVM Version: Istanbul Generating build data... File "brownie/_cli/main.py", line 64, in main importlib.import_module(f"brownie._cli.{cmd}").main() File "brownie/_cli/compile.py", line 50, in main proj = project.load() File "brownie/project/main.py", line 702, in load return Project(name, project_path) File "brownie/project/main.py", line 164, in init self.load() File "brownie/project/main.py", line 217, in load self._compile(changed, self._compiler_config, False) File "brownie/project/main.py", line 100, in _compile optimizer=compiler_config["solc"].get("optimizer", None), File "brownie/project/compiler/init.py", line 146, in compile_and_format build_json.update(generate_build_json(input_json, output_json, compiler_data, silent)) File "brownie/project/compiler/init.py", line 287, in generate_build_json source_nodes, statement_nodes, branch_nodes = solidity._get_nodes(output_json) File "brownie/project/compiler/solidity.py", line 545, in _get_nodes source_nodes = solcast.from_standard_output(output_json) File "solcast/main.py", line 33, in from_standard_output source_nodes = set_dependencies(source_nodes) File "solcast/dependencies.py", line 12, in set_dependencies symbol_map = get_symbol_map(source_nodes) File "solcast/dependencies.py", line 74, in get_symbol_map symbol_map.update((v[0], node[k]) for k, v in node.exportedSymbols.items()) File "solcast/dependencies.py", line 74, in symbol_map.update((v[0], node[k]) for k, v in node.exportedSymbols.items()) File "solcast/nodes.py", line 207, in getitem raise KeyError(key) KeyError: 'SafeMath' `

How can it be fixed?

I don't know how to fix it, I tried before moving all interfaces into the interfaces folder, but seems unrelated with interfaces.

iamdefinitelyahuman commented 3 years ago

Possibly related to #828