Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions internal/storage/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,16 @@ func addContractAddress(table, query string, contractAddress string) string {
}

func getTopicValueFormat(topic string) string {
toAddressHex := ethereum.HexToAddress(topic)
toAddressPadded := ethereum.LeftPadBytes(toAddressHex.Bytes(), 32)
toAddressTopic := ethereum.BytesToHash(toAddressPadded).Hex()
return toAddressTopic
if topic == "" {
// if there is no indexed topic, indexer stores an empty string
// we shouldn't pad and hexify such an argument then
return ""
}
asBytes := ethereum.FromHex(topic)
// ensure the byte slice is exactly 32 bytes by left-padding with zeros
asPadded := ethereum.LeftPadBytes(asBytes, 32)
result := ethereum.BytesToHash(asPadded).Hex()
return result
}

func (c *ClickHouseConnector) executeAggregateQuery(table string, qf QueryFilter) (map[string]string, error) {
Expand Down
Loading