Skip to content

Commit

Permalink
BE-636 | Fix search bug (#588) (#589)
Browse files Browse the repository at this point in the history
Fixes a bug when searching pool by pair of tokens for /pools endpoint

(cherry picked from commit 9262f80)

Co-authored-by: Deividas Petraitis <[email protected]>
  • Loading branch information
mergify[bot] and deividaspetraitis authored Dec 4, 2024
1 parent 5255848 commit 162445b
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions pools/usecase/pools_usecase.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,14 @@ var filterExactMatchSearch = func(tokenMetadataHolder TokenMetadataHolder, searc
return func(pool sqsdomain.PoolI) bool {
var coinDenoms []string

for _, denom := range pool.GetSQSPoolModel().PoolDenoms {
var denoms []string
if pool.GetSQSPoolModel().CosmWasmPoolModel != nil {
denoms = pool.GetPoolDenoms()
} else {
denoms = pool.GetUnderlyingPool().GetPoolDenoms(sdk.Context{})
}

for _, denom := range denoms {
token, err := tokenMetadataHolder.GetMetadataByChainDenom(denom)
if err != nil {
continue
Expand All @@ -432,7 +439,14 @@ var filterPartialMatchSearch = func(tokenMetadataHolder TokenMetadataHolder, sea
var poolNameByDenom string
var coinnames []string

for _, denom := range pool.GetSQSPoolModel().PoolDenoms {
var denoms []string
if pool.GetSQSPoolModel().CosmWasmPoolModel != nil {
denoms = pool.GetPoolDenoms()
} else {
denoms = pool.GetUnderlyingPool().GetPoolDenoms(sdk.Context{})
}

for _, denom := range denoms {
token, err := tokenMetadataHolder.GetMetadataByChainDenom(denom)
if err != nil {
continue
Expand Down

0 comments on commit 162445b

Please sign in to comment.