mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
Merge 5be1099770 into e916f9786d
This commit is contained in:
commit
064cae205e
1 changed files with 6 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The ABI holds information about a contract's context and available
|
// The ABI holds information about a contract's context and available
|
||||||
|
|
@ -108,6 +109,7 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
|
||||||
|
|
||||||
abi.Methods = make(map[string]Method)
|
abi.Methods = make(map[string]Method)
|
||||||
abi.Events = make(map[string]Event)
|
abi.Events = make(map[string]Event)
|
||||||
|
functionCnt, eventCnt := 0, 0
|
||||||
for _, field := range fields {
|
for _, field := range fields {
|
||||||
switch field.Type {
|
switch field.Type {
|
||||||
case "constructor":
|
case "constructor":
|
||||||
|
|
@ -122,12 +124,16 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
|
||||||
Inputs: field.Inputs,
|
Inputs: field.Inputs,
|
||||||
Outputs: field.Outputs,
|
Outputs: field.Outputs,
|
||||||
}
|
}
|
||||||
|
abi.Methods[field.Name+strconv.Itoa(functionCnt)] = abi.Methods[field.Name]
|
||||||
|
functionCnt++
|
||||||
case "event":
|
case "event":
|
||||||
abi.Events[field.Name] = Event{
|
abi.Events[field.Name] = Event{
|
||||||
Name: field.Name,
|
Name: field.Name,
|
||||||
Anonymous: field.Anonymous,
|
Anonymous: field.Anonymous,
|
||||||
Inputs: field.Inputs,
|
Inputs: field.Inputs,
|
||||||
}
|
}
|
||||||
|
abi.Events[field.Name+strconv.Itoa(eventCnt)] = abi.Events[field.Name]
|
||||||
|
eventCnt++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue