You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const [token0Reserves, token1Reserves] = univ3prices.getAmountsForCurrentLiquidity(
'18', // decimals of UNI
'6', // decimals of USDC
'647424456336700945', // Current liquidity value of the pool
'424427182250808799309705', // Current sqrt price value of the pool
'60', // the tickSpacing value from the pool
0
);
console.log(token0Reserves) // 326.9
console.log(token1Reserves) // 1009.9
Does it mean that there is 326.9 UNI and 1009.9 USDC in the pool? The number of USDC seems low.
The text was updated successfully, but these errors were encountered:
Does it mean that there is 326.9 UNI and 1009.9 USDC in the pool? The number of USDC seems low.
Yes, that's exactly what it means. Remember, this is the very, very narrow range of a single tick space, in this case 60 ticks. Widen your range using the tickStep argument:
consttokenDecimals=['18',// decimals of UNI'6',// decimals of USDC];const[token0Reserves,token1Reserves]=univ3prices.getAmountsForCurrentLiquidity(tokenDecimals,'647424456336700945',// Current liquidity value of the pool'424427182250808799309705',// Current sqrt price value of the pool'60',// the tickSpacing value from the pool{tickStep: 10}// RAISE THE TICK STEP);console.log(token0Reserves)// 116596.9console.log(token1Reserves)// 1755.4
Thanks for opening the issue @sydneyhenrard, it helped me find a bug in the tickSpace which has been fixed in v3.0.0
I tried to use the getAmountsForCurrentLiquidity for the UNI/USDC pair
https://etherscan.io/address/0xd0fc8ba7e267f2bc56044a7715a489d851dc6d78#readContract
Does it mean that there is 326.9 UNI and 1009.9 USDC in the pool? The number of USDC seems low.
The text was updated successfully, but these errors were encountered: