Skip to content

Commit

Permalink
feat: unblock ww pools (#7716) (#7718)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Mar 12, 2024
1 parent eaf6332 commit 325f62c
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions ingest/sqs/pools/ingester/pool_ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 325f62c

Please sign in to comment.