I know how to get balances of each token from a pair, and if I'm not mistaken - those balances of tokens is indeed a real reserves. Also, L is stored in contract info, but I doubt one thing - this L is just an L or L^2 or a srqt(L). From sqrtRatioX96 price can be founded.
Found, that (x(real) + L / sqrt(Pb))*(y(real) + L * sqrt(Pa)) = L**2
As well as
(x(real) + x(virtual)) * (y(real) + y(virtual)) = L**2
So x(virtual) = L / sqrt(Pb) y(virtual) = L * sqrt(Pa) But what (Pa) & (Pb) is exactly? P(a) is a token0Price & (Pb) is a token1Price? Or (Pa) & (Pb) is a high & low price of this tick/ concentration zone. I have thoughts that (Pa) & (Pb) is a "price range" of current tick/position, but no clue how to find this (Pa) & (Pb). If Pa = token0Price (from sqrtRatioX96) & If Pb = token1Price (from sqrtRatioX96) I've got: x(virtual) = L / sqrt(token0Price) x(virtual) = 776218541774739337116335 / sqrt(0.0008191556417896165) x(virtual) = 776218541774739337116335 / 0.02862089519 x(virtual) = 2.7120694046143822e+25 x(virtual) = 27120694046143822000000000 (18 decimal)
y(virtual) = L * sqrt(P) y(virtual) = 776218541774739337116335 * sqrt(1220.7692274636495) y(virtual) = 776218541774739337116335 * 34.9395081171 y(virtual) = 2.7120694040982028e+25 y(virtual) = 27120694040982028000000000 (18 decimal)
x(virtual) (token0Price) = 27120694046143822000000000 = 27120694.046143822 y(virtual) (token1Price) = 27120694040982028000000000
Yeah, look's pretty 50/50, but what exactly those numbers is? That's a DAI/WETH pair (0,5 fee) and if that's a "USD valued" reserves - not possible, because real reserves of DAI at that moment was 2591437.269710515203595384 & 2838.497576725882781612 of WETH.
Is there anything that i missed?