0

I'm trying to get pool position parameters, like:

  • liquidity
  • feeGrowthInside0LastX128
  • feeGrowthInside1LastX128
  • tokensOwed0
  • tokensOwed1

by polling positions() method in pool smart contract (I'm using Sushi V3 Pool). But I always get all zeroes!

Here is response example:

[ positions(bytes32) method Response ]
  liquidity                  uint128 :  0
  feeGrowthInside0LastX128   uint256 :  0
  feeGrowthInside1LastX128   uint256 :  0
  tokensOwed0                uint128 :  0
  tokensOwed1                uint128 :  0

According to interface IUniswapV3PoolState {}, The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper. But how I can make this key?

What I tried:

  1. Get address (my wallet address or NFT Position Manager address), convert it to bytes
  2. Convert to bytes tick lower and tick upper using BigEndian or LittleEndian
  3. Concatenate bytes: 20 bytes of address + 3 bytes of tick lower + 3 bytes of tick upper = 26 bytes total
  4. Then I tried to either left pad this key to 32 bytes, or right pad to 32 bytes

In general, I tried all the options, but I always get only zeros!

Here is real live (though out of range) position you can use for investigation. This is DAI/USDT position in Sushi V3 Pool in Scroll network.

PS. I can more easy get the same position information from NFT Position Manager (it also has positions() method which accepts NFT ID as a parameter), but I really need to interact with positions() method from Pool smart contract.

0

Your Answer

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