1

If you deposit liquidity into Uniswap v3, you define a min and max price and then send a specific token amount. You receive an ERC-721 token (and NFT) that has an address (eg, https://etherscan.io/token/0xc36442b4a4522e871399cd717abdd847ab11fe88) and an ID (eg, 494696). If the current price of ETH is 2000, and Bob's range has a min and max price are 1000 and 3000, he will have much more capital than someone with the same liquidity but a min and max price of 1999 and 2001. Bob can send his LP to other accounts.

Is there a way for a Solidity contract to use a getter function to see the amount of liquidity, min, and max price for a user's LP? It seems like there should be, as this data is needed to value Bob's LP token, and using LP tokens as collateral is common. However, it could be people are using off-chain data, which would be problematic.

2 Answers 2

4

Yes, from the linked contract in your question, the contract has a view function called positions() where you supply a token ID and it returns the relevant information about that position. This will include the min and max tick as opposed to the min and max price due to how Uniswap V3 works.

The full function description is documented here: https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#positions

To read up more on how Uniswap V3 works I recommend checking out https://uniswapv3book.com/

1
  • Awesome! Thanks. I knew there had to be a way. Apr 24, 2023 at 11:23
0

This video explains it pretty well: https://www.youtube.com/watch?v=mL1aTJ8ny84

You can also use a subgraph query like this

{
  position(id: "your_token_id") {
    liquidity
    owner
    depositedToken0
    depositedToken1
    tickLower {
      price0
      price1
    }
    tickUpper {
      price0
  price1
  
    }
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.