From d1f6749f4de7200c1823f6f30ac213ac2cf14db3 Mon Sep 17 00:00:00 2001 From: levisyin <150114626+levisyin@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:32:48 +0800 Subject: [PATCH] refactor: ListPoolsByDenom using pool.GetPoolDenoms directly (#6914) * refactor: using pool.GetPoolDenoms directly * update changelog --- CHANGELOG.md | 1 + x/poolmanager/router.go | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 353a0dd17da..98ee0fd2bfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#6861](https://github.com/osmosis-labs/osmosis/pull/6861) Protorev address added to reduced taker fee whitelist * [#6884](https://github.com/osmosis-labs/osmosis/pull/6884) Improve ListPoolsByDenom function filter denom logic * [#6890](https://github.com/osmosis-labs/osmosis/pull/6890) Enable arb filter for affiliate swap contract +* [#6884](https://github.com/osmosis-labs/osmosis/pull/6914) Update ListPoolsByDenom function by using pool.GetPoolDenoms to filter denom directly ### API Breaks diff --git a/x/poolmanager/router.go b/x/poolmanager/router.go index 015a20ba8b1..42723891235 100644 --- a/x/poolmanager/router.go +++ b/x/poolmanager/router.go @@ -563,10 +563,7 @@ func (k Keeper) ListPoolsByDenom( var poolsByDenom []types.PoolI for _, pool := range currentModulePools { - poolDenoms, err := poolModule.GetPoolDenoms(ctx, pool.GetId()) - if err != nil { - return nil, err - } + poolDenoms := pool.GetPoolDenoms(ctx) if osmoutils.Contains(poolDenoms, denom) { poolsByDenom = append(poolsByDenom, pool) }