Open cryptohazard opened 2 years ago
any idea what is this issue?
So I figured out the issue. Here is the dump values for that pool using the default ConstructV3Pool
:
(int) -887220
(struct { LiquidityGross *big.Int; LiquidityNet *big.Int; FeeGrowthOutside0X128 *big.Int; FeeGrowthOutside1X128 *big.Int; TickCumulativeOutside *big.Int; SecondsPerLiquidityOutsideX128 *big.Int; SecondsOutside uint32; Initialized bool }) {
LiquidityGross: (*big.Int)(0xc0002284e0)(188409859849374781670),
LiquidityNet: (*big.Int)(0xc000228500)(188409859849374781670),
FeeGrowthOutside0X128: (*big.Int)(0xc000228520)(0),
FeeGrowthOutside1X128: (*big.Int)(0xc000228540)(0),
TickCumulativeOutside: (*big.Int)(0xc000228560)(28670743),
SecondsPerLiquidityOutsideX128: (*big.Int)(0xc000228580)(877588224289100297272043112566530217345024),
SecondsOutside: (uint32) 1641883915,
Initialized: (bool) true
}
(int) 887220
(struct { LiquidityGross *big.Int; LiquidityNet *big.Int; FeeGrowthOutside0X128 *big.Int; FeeGrowthOutside1X128 *big.Int; TickCumulativeOutside *big.Int; SecondsPerLiquidityOutsideX128 *big.Int; SecondsOutside uint32; Initialized bool }) {
LiquidityGross: (*big.Int)(0xc0001a4f60)(185649691152534902627),
LiquidityNet: (*big.Int)(0xc0001a4f80)(-185649691152534902627),
FeeGrowthOutside0X128: (*big.Int)(0xc0001a4fa0)(0),
FeeGrowthOutside1X128: (*big.Int)(0xc0001a4fc0)(0),
TickCumulativeOutside: (*big.Int)(0xc0001a4fe0)(0),
SecondsPerLiquidityOutsideX128: (*big.Int)(0xc0001a5000)(0),
SecondsOutside: (uint32) 0,
Initialized: (bool) true
}
2023/02/16 11:48:59 tick net delta must be zero
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x10039db04]
I also the function from @lmanini fix.
I tried other pools, USDC/DAI, WBTC/WETH, USDC/WETH, and all worked fine.
In the end, all I wanted was to check the value of LP tokens. now my fix was to follow the example code to create two ticks with opposites LiquidityNet
in my own ConstructV3Pool
. And this fixed my issue and give a propre amount of tokens.
Hey, I was trying to use your package to interact with a pool on maiinet but I get an error when using
ConstructV3Pool
I get the following error
tick net delta must be zero
, which as I understand is something about validating the ticks inValidateList
. But I don't know enough of the details of uniswap to understand how to fix this or why this pool fails.Do you have an idea? etherscan link of the pool: https://etherscan.io/address/0x82c427adfdf2d245ec51d8046b41c4ee87f0d29c#readContract