Skip to content

Commit

Permalink
Merge pull request #3663 from osmosis-labs/stage
Browse files Browse the repository at this point in the history
fix SQS total weight values
  • Loading branch information
jonator authored Aug 3, 2024
2 parents 5092314 + 9dbcb2d commit 63ba091
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ function getPoolDenomsFromSidecarPool({ chain_model, balances }: SidecarPool) {
function makePoolRawResponseFromChainPool(
chainPool: SidecarPool["chain_model"]
): PoolRawResponse {
// CL pools
if ("current_tick_liquidity" in chainPool) {
return {
...chainPool,
Expand All @@ -162,6 +163,7 @@ function makePoolRawResponseFromChainPool(
} as PoolRawResponse;
}

// Stable pools
if ("scaling_factors" in chainPool) {
return {
...chainPool,
Expand All @@ -172,13 +174,17 @@ function makePoolRawResponseFromChainPool(
} as PoolRawResponse;
}

if ("id" in chainPool) {
// Weighted pools
if ("total_weight" in chainPool) {
return {
...chainPool,
id: chainPool.id?.toString(),
// SQS diverges from the node model by returning total_weight as a string decimal instead of string integer
total_weight: chainPool.total_weight.split(".")[0],
} as PoolRawResponse;
}

// Cosmwasm pools
return {
...chainPool,
pool_id: chainPool.pool_id?.toString(),
Expand Down

0 comments on commit 63ba091

Please sign in to comment.