Skip to content

Commit

Permalink
fix ListPoolsByDenom method (#7341)
Browse files Browse the repository at this point in the history
* fix `ListPoolsByDenom` method

* a test

* update changelog
  • Loading branch information
doggystylez authored Feb 17, 2024
1 parent 1606b76 commit 7d734f6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Bug Fixes

* [#7360](https://github.com/osmosis-labs/osmosis/pull/7360) fix: use gov type for SetScalingFactorController
* [#7341](https://github.com/osmosis-labs/osmosis/pull/7341) fix: support CosmWasm pools in ListPoolsByDenom method

### Misc Improvements

Expand Down
5 changes: 4 additions & 1 deletion x/poolmanager/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,10 @@ func (k Keeper) ListPoolsByDenom(

var poolsByDenom []types.PoolI
for _, pool := range currentModulePools {
poolDenoms := pool.GetPoolDenoms(ctx)
poolDenoms, err := poolModule.GetPoolDenoms(ctx, pool.GetId())
if err != nil {
return nil, err
}
if osmoutils.Contains(poolDenoms, denom) {
poolsByDenom = append(poolsByDenom, pool)
}
Expand Down
8 changes: 8 additions & 0 deletions x/poolmanager/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3870,6 +3870,14 @@ func (suite *KeeperTestSuite) TestListPoolsByDenom() {
denom: BAR,
expectedNumPools: 2,
},
"A cosmwasm pool": {
poolType: []types.PoolType{types.CosmWasm},
poolCoins: []sdk.Coins{
sdk.NewCoins(sdk.NewCoin(BAR, defaultInitPoolAmount), sdk.NewCoin(UOSMO, defaultInitPoolAmount)), // pool 1 bar-uosmo
},
denom: BAR,
expectedNumPools: 1,
},
}

for name, tc := range tests {
Expand Down

0 comments on commit 7d734f6

Please sign in to comment.