Hello friends. Can someone explane whats store LIQUIDITY fields in Uniswap V3 Swap event and whats units. In docs I found that "The liquidity of the pool after the swap", but how to decode this value or how to convert this value in dollars, for example. πŸ€”πŸ€”πŸ€” It's blowing my mind, I can't figure out what this field stores.

Mar 22, 2023, 1:47 PM
its in wei, use any online wei to eth or dollar converter
Mar 22, 2023, 2:27 PM
in shortly, its amount0_in_eth + amount1_in_eth? ))
For example, I want to calculate the liquidity pair in dollars, can I convert this field of liquidity in ether and multiply by the value of ether in dollars?
Mar 22, 2023, 2:31 PM
not sure, it'll depend on how the contract is written
if it's in wei, then convert it to ether, and you'll have the price according to whatever the eth market price is
i think it's liquidity for amt1
Im a newbie too , so corrections would be appreciated
Mar 22, 2023, 4:17 PM
We'll do it the old-fashioned way, reserve0 and reserve1
Mar 22, 2023, 4:18 PM
@hallogutentag @grimreaper619 can you help? I also wanna know
Mar 22, 2023, 4:29 PM
Iirc square it and multiply it with some factor
I ended up reading the contracts when i needed to find out because uniswap's doc is absolute shit
Not on my pc rn, so i can't easily tell
Mar 22, 2023, 4:32 PM
I want to find the liquidity of the pool after the swap in dollars, and I was wondering if I could pull some value from the liquidity field to bring it to dollars. For example get values in ether and multiply by ether price in dollars ☺️
Mar 22, 2023, 4:37 PM
aight, back at my PC. here is the important line: https://github.com/Uniswap/v2-core/blob/master/contracts/UniswapV2Pair.sol#L120 the meaning of liquidity should be obvious from this
just use the line i referenced to compute the token values. then you need to apply the token decimals of either of the tokens and look the token's price up to multiply it with the quantity. then double it to get the total value locked of the pool (the total value locked of both tokens in the pool will be approx. the same in any liquid pool)
Mar 22, 2023, 4:39 PM
Thanks, I'll give it a try, but it sounds complicated.
Mar 22, 2023, 4:41 PM
using words to describe the uniswap docs and those who wrote them would probably get me banned from this group. just read the code. it's so much easier
Mar 22, 2023, 4:41 PM

Β© 2024 Draquery.com All rights reserved.