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

Commit

Permalink
Merge pull request #285 from ethers/sol1.2
Browse files Browse the repository at this point in the history
fixes for Solidity 0.1.2 changes
  • Loading branch information
heikoheiko committed Sep 4, 2015
2 parents cf71e52 + a98ad4e commit 27e38c3
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions ethereum/_solidity.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def compile(cls, code, contract_name=''):
idx = [x[0] for x in sorted_contracts].index(contract_name)
else:
idx = -1
return sorted_contracts[idx][1]['binary'].decode('hex')
return sorted_contracts[idx][1]['bin'].decode('hex')

@classmethod
def mk_full_signature(cls, code, contract_name=''):
Expand All @@ -75,11 +75,11 @@ def mk_full_signature(cls, code, contract_name=''):
idx = [x[0] for x in sorted_contracts].index(contract_name)
else:
idx = -1
return sorted_contracts[idx][1]['json-abi']
return sorted_contracts[idx][1]['abi']

@classmethod
def combined(cls, code):
p = subprocess.Popen(['solc', '--add-std=1', '--combined-json', 'json-abi,binary,sol-abi,natspec-dev,natspec-user'],
p = subprocess.Popen(['solc', '--add-std', '--combined-json', 'abi,bin,devdoc,userdoc'],
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
stdoutdata, stderrdata = p.communicate(input=code)
if p.returncode:
Expand All @@ -88,10 +88,9 @@ def combined(cls, code):
contracts = yaml.safe_load(stdoutdata)['contracts']

for contract_name, data in contracts.items():
data['json-abi'] = yaml.safe_load(data['json-abi'])
data['sol-abi'] = yaml.safe_load(data['sol-abi'])
data['natspec-dev'] = yaml.safe_load(data['natspec-dev'])
data['natspec-user'] = yaml.safe_load(data['natspec-user'])
data['abi'] = yaml.safe_load(data['abi'])
data['devdoc'] = yaml.safe_load(data['devdoc'])
data['userdoc'] = yaml.safe_load(data['userdoc'])

names = cls.contract_names(code)
assert len(names) <= len(contracts) # imported contracts are not returned
Expand All @@ -114,15 +113,15 @@ def compile_rich(cls, code):

return {
contract_name: {
'code': "0x" + contract.get('binary'),
'code': "0x" + contract.get('bin'),
'info': {
'abiDefinition': contract.get('json-abi'),
'abiDefinition': contract.get('abi'),
'compilerVersion': cls.compiler_version(),
'developerDoc': contract.get('natspec-dev'),
'developerDoc': contract.get('devdoc'),
'language': 'Solidity',
'languageVersion': '0',
'source': code,
'userDoc': contract.get('natspec-user')
'userDoc': contract.get('userdoc')
},
}
for contract_name, contract
Expand Down

0 comments on commit 27e38c3

Please sign in to comment.