good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
4
4byte
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
4byte
Commits
1105aa55
Commit
1105aa55
authored
Jun 27, 2023
by
Garet Halliday
Browse files
Options
Downloads
Patches
Plain Diff
get events as well
parent
8b19d10a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#22290
passed
Jun 27, 2023
Stage: build
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
common/sig/entry.go
+8
-2
8 additions, 2 deletions
common/sig/entry.go
common/sig/parser/parsers/v0/parser.go
+11
-2
11 additions, 2 deletions
common/sig/parser/parsers/v0/parser.go
common/sig/parser/parsers/v0/parser_test.go
+1
-1
1 addition, 1 deletion
common/sig/parser/parsers/v0/parser_test.go
with
20 additions
and
5 deletions
common/sig/entry.go
+
8
−
2
View file @
1105aa55
...
@@ -38,14 +38,20 @@ func FromSolidity(src string) []*Entry {
...
@@ -38,14 +38,20 @@ func FromSolidity(src string) []*Entry {
var
entries
[]
*
Entry
var
entries
[]
*
Entry
for
{
for
{
idx
:=
strings
.
Index
(
src
,
"function"
)
eventIdx
:=
strings
.
Index
(
src
,
"event"
)
functionIdx
:=
strings
.
Index
(
src
,
"function"
)
idx
:=
eventIdx
if
idx
==
-
1
||
(
functionIdx
!=
-
1
&&
functionIdx
<
idx
)
{
idx
=
functionIdx
}
if
idx
==
-
1
{
if
idx
==
-
1
{
break
break
}
}
// try to read signature
// try to read signature
sig
,
ok
:=
Normalize
(
src
[
idx
:
])
sig
,
ok
:=
Normalize
(
src
[
idx
:
])
src
=
src
[
idx
+
len
(
"function"
)
:
]
src
=
src
[
idx
+
5
:
]
if
!
ok
{
if
!
ok
{
continue
continue
}
}
...
...
This diff is collapsed.
Click to expand it.
common/sig/parser/parsers/v0/parser.go
+
11
−
2
View file @
1105aa55
...
@@ -294,8 +294,16 @@ var Arguments = p.Func(
...
@@ -294,8 +294,16 @@ var Arguments = p.Func(
if
ok
{
if
ok
{
types
=
append
(
types
,
typ
)
types
=
append
(
types
,
typ
)
// optional name
// optional indexed or location
p
.
Try
(
ctx
,
Whitespaces
)
p
.
String
(
ctx
,
"indexed"
)
p
.
String
(
ctx
,
"memory"
)
p
.
String
(
ctx
,
"storage"
)
p
.
String
(
ctx
,
"calldata"
)
p
.
Try
(
ctx
,
Whitespaces
)
p
.
Try
(
ctx
,
Whitespaces
)
// optional name
p
.
Try
(
ctx
,
Identifier
)
p
.
Try
(
ctx
,
Identifier
)
p
.
Try
(
ctx
,
Whitespaces
)
p
.
Try
(
ctx
,
Whitespaces
)
...
@@ -319,8 +327,9 @@ var Arguments = p.Func(
...
@@ -319,8 +327,9 @@ var Arguments = p.Func(
var
Signature
=
p
.
Func
(
var
Signature
=
p
.
Func
(
func
(
ctx
*
p
.
Context
)
(
p
.
Signature
,
bool
)
{
func
(
ctx
*
p
.
Context
)
(
p
.
Signature
,
bool
)
{
// optional "function" at the beginning
// optional "function"
or "event"
at the beginning
p
.
String
(
ctx
,
"function"
)
p
.
String
(
ctx
,
"function"
)
p
.
String
(
ctx
,
"event"
)
p
.
Try
(
ctx
,
Whitespaces
)
p
.
Try
(
ctx
,
Whitespaces
)
...
...
This diff is collapsed.
Click to expand it.
common/sig/parser/parsers/v0/parser_test.go
+
1
−
1
View file @
1105aa55
...
@@ -41,6 +41,6 @@ func TestNormalizing(t *testing.T) {
...
@@ -41,6 +41,6 @@ func TestNormalizing(t *testing.T) {
}
}
func
TestParser
(
t
*
testing
.
T
)
{
func
TestParser
(
t
*
testing
.
T
)
{
v
,
ok
:=
parse
(
"
set
Deposit(address
,bytes32,((address,address,address,address,address,address,address[],address[]),(uint256,uint256,uint256,uint256,uint256,uint256),(bool))
)"
)
v
,
ok
:=
parse
(
"
event
Deposit(address
indexed _from, uint256 _value
)"
)
log
.
Println
(
v
.
String
(),
ok
)
log
.
Println
(
v
.
String
(),
ok
)
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment