Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
exchain
nebula
Commits
dfa882e4
Commit
dfa882e4
authored
Aug 10, 2023
by
Hamdi Allam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make contract address a searchable field
parent
5c8ff3d9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
contract_events.go
indexer/database/contract_events.go
+5
-3
blocks_e2e_test.go
indexer/e2e_tests/blocks_e2e_test.go
+1
-0
20230523_create_schema.sql
indexer/migrations/20230523_create_schema.sql
+2
-0
No files found.
indexer/database/contract_events.go
View file @
dfa882e4
...
@@ -16,9 +16,10 @@ import (
...
@@ -16,9 +16,10 @@ import (
*/
*/
type
ContractEvent
struct
{
type
ContractEvent
struct
{
GUID
uuid
.
UUID
`gorm:"primaryKey"`
GUID
uuid
.
UUID
`gorm:"primaryKey"`
BlockHash
common
.
Hash
`gorm:"serializer:json"`
BlockHash
common
.
Hash
`gorm:"serializer:json"`
TransactionHash
common
.
Hash
`gorm:"serializer:json"`
ContractAddress
common
.
Address
`gorm:"serializer:json"`
TransactionHash
common
.
Hash
`gorm:"serializer:json"`
EventSignature
common
.
Hash
`gorm:"serializer:json"`
EventSignature
common
.
Hash
`gorm:"serializer:json"`
LogIndex
uint64
LogIndex
uint64
...
@@ -37,6 +38,7 @@ func ContractEventFromGethLog(log *types.Log, timestamp uint64) ContractEvent {
...
@@ -37,6 +38,7 @@ func ContractEventFromGethLog(log *types.Log, timestamp uint64) ContractEvent {
GUID
:
uuid
.
New
(),
GUID
:
uuid
.
New
(),
BlockHash
:
log
.
BlockHash
,
BlockHash
:
log
.
BlockHash
,
ContractAddress
:
log
.
Address
,
TransactionHash
:
log
.
TxHash
,
TransactionHash
:
log
.
TxHash
,
EventSignature
:
eventSig
,
EventSignature
:
eventSig
,
...
...
indexer/e2e_tests/blocks_e2e_test.go
View file @
dfa882e4
...
@@ -120,6 +120,7 @@ func TestE2EBlockHeaders(t *testing.T) {
...
@@ -120,6 +120,7 @@ func TestE2EBlockHeaders(t *testing.T) {
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
log
.
Topics
[
0
],
contractEvent
.
EventSignature
)
require
.
Equal
(
t
,
log
.
Topics
[
0
],
contractEvent
.
EventSignature
)
require
.
Equal
(
t
,
log
.
BlockHash
,
contractEvent
.
BlockHash
)
require
.
Equal
(
t
,
log
.
BlockHash
,
contractEvent
.
BlockHash
)
require
.
Equal
(
t
,
log
.
Address
,
contractEvent
.
ContractAddress
)
require
.
Equal
(
t
,
log
.
TxHash
,
contractEvent
.
TransactionHash
)
require
.
Equal
(
t
,
log
.
TxHash
,
contractEvent
.
TransactionHash
)
require
.
Equal
(
t
,
log
.
Index
,
uint
(
contractEvent
.
LogIndex
))
require
.
Equal
(
t
,
log
.
Index
,
uint
(
contractEvent
.
LogIndex
))
...
...
indexer/migrations/20230523_create_schema.sql
View file @
dfa882e4
...
@@ -36,6 +36,7 @@ CREATE TABLE IF NOT EXISTS l1_contract_events (
...
@@ -36,6 +36,7 @@ CREATE TABLE IF NOT EXISTS l1_contract_events (
-- Searchable fields
-- Searchable fields
guid
VARCHAR
NOT
NULL
PRIMARY
KEY
,
guid
VARCHAR
NOT
NULL
PRIMARY
KEY
,
block_hash
VARCHAR
NOT
NULL
REFERENCES
l1_block_headers
(
hash
),
block_hash
VARCHAR
NOT
NULL
REFERENCES
l1_block_headers
(
hash
),
contract_address
VARCHAR
NOT
NULL
,
transaction_hash
VARCHAR
NOT
NULL
,
transaction_hash
VARCHAR
NOT
NULL
,
log_index
INTEGER
NOT
NULL
,
log_index
INTEGER
NOT
NULL
,
event_signature
VARCHAR
NOT
NULL
,
-- bytes32(0x0) when topics are missing
event_signature
VARCHAR
NOT
NULL
,
-- bytes32(0x0) when topics are missing
...
@@ -49,6 +50,7 @@ CREATE TABLE IF NOT EXISTS l2_contract_events (
...
@@ -49,6 +50,7 @@ CREATE TABLE IF NOT EXISTS l2_contract_events (
-- Searchable fields
-- Searchable fields
guid
VARCHAR
NOT
NULL
PRIMARY
KEY
,
guid
VARCHAR
NOT
NULL
PRIMARY
KEY
,
block_hash
VARCHAR
NOT
NULL
REFERENCES
l2_block_headers
(
hash
),
block_hash
VARCHAR
NOT
NULL
REFERENCES
l2_block_headers
(
hash
),
contract_address
VARCHAR
NOT
NULL
,
transaction_hash
VARCHAR
NOT
NULL
,
transaction_hash
VARCHAR
NOT
NULL
,
log_index
INTEGER
NOT
NULL
,
log_index
INTEGER
NOT
NULL
,
event_signature
VARCHAR
NOT
NULL
,
-- bytes32(0x0) when topics are missing
event_signature
VARCHAR
NOT
NULL
,
-- bytes32(0x0) when topics are missing
...
...
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