Skip to content

Commit

Permalink
feat: add getRelatedPool
Browse files Browse the repository at this point in the history
  • Loading branch information
datluongductuan committed Apr 10, 2024
1 parent bc8fe58 commit cb99ea6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/types/pendingtx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Check failure on line 10 in pkg/types/pendingtx.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

File is not `gci`-ed with --skip-generated -s standard -s default (gci)
)

type Message struct {
Expand Down Expand Up @@ -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

Check failure on line 97 in pkg/types/pendingtx.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

Comment should end in a period (godot)
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
}

0 comments on commit cb99ea6

Please sign in to comment.