aboutsummaryrefslogtreecommitdiffstats
path: root/common/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'common/compiler')
-rw-r--r--common/compiler/helpers.go7
-rw-r--r--common/compiler/solidity.go4
2 files changed, 7 insertions, 4 deletions
diff --git a/common/compiler/helpers.go b/common/compiler/helpers.go
index 4de706f6b..5ed640de8 100644
--- a/common/compiler/helpers.go
+++ b/common/compiler/helpers.go
@@ -27,9 +27,10 @@ var versionRegexp = regexp.MustCompile(`([0-9]+)\.([0-9]+)\.([0-9]+)`)
// Contract contains information about a compiled contract, alongside its code and runtime code.
type Contract struct {
- Code string `json:"code"`
- RuntimeCode string `json:"runtime-code"`
- Info ContractInfo `json:"info"`
+ Code string `json:"code"`
+ RuntimeCode string `json:"runtime-code"`
+ Info ContractInfo `json:"info"`
+ Hashes map[string]string `json:"hashes"`
}
// ContractInfo contains information about a compiled contract, including access
diff --git a/common/compiler/solidity.go b/common/compiler/solidity.go
index 7ed9c2633..56e01ee33 100644
--- a/common/compiler/solidity.go
+++ b/common/compiler/solidity.go
@@ -39,6 +39,7 @@ type solcOutput struct {
BinRuntime string `json:"bin-runtime"`
SrcMapRuntime string `json:"srcmap-runtime"`
Bin, SrcMap, Abi, Devdoc, Userdoc, Metadata string
+ Hashes map[string]string
}
Version string
}
@@ -49,7 +50,7 @@ func (s *Solidity) makeArgs() []string {
"--optimize", // code optimizer switched on
}
if s.Major > 0 || s.Minor > 4 || s.Patch > 6 {
- p[1] += ",metadata"
+ p[1] += ",metadata,hashes"
}
return p
}
@@ -161,6 +162,7 @@ func ParseCombinedJSON(combinedJSON []byte, source string, languageVersion strin
contracts[name] = &Contract{
Code: "0x" + info.Bin,
RuntimeCode: "0x" + info.BinRuntime,
+ Hashes: info.Hashes,
Info: ContractInfo{
Source: source,
Language: "Solidity",