diff --git a/eth/types.go b/eth/types.go index 53be5d27..24095c78 100644 --- a/eth/types.go +++ b/eth/types.go @@ -131,16 +131,18 @@ func (b Block) String() string { } type Log struct { - Address Bytes `json:"address"` - Topics [4]Bytes `json:"topics"` - Data Bytes `json:"data"` + Address Bytes `json:"address"` + Topics []Bytes `json:"topics"` + Data Bytes `json:"data"` } func (l *Log) UnmarshalRLP(b []byte) { iter := rlp.Iter(b) l.Address.Write(iter.Bytes()) for i, t := 0, rlp.Iter(iter.Bytes()); t.HasNext(); i++ { - l.Topics[i].Write(t.Bytes()) + topic := make([]byte, 32) + copy(topic, t.Bytes()) + l.Topics = append(l.Topics, topic) } l.Data.Write(iter.Bytes()) } diff --git a/integrations/erc20/transfer.go b/integrations/erc20/transfer.go index 20b4e7a2..1d40d35d 100644 --- a/integrations/erc20/transfer.go +++ b/integrations/erc20/transfer.go @@ -62,7 +62,7 @@ func (i integration) Insert(ctx context.Context, pg e2pg.PG, blocks []eth.Block) for ridx := range blocks[bidx].Receipts { for lidx := range blocks[bidx].Receipts[ridx].Logs { l := blocks[bidx].Receipts[ridx].Logs[lidx] - if !bytes.Equal(l.Topics[0], sig) { + if !bytes.Equal(l.Topics[0], sig) || len(l.Topics) < 3 { continue } signer, err := blocks[bidx].Txs[ridx].Signer()