mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 19:30:44 +00:00
accounts/abi: fix method constant flag for solidity 6.0 (#20482)
This commit is contained in:
parent
0350880af6
commit
8d4c290cce
1 changed files with 9 additions and 7 deletions
|
|
@ -113,6 +113,7 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
|
||||||
Type string
|
Type string
|
||||||
Name string
|
Name string
|
||||||
Constant bool
|
Constant bool
|
||||||
|
StateMutability string
|
||||||
Anonymous bool
|
Anonymous bool
|
||||||
Inputs []Argument
|
Inputs []Argument
|
||||||
Outputs []Argument
|
Outputs []Argument
|
||||||
|
|
@ -136,10 +137,11 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
|
||||||
name = fmt.Sprintf("%s%d", field.Name, idx)
|
name = fmt.Sprintf("%s%d", field.Name, idx)
|
||||||
_, ok = abi.Methods[name]
|
_, ok = abi.Methods[name]
|
||||||
}
|
}
|
||||||
|
isConst := field.Constant || field.StateMutability == "pure" || field.StateMutability == "view"
|
||||||
abi.Methods[name] = Method{
|
abi.Methods[name] = Method{
|
||||||
Name: name,
|
Name: name,
|
||||||
RawName: field.Name,
|
RawName: field.Name,
|
||||||
Const: field.Constant,
|
Const: isConst,
|
||||||
Inputs: field.Inputs,
|
Inputs: field.Inputs,
|
||||||
Outputs: field.Outputs,
|
Outputs: field.Outputs,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue