Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: How do I calculate currentPosition required by NonfungiblePositionManager.removeCallParameters? #44

Open
antiwinter opened this issue Apr 18, 2023 · 1 comment

Comments

@antiwinter
Copy link

In the example code the currentPosition is constructed from CurrentConfig which is a const value and can be the same as the mint one. But in real use, there won't be such a CurrentConfig, then how can I calculate it from positionId or the object returned by positionContract.positions(tokenId)?

@Florian-S-A-W
Copy link
Contributor

Hi @antiwinter ,
You get all the values you need from the positions function on the NonfungiblePositionManager Contract.
From the response of getPositionInfo() create the position like this:

const currentPositionInfo = await getPositionInfo(positionId)
const currentPosition = new Position({
      pool,
      liquidity: JSBI.BigInt(currentPositionInfo.liquidity.toString()),
      tickLower: currentPositionInfo.tickLower,
      tickUpper: currentPositionInfo.tickUpper,
    })

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

No branches or pull requests

2 participants