Alexangelj / concentrated

Simple concentrated liquidity AMM with limited price grid.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect variable usage

Alexangelj opened this issue · comments

if (fullDeltaSqrtPrice < normalizedDeltaSqrtPrice) price = nextSqrtPrice;
// Compute amounts that changed given the change in sqrt price and amount of liquidity.
(amountIn, amountOut) = getAmountsGivenSqrtPriceAndLiquidity(deltaSqrtPrice, liquidity);

I think I got the price variables mixed up. If the actual price change is greater than the max price change computed from change in price in a tick, then we set the price equal to the next price. And for computing the swap amounts, we need to use the actual price change or the maximum price change in the tick, not the max price change by default.