Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

added optimize parameter to combined method #719

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions ethereum/_solidity.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,13 @@ def mk_full_signature(cls, code, path=None, libraries=None, contract_name='', ex
return result['abi']

@classmethod
def combined(cls, code, path=None, extra_args=None):
def combined(cls, code, path=None, optimize=True, libraries=None, extra_args=None):
""" Compile combined-json with abi,bin,devdoc,userdoc.

@param code: literal solidity code as a string.
@param path: absolute path to solidity-file. Note: code & path are
mutually exclusive!
@param optimize: use solidity optimizer.
@param extra_args: Either a space separated string or a list of extra
arguments to be passed to the solidity compiler.
"""
Expand All @@ -399,13 +400,13 @@ def combined(cls, code, path=None, extra_args=None):
raise ValueError('sourcecode and path are mutually exclusive.')

if path:
contracts = compile_file(path, extra_args=extra_args)
contracts = compile_file(path, optimize=optimize, libraries=libraries, extra_args=extra_args)

with open(path) as handler:
code = handler.read()

elif code:
contracts = compile_code(code, extra_args=extra_args)
contracts = compile_code(code, optimize=optimize, libraries=libraries, extra_args=extra_args)

else:
raise ValueError('either code or path needs to be supplied.')
Expand Down Expand Up @@ -442,4 +443,4 @@ def compile_rich(cls, code, path=None, extra_args=None):
}


solc_wrapper = Solc # pylint: disable=invalid-name
solc_wrapper = Solc # pylint: disable=invalid-name