uniswapv3-sdk
uniswapv3-sdk copied to clipboard
examples->swap error: "tick net delta must be zero"
Hi,bro: I used the swap operation, ValidateList method is error, and I looked at the assignment in the ticks:
ticks := []entities.Tick{
{
Index: entities.NearestUsableTick(sdkutils.MinTick,
constants.TickSpacings[feeAmount]),
LiquidityNet: pooltick.LiquidityNet,
LiquidityGross: pooltick.LiquidityGross,
},
{
Index: entities.NearestUsableTick(sdkutils.MaxTick,
constants.TickSpacings[feeAmount]),
LiquidityNet: pooltick.LiquidityNet,
LiquidityGross: pooltick.LiquidityGross,
},
}
this ticks LiquidityNet value inside is exactly the same,ValidateList:
sum := big.NewInt(0)
for _, tick := range ticks {
sum.Add(sum, tick.LiquidityNet)
}
if sum.Cmp(big.NewInt(0)) != 0 {
return ErrZeroNet
}
so the result always ErrZeroNet
, Help to see if there is a problem her,thanks!
I manually adjust the inverse value "ticks[1].LiquidityNet = big.NewInt(0).Sub(big.NewInt(0), pooltick.LiquidityNet)" is runing!
At 2023-04-01 22:15:36, "KmanOfficial" @.***> wrote:
@chimojiacai Did you manage to fix this? I have the same issue also
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>