diff --git a/ingest/sqs/pools/ingester/pool_ingester.go b/ingest/sqs/pools/ingester/pool_ingester.go index ab347e91b36..98f2e5073bf 100644 --- a/ingest/sqs/pools/ingester/pool_ingester.go +++ b/ingest/sqs/pools/ingester/pool_ingester.go @@ -13,12 +13,13 @@ import ( poolsredisrepo "github.com/osmosis-labs/sqs/sqsdomain/repository/redis/pools" routerredisrepo "github.com/osmosis-labs/sqs/sqsdomain/repository/redis/router" + cosmwasmpooltypes "github.com/osmosis-labs/osmosis/v23/x/cosmwasmpool/types" + "github.com/osmosis-labs/osmosis/osmomath" "github.com/osmosis-labs/osmosis/v23/ingest/sqs/domain" "github.com/osmosis-labs/osmosis/v23/x/concentrated-liquidity/client/queryproto" concentratedtypes "github.com/osmosis-labs/osmosis/v23/x/concentrated-liquidity/types" - "github.com/osmosis-labs/osmosis/v23/x/cosmwasmpool/model" poolmanagertypes "github.com/osmosis-labs/osmosis/v23/x/poolmanager/types" ) @@ -74,9 +75,6 @@ const ( atomDenom = "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2" usdtDenom = "ibc/2108F2D81CBE328F371AD0CEF56691B18A86E08C3651504E42487D9EE92DDE9C" oneOSMO = 1_000_000 - - // code ID of the broken WhiteWhale cosmwasm pools on mainnet. - whiteWhalePoolCodeID = uint64(503) ) var ( @@ -201,18 +199,6 @@ func (pi *poolIngester) processPoolState(ctx sdk.Context, tx repository.Tx) erro } for _, pool := range cosmWasmPools { - // The logic below is to skip mainnet WhiteWhale pools that were instantiated while - // borne - cwPool, ok := pool.(*model.Pool) - if !ok { - return errors.New("fail to cast cw pool") - } - - // White whale pool code ID - if cwPool.CodeId == whiteWhalePoolCodeID { - continue - } - // Parse cosmwasm pool to the standard SQS types. pool, err := pi.convertPool(ctx, pool, denomToRoutablePoolIDMap, denomPairToTakerFeeMap, tokenPrecisionMap) if err != nil { @@ -330,6 +316,14 @@ func (pi *poolIngester) convertPool( }() balances := pi.bankKeeper.GetAllBalances(ctx, pool.GetAddress()) + if pool.GetType() == poolmanagertypes.CosmWasm { + cwPool, ok := pool.(cosmwasmpooltypes.CosmWasmExtension) + if !ok { + return nil, fmt.Errorf("pool (%d) with type (%d) is not a CosmWasmExtension", pool.GetId(), pool.GetType()) + } + + balances = cwPool.GetTotalPoolLiquidity(ctx) + } osmoPoolTVL := osmomath.ZeroInt()