Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
8b6ae6bf
Commit
8b6ae6bf
authored
9 years ago
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2355 from karalabe/abi-constant-functions-2
accounts/abi: handle the "constant" modifier for functions
parents
2855a93e
270ea6ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
+12
-9
abi.go
accounts/abi/abi.go
+7
-7
method.go
accounts/abi/method.go
+5
-2
No files found.
accounts/abi/abi.go
View file @
8b6ae6bf
...
...
@@ -268,12 +268,12 @@ func set(dst, src reflect.Value, output Argument) error {
func
(
abi
*
ABI
)
UnmarshalJSON
(
data
[]
byte
)
error
{
var
fields
[]
struct
{
Type
string
Name
string
Const
bool
Indexed
bool
Inputs
[]
Argument
Outputs
[]
Argument
Type
string
Name
string
Const
ant
bool
Indexed
bool
Inputs
[]
Argument
Outputs
[]
Argument
}
if
err
:=
json
.
Unmarshal
(
data
,
&
fields
);
err
!=
nil
{
...
...
@@ -288,7 +288,7 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
case
"function"
,
""
:
abi
.
Methods
[
field
.
Name
]
=
Method
{
Name
:
field
.
Name
,
Const
:
field
.
Const
,
Const
:
field
.
Const
ant
,
Inputs
:
field
.
Inputs
,
Outputs
:
field
.
Outputs
,
}
...
...
This diff is collapsed.
Click to expand it.
accounts/abi/method.go
View file @
8b6ae6bf
...
...
@@ -67,8 +67,11 @@ func (m Method) String() string {
}
outputs
[
i
]
+=
output
.
Type
.
String
()
}
return
fmt
.
Sprintf
(
"function %v(%v) returns(%v)"
,
m
.
Name
,
strings
.
Join
(
inputs
,
", "
),
strings
.
Join
(
outputs
,
", "
))
constant
:=
""
if
m
.
Const
{
constant
=
"constant "
}
return
fmt
.
Sprintf
(
"function %v(%v) %sreturns(%v)"
,
m
.
Name
,
strings
.
Join
(
inputs
,
", "
),
constant
,
strings
.
Join
(
outputs
,
", "
))
}
func
(
m
Method
)
Id
()
[]
byte
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment