diff --git a/blockchain/arbitrum_one/arbitrum_one.go b/blockchain/arbitrum_one/arbitrum_one.go index 6b6c93b..afe1029 100644 --- a/blockchain/arbitrum_one/arbitrum_one.go +++ b/blockchain/arbitrum_one/arbitrum_one.go @@ -310,7 +310,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B parsedEvents = append(parsedEvents, parsedEvent) // Prepare events to index - var topic0, topic1, topic2 *string + var topic0, topic1, topic2, topic3 *string if len(parsedEvent.Topics) == 0 { fmt.Println("No topics found for event: ", parsedEvent) @@ -326,6 +326,10 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B topic2 = &parsedEvent.Topics[2] // Third topic, if present } + if len(parsedEvent.Topics) > 3 { + topic3 = &parsedEvent.Topics[3] // Fourth topic, if present + } + eventsIndex = append(eventsIndex, indexer.LogIndex{ Address: parsedEvent.Address, BlockNumber: parsedEvent.BlockNumber, @@ -335,6 +339,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B Selector: topic0, // First topic Topic1: topic1, Topic2: topic2, + Topic3: topic3, RowID: uint64(i), // TODO: Remove LogIndex: parsedEvent.LogIndex, Path: "", diff --git a/blockchain/arbitrum_sepolia/arbitrum_sepolia.go b/blockchain/arbitrum_sepolia/arbitrum_sepolia.go index f9c80bc..1f03ed3 100644 --- a/blockchain/arbitrum_sepolia/arbitrum_sepolia.go +++ b/blockchain/arbitrum_sepolia/arbitrum_sepolia.go @@ -310,7 +310,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B parsedEvents = append(parsedEvents, parsedEvent) // Prepare events to index - var topic0, topic1, topic2 *string + var topic0, topic1, topic2, topic3 *string if len(parsedEvent.Topics) == 0 { fmt.Println("No topics found for event: ", parsedEvent) @@ -326,6 +326,10 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B topic2 = &parsedEvent.Topics[2] // Third topic, if present } + if len(parsedEvent.Topics) > 3 { + topic3 = &parsedEvent.Topics[3] // Fourth topic, if present + } + eventsIndex = append(eventsIndex, indexer.LogIndex{ Address: parsedEvent.Address, BlockNumber: parsedEvent.BlockNumber, @@ -335,6 +339,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B Selector: topic0, // First topic Topic1: topic1, Topic2: topic2, + Topic3: topic3, RowID: uint64(i), // TODO: Remove LogIndex: parsedEvent.LogIndex, Path: "", diff --git a/blockchain/blockchain.go.tmpl b/blockchain/blockchain.go.tmpl index d326bdf..f94d9a3 100644 --- a/blockchain/blockchain.go.tmpl +++ b/blockchain/blockchain.go.tmpl @@ -310,7 +310,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B parsedEvents = append(parsedEvents, parsedEvent) // Prepare events to index - var topic0, topic1, topic2 *string + var topic0, topic1, topic2, topic3 *string if len(parsedEvent.Topics) == 0 { fmt.Println("No topics found for event: ", parsedEvent) @@ -326,6 +326,10 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B topic2 = &parsedEvent.Topics[2] // Third topic, if present } + if len(parsedEvent.Topics) > 3 { + topic3 = &parsedEvent.Topics[3] // Fourth topic, if present + } + eventsIndex = append(eventsIndex, indexer.LogIndex{ Address: parsedEvent.Address, BlockNumber: parsedEvent.BlockNumber, @@ -335,6 +339,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B Selector: topic0, // First topic Topic1: topic1, Topic2: topic2, + Topic3: topic3, RowID: uint64(i), // TODO: Remove LogIndex: parsedEvent.LogIndex, Path: "", diff --git a/blockchain/ethereum/ethereum.go b/blockchain/ethereum/ethereum.go index bc5326f..2cb6866 100644 --- a/blockchain/ethereum/ethereum.go +++ b/blockchain/ethereum/ethereum.go @@ -310,7 +310,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B parsedEvents = append(parsedEvents, parsedEvent) // Prepare events to index - var topic0, topic1, topic2 *string + var topic0, topic1, topic2, topic3 *string if len(parsedEvent.Topics) == 0 { fmt.Println("No topics found for event: ", parsedEvent) @@ -326,6 +326,10 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B topic2 = &parsedEvent.Topics[2] // Third topic, if present } + if len(parsedEvent.Topics) > 3 { + topic3 = &parsedEvent.Topics[3] // Fourth topic, if present + } + eventsIndex = append(eventsIndex, indexer.LogIndex{ Address: parsedEvent.Address, BlockNumber: parsedEvent.BlockNumber, @@ -335,6 +339,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B Selector: topic0, // First topic Topic1: topic1, Topic2: topic2, + Topic3: topic3, RowID: uint64(i), // TODO: Remove LogIndex: parsedEvent.LogIndex, Path: "", diff --git a/blockchain/game7_orbit_arbitrum_sepolia/game7_orbit_arbitrum_sepolia.go b/blockchain/game7_orbit_arbitrum_sepolia/game7_orbit_arbitrum_sepolia.go index 4056779..21b289b 100644 --- a/blockchain/game7_orbit_arbitrum_sepolia/game7_orbit_arbitrum_sepolia.go +++ b/blockchain/game7_orbit_arbitrum_sepolia/game7_orbit_arbitrum_sepolia.go @@ -310,7 +310,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B parsedEvents = append(parsedEvents, parsedEvent) // Prepare events to index - var topic0, topic1, topic2 *string + var topic0, topic1, topic2, topic3 *string if len(parsedEvent.Topics) == 0 { fmt.Println("No topics found for event: ", parsedEvent) @@ -326,6 +326,10 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B topic2 = &parsedEvent.Topics[2] // Third topic, if present } + if len(parsedEvent.Topics) > 3 { + topic3 = &parsedEvent.Topics[3] // Fourth topic, if present + } + eventsIndex = append(eventsIndex, indexer.LogIndex{ Address: parsedEvent.Address, BlockNumber: parsedEvent.BlockNumber, @@ -335,6 +339,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B Selector: topic0, // First topic Topic1: topic1, Topic2: topic2, + Topic3: topic3, RowID: uint64(i), // TODO: Remove LogIndex: parsedEvent.LogIndex, Path: "", diff --git a/blockchain/mantle/mantle.go b/blockchain/mantle/mantle.go index 021ea44..7c7ee66 100644 --- a/blockchain/mantle/mantle.go +++ b/blockchain/mantle/mantle.go @@ -310,7 +310,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B parsedEvents = append(parsedEvents, parsedEvent) // Prepare events to index - var topic0, topic1, topic2 *string + var topic0, topic1, topic2, topic3 *string if len(parsedEvent.Topics) == 0 { fmt.Println("No topics found for event: ", parsedEvent) @@ -326,6 +326,10 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B topic2 = &parsedEvent.Topics[2] // Third topic, if present } + if len(parsedEvent.Topics) > 3 { + topic3 = &parsedEvent.Topics[3] // Fourth topic, if present + } + eventsIndex = append(eventsIndex, indexer.LogIndex{ Address: parsedEvent.Address, BlockNumber: parsedEvent.BlockNumber, @@ -335,6 +339,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B Selector: topic0, // First topic Topic1: topic1, Topic2: topic2, + Topic3: topic3, RowID: uint64(i), // TODO: Remove LogIndex: parsedEvent.LogIndex, Path: "", diff --git a/blockchain/mantle_sepolia/mantle_sepolia.go b/blockchain/mantle_sepolia/mantle_sepolia.go index fb16e75..0c4ce92 100644 --- a/blockchain/mantle_sepolia/mantle_sepolia.go +++ b/blockchain/mantle_sepolia/mantle_sepolia.go @@ -310,7 +310,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B parsedEvents = append(parsedEvents, parsedEvent) // Prepare events to index - var topic0, topic1, topic2 *string + var topic0, topic1, topic2, topic3 *string if len(parsedEvent.Topics) == 0 { fmt.Println("No topics found for event: ", parsedEvent) @@ -326,6 +326,10 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B topic2 = &parsedEvent.Topics[2] // Third topic, if present } + if len(parsedEvent.Topics) > 3 { + topic3 = &parsedEvent.Topics[3] // Fourth topic, if present + } + eventsIndex = append(eventsIndex, indexer.LogIndex{ Address: parsedEvent.Address, BlockNumber: parsedEvent.BlockNumber, @@ -335,6 +339,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B Selector: topic0, // First topic Topic1: topic1, Topic2: topic2, + Topic3: topic3, RowID: uint64(i), // TODO: Remove LogIndex: parsedEvent.LogIndex, Path: "", diff --git a/blockchain/polygon/polygon.go b/blockchain/polygon/polygon.go index 8ba0077..ae1ed45 100644 --- a/blockchain/polygon/polygon.go +++ b/blockchain/polygon/polygon.go @@ -310,7 +310,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B parsedEvents = append(parsedEvents, parsedEvent) // Prepare events to index - var topic0, topic1, topic2 *string + var topic0, topic1, topic2, topic3 *string if len(parsedEvent.Topics) == 0 { fmt.Println("No topics found for event: ", parsedEvent) @@ -326,6 +326,10 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B topic2 = &parsedEvent.Topics[2] // Third topic, if present } + if len(parsedEvent.Topics) > 3 { + topic3 = &parsedEvent.Topics[3] // Fourth topic, if present + } + eventsIndex = append(eventsIndex, indexer.LogIndex{ Address: parsedEvent.Address, BlockNumber: parsedEvent.BlockNumber, @@ -335,6 +339,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B Selector: topic0, // First topic Topic1: topic1, Topic2: topic2, + Topic3: topic3, RowID: uint64(i), // TODO: Remove LogIndex: parsedEvent.LogIndex, Path: "", diff --git a/blockchain/xai/xai.go b/blockchain/xai/xai.go index ccbe802..36e70a9 100644 --- a/blockchain/xai/xai.go +++ b/blockchain/xai/xai.go @@ -310,7 +310,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B parsedEvents = append(parsedEvents, parsedEvent) // Prepare events to index - var topic0, topic1, topic2 *string + var topic0, topic1, topic2, topic3 *string if len(parsedEvent.Topics) == 0 { fmt.Println("No topics found for event: ", parsedEvent) @@ -326,6 +326,10 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B topic2 = &parsedEvent.Topics[2] // Third topic, if present } + if len(parsedEvent.Topics) > 3 { + topic3 = &parsedEvent.Topics[3] // Fourth topic, if present + } + eventsIndex = append(eventsIndex, indexer.LogIndex{ Address: parsedEvent.Address, BlockNumber: parsedEvent.BlockNumber, @@ -335,6 +339,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B Selector: topic0, // First topic Topic1: topic1, Topic2: topic2, + Topic3: topic3, RowID: uint64(i), // TODO: Remove LogIndex: parsedEvent.LogIndex, Path: "", diff --git a/blockchain/xai_sepolia/xai_sepolia.go b/blockchain/xai_sepolia/xai_sepolia.go index 2b770d0..fe52a32 100644 --- a/blockchain/xai_sepolia/xai_sepolia.go +++ b/blockchain/xai_sepolia/xai_sepolia.go @@ -310,7 +310,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B parsedEvents = append(parsedEvents, parsedEvent) // Prepare events to index - var topic0, topic1, topic2 *string + var topic0, topic1, topic2, topic3 *string if len(parsedEvent.Topics) == 0 { fmt.Println("No topics found for event: ", parsedEvent) @@ -326,6 +326,10 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B topic2 = &parsedEvent.Topics[2] // Third topic, if present } + if len(parsedEvent.Topics) > 3 { + topic3 = &parsedEvent.Topics[3] // Fourth topic, if present + } + eventsIndex = append(eventsIndex, indexer.LogIndex{ Address: parsedEvent.Address, BlockNumber: parsedEvent.BlockNumber, @@ -335,6 +339,7 @@ func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.B Selector: topic0, // First topic Topic1: topic1, Topic2: topic2, + Topic3: topic3, RowID: uint64(i), // TODO: Remove LogIndex: parsedEvent.LogIndex, Path: "", diff --git a/indexer/db.go b/indexer/db.go index e170c91..0b62500 100644 --- a/indexer/db.go +++ b/indexer/db.go @@ -508,7 +508,7 @@ func (p *PostgreSQLpgx) writeTransactionIndexToDB(tableName string, indexes []Tr func (p *PostgreSQLpgx) writeLogIndexToDB(tableName string, indexes []LogIndex) error { - columns := []string{"transaction_hash", "block_hash", "address", "selector", "topic1", "topic2", "row_id", "log_index", "path"} + columns := []string{"transaction_hash", "block_hash", "address", "selector", "topic1", "topic2", "topic3", "row_id", "log_index", "path"} var valuesMap = make(map[string]UnnestInsertValueStruct) @@ -542,6 +542,11 @@ func (p *PostgreSQLpgx) writeLogIndexToDB(tableName string, indexes []LogIndex) Values: make([]interface{}, 0), } + valuesMap["topic3"] = UnnestInsertValueStruct{ + Type: "TEXT", + Values: make([]interface{}, 0), + } + valuesMap["row_id"] = UnnestInsertValueStruct{ Type: "BIGINT", Values: make([]interface{}, 0), @@ -571,6 +576,7 @@ func (p *PostgreSQLpgx) writeLogIndexToDB(tableName string, indexes []LogIndex) updateValues(valuesMap, "selector", index.Selector) updateValues(valuesMap, "topic1", index.Topic1) updateValues(valuesMap, "topic2", index.Topic2) + updateValues(valuesMap, "topic3", index.Topic3) updateValues(valuesMap, "row_id", index.RowID) updateValues(valuesMap, "log_index", index.LogIndex) updateValues(valuesMap, "path", index.Path) diff --git a/indexer/types.go b/indexer/types.go index 281ad47..2fd67c4 100644 --- a/indexer/types.go +++ b/indexer/types.go @@ -79,15 +79,16 @@ type LogIndex struct { BlockTimestamp uint64 Address string TransactionHash string - Selector *string // TODO: 1) Add Topic1, Topic2. 2) Rename Topic0 to selector + Selector *string Topic1 *string Topic2 *string + Topic3 *string RowID uint64 LogIndex uint64 Path string } -func NewLogIndex(chain string, address string, blockNumber uint64, blockHash string, transactionHash string, BlockTimestamp uint64, topic0 *string, topic1 *string, topic2 *string, row_id uint64, logIndex uint64, path string) LogIndex { +func NewLogIndex(chain string, address string, blockNumber uint64, blockHash string, transactionHash string, BlockTimestamp uint64, topic0 *string, topic1 *string, topic2 *string, topic3 *string, row_id uint64, logIndex uint64, path string) LogIndex { return LogIndex{ chain: chain, Address: address, @@ -98,6 +99,7 @@ func NewLogIndex(chain string, address string, blockNumber uint64, blockHash str Selector: topic0, Topic1: topic1, Topic2: topic2, + Topic3: topic3, RowID: row_id, LogIndex: logIndex, Path: path, diff --git a/version/version.go b/version/version.go index a088f38..8082e53 100644 --- a/version/version.go +++ b/version/version.go @@ -1,3 +1,3 @@ package version -var SeerVersion string = "0.1.10" +var SeerVersion string = "0.1.11"