Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

examples->swap error: "tick net delta must be zero" #21

Open
chimojiacai opened this issue Mar 23, 2023 · 1 comment
Open

examples->swap error: "tick net delta must be zero" #21

chimojiacai opened this issue Mar 23, 2023 · 1 comment

Comments

@chimojiacai
Copy link

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!

@chimojiacai
Copy link
Author

chimojiacai commented Apr 3, 2023 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant