diff --git a/pkg/types/pendingtx.go b/pkg/types/pendingtx.go index 194b693..c1ed7d5 100644 --- a/pkg/types/pendingtx.go +++ b/pkg/types/pendingtx.go @@ -7,6 +7,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" + "strings" ) type Message struct { @@ -91,3 +92,15 @@ func (c CallFrame) getLogs() []*types.Log { } return results } + +// GetRelatedPools returns all pools related to the log. +// A pool might appear from log.Address, or log.Topics +func GetRelatedPools(log *types.Log) []string { + pools := make([]string, 0, len(log.Topics)+1) + for _, topic := range log.Topics { + pools = append(pools, strings.ToLower(topic.Hex())) + } + pools = append(pools, strings.ToLower(log.Address.Hex())) + + return pools +}