Skip to content

Commit

Permalink
pindexer: Use correct price calculation in dex_lp
Browse files Browse the repository at this point in the history
Because it's unitless, we need decimals, woops.
  • Loading branch information
cronokirby committed Jul 30, 2024
1 parent 3bbe440 commit 1848b6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/bin/pindexer/src/dex/dex.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 1848b6e

Please # to comment.