Skip to content

Commit

Permalink
shovel/dig: bugfix. address[] should be bytes20[] instead of bytes32[]
Browse files Browse the repository at this point in the history
If you are indexing an event with an array of addresses, the input type
for that field will be address[]. In this case, when the db type
encoding function is presented with an item from the address[] it should
treat the bytes as an address, meaning: keep only 20 msb.
  • Loading branch information
ryandotsmith committed Apr 18, 2024
1 parent 16e1d10 commit a2d6dc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dig/dig.go
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ func dbtype(abitype string, d []byte) any {
var x uint256.Int
x.SetBytes(d)
return x.Dec()
case abitype == "address":
case strings.HasPrefix(abitype, "address"):
if len(d) == 32 {
return d[12:]
}
Expand Down

0 comments on commit a2d6dc7

Please sign in to comment.