From 460b36f241477de386e8a3d5651381a5ae839cfc Mon Sep 17 00:00:00 2001 From: Lucas Meier Date: Wed, 27 Nov 2024 10:58:30 -0800 Subject: [PATCH] pindexer: dex_ex: correct denom conversion in aggregate summary --- crates/bin/pindexer/src/dex_ex/mod.rs | 13 +++++++------ crates/bin/pindexer/src/indexer_ext.rs | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/crates/bin/pindexer/src/dex_ex/mod.rs b/crates/bin/pindexer/src/dex_ex/mod.rs index 9115a57ead..c675a0acf0 100644 --- a/crates/bin/pindexer/src/dex_ex/mod.rs +++ b/crates/bin/pindexer/src/dex_ex/mod.rs @@ -530,14 +530,15 @@ mod summary { SELECT asset_start, asset_end, (dex_ex_pairs_summary.price - greatest(price_then, 0.000001)) / greatest(price_then, 0.000001) * 100 AS price_change, - liquidity * eligible_denoms.price AS liquidity, - direct_volume_over_window * eligible_denoms.price as dv, - swap_volume_over_window * eligible_denoms.price as sv, + liquidity * ed_end.price AS liquidity, + direct_volume_over_window * ed_start.price AS dv, + swap_volume_over_window * ed_start.price AS sv, trades_over_window as trades FROM dex_ex_pairs_summary - JOIN eligible_denoms - ON eligible_denoms.asset = asset_end - WHERE the_window = $3 + JOIN eligible_denoms AS ed_end + ON ed_end.asset = asset_end + JOIN eligible_denoms AS ed_start + ON ed_start.asset = asset_start ), sums AS ( SELECT diff --git a/crates/bin/pindexer/src/indexer_ext.rs b/crates/bin/pindexer/src/indexer_ext.rs index 9ff68994f3..4f836aa925 100644 --- a/crates/bin/pindexer/src/indexer_ext.rs +++ b/crates/bin/pindexer/src/indexer_ext.rs @@ -18,7 +18,7 @@ impl IndexerExt for cometindex::Indexer { "passet1w6e7fvgxsy6ccy3m8q0eqcuyw6mh3yzqu3uq9h58nu8m8mku359spvulf6", ) .expect("should be able to parse passet"), - 100.0 * 1000_0000.0, + 1000.0 * 1_000_000.0, ))) .with_index(Box::new(crate::supply::Component::new())) .with_index(Box::new(crate::ibc::Component::new()))