Skip to content

fix: StateLibrary change @param #959

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dennnis0204
Copy link

Related Issue

Trying to get position liquidity like in guide https://docs.uniswap.org/contracts/v4/guides/read-pool-state#getpositioninfo
Function getPositionInfo(
IPoolManager manager,
PoolId poolId,
address owner,
int24 tickLower,
int24 tickUpper,
bytes32 salt
) doesn't work with @param owner The owner of the liquidity position.
Works with @param address of the position manager.

In v4-periphery -> PositionManager.sol ->
bytes32 positionId = Position.calculatePositionKey(address(this), tickLower, tickUpper, bytes32(tokenId));
The same calculatePositionKey with address(this) == address(positionManager)

Description of changes

Changed in StateLibrary.sol function getPositionInfo @param owner The owner of the liquidity position. to @param posm The position manager.

@dennnis0204 dennnis0204 requested a review from a team as a code owner March 14, 2025 12:43
Copy link
Collaborator

@saucepoint saucepoint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the feedback, I can see how its confusing

I would actually suggest reverting back to the owner naming, and just improving the natspec. Not all liquidity managers will conventionally follow a PosM-style contract

For example, a hook can manage liquidity or developers can write a contract which manages a single position; therefore, I think its misleading to call the param posm

@@ -219,7 +219,7 @@ library StateLibrary {
* @notice Retrieves the position information of a pool without needing to calculate the `positionId`.
* @dev Corresponds to pools[poolId].positions[positionId]
* @param poolId The ID of the pool.
* @param owner The owner of the liquidity position.
* @param posm The position manager.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param posm The position manager.
* @param owner The owner contract of the liquidity position. Typically a periphery contract like PositionManager

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverting back to the owner naming, and just improving the natspec is good enough!

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

Successfully merging this pull request may close these issues.

3 participants