Skip to content

Commit

Permalink
fix: total liquidity query (#7297) (#7299)
Browse files Browse the repository at this point in the history
* fix total liq query

* remove print

(cherry picked from commit 773a556)

Co-authored-by: Adam Tucker <[email protected]>
  • Loading branch information
mergify[bot] and czarcas7ic authored Jan 10, 2024
1 parent 0c08c3d commit 4fd537d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 0 additions & 3 deletions x/concentrated-liquidity/total_liquidity.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package concentrated_liquidity

import (
"fmt"

"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"

Expand Down Expand Up @@ -57,7 +55,6 @@ func (k Keeper) IterateDenomLiquidity(ctx sdk.Context, cb func(sdk.Coin) bool) {

for ; iterator.Valid(); iterator.Next() {
var amount osmomath.Int
fmt.Println(iterator.Value())
if err := amount.Unmarshal(iterator.Value()); err != nil {
panic(err)
}
Expand Down
6 changes: 5 additions & 1 deletion x/cosmwasmpool/pool_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,11 @@ func (k Keeper) GetTotalLiquidity(ctx sdk.Context) (sdk.Coins, error) {
}
}
totalPoolLiquidity := cosmwasmPool.GetTotalPoolLiquidity(ctx)
totalLiquidity = totalLiquidity.Add(totalPoolLiquidity...)
// We range over the coins and add them one at a time because GetTotalPoolLiquidity
// doesn't always return a sorted list of coins.
for _, coin := range totalPoolLiquidity {
totalLiquidity = totalLiquidity.Add(coin)
}
}
return totalLiquidity, nil
}

0 comments on commit 4fd537d

Please sign in to comment.