Skip to content

Commit

Permalink
BE-636 | Fix search bug (#588)
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)
  • Loading branch information
deividaspetraitis authored and mergify[bot] committed Dec 4, 2024
1 parent 5255848 commit 569d3cc
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 569d3cc

Please sign in to comment.