Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: unblock ww pools #7716

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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