diff --git a/brownie/project/compiler/__init__.py b/brownie/project/compiler/__init__.py index cb0afb0cc..a35b061dd 100644 --- a/brownie/project/compiler/__init__.py +++ b/brownie/project/compiler/__init__.py @@ -39,11 +39,7 @@ "remappings": [], }, } -EVM_SOLC_VERSIONS = [ - ("istanbul", Version("0.5.13")), - ("petersburg", Version("0.5.5")), - ("byzantium", Version("0.4.0")), -] + def compile_and_format( @@ -177,10 +173,8 @@ def generate_input_json( optimizer = {"enabled": optimize, "runs": runs if optimize else 0} if evm_version is None: - if language == "Solidity": - evm_version = next(i[0] for i in EVM_SOLC_VERSIONS if solidity.get_version() >= i[1]) - else: - evm_version = "paris" + _module = solidity if language == "Solidity" else vyper + evm_version = next(i[0] for i in _module.EVM_VERSION_MAPPING if _module.get_version() >= i[1]) input_json: Dict = deepcopy(STANDARD_JSON) input_json["language"] = language diff --git a/brownie/project/compiler/solidity.py b/brownie/project/compiler/solidity.py index e244735bd..7523412ea 100644 --- a/brownie/project/compiler/solidity.py +++ b/brownie/project/compiler/solidity.py @@ -26,6 +26,12 @@ AVAILABLE_SOLC_VERSIONS = None +EVM_VERSION_MAPPING = [ + ("istanbul", Version("0.5.13")), + ("petersburg", Version("0.5.5")), + ("byzantium", Version("0.4.0")), +] + # error codes used in Solidity >=0.8.0 # docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require SOLIDITY_ERROR_CODES = { diff --git a/brownie/project/compiler/vyper.py b/brownie/project/compiler/vyper.py index 1b0c60ff3..76d6e7a7f 100644 --- a/brownie/project/compiler/vyper.py +++ b/brownie/project/compiler/vyper.py @@ -28,6 +28,14 @@ _active_version = Version(vyper.__version__) +EVM_VERSION_MAPPING = [ + ("shanghai", Version("0.3.9")), + ("paris", Version("0.3.7")), + ("berlin", Version("0.2.12")), + ("istanbul", Version("0.1.0")), +] + + def get_version() -> Version: return _active_version