From 1848b6e815dcd9936cccb5f6647b1de8755ee4c1 Mon Sep 17 00:00:00 2001 From: Lucas Meier Date: Mon, 29 Jul 2024 23:03:54 -0700 Subject: [PATCH] pindexer: Use correct price calculation in dex_lp Because it's unitless, we need decimals, woops. --- crates/bin/pindexer/src/dex/dex.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bin/pindexer/src/dex/dex.sql b/crates/bin/pindexer/src/dex/dex.sql index 9d73209701..8fbc2f764c 100644 --- a/crates/bin/pindexer/src/dex/dex.sql +++ b/crates/bin/pindexer/src/dex/dex.sql @@ -68,9 +68,9 @@ CREATE TABLE IF NOT EXISTS dex_lp ( -- The fee, in basis points fee_bps Bps, -- How much of asset2 you get when swapping asset1. - price12 NUMERIC(39, 0) GENERATED ALWAYS AS (((1 - fee_bps::NUMERIC / 10000) * (p / q))::Amount) STORED, + price12 NUMERIC GENERATED ALWAYS AS (((1 - fee_bps::NUMERIC / 10000) * (p / q))) STORED, -- How much of asset1 you get when swapping asset2. - price21 NUMERIC(39, 0) GENERATED ALWAYS AS (((1 - fee_bps::NUMERIC / 10000) * (q / p))::Amount) STORED, + price21 NUMERIC GENERATED ALWAYS AS (((1 - fee_bps::NUMERIC / 10000) * (q / p))) STORED, -- Whether the position will be closed when all reserves are depleted close_on_fill BOOLEAN NOT NULL, -- The amount of reserves of asset 1.