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

add posm view lib #237

Closed
wants to merge 2 commits into from
Closed

add posm view lib #237

wants to merge 2 commits into from

Conversation

snreynolds
Copy link
Member

trying to clean up base PositionManager.sol contract, moving internal func to a lib & cleaning up some tests

import {PositionConfig} from "./PositionConfig.sol";

/// @notice A library for reading posm liquidity balances from core, wraps core's StateLibrary
library PosmLiquidityLibrary {
Copy link
Contributor

Choose a reason for hiding this comment

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

I do wonder if we should be keeping the name posm out of the final code ... i feel like no one else knows what it means?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh also i dont think it needs to be positionmanager specific at all? really any contract that adds liquidity could use this library right?
i feel like it should be called LiquidityLibrary and bytes32 salt should be passed in instead of tokenId?
And then its just a generic library for liquidity providing contracts to use for their liquidity look ups?

@@ -75,4 +82,13 @@ contract PosmTestSetup is Test, Deployers, DeployPermit2, LiquidityOperations {
delta = delta + hook.deltas(i);
}
}

function _getPositionLiquidity(uint256 tokenId, PositionConfig memory _config)
Copy link
Contributor

Choose a reason for hiding this comment

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

this PR introduces a library that does exactly this, feels wrong that our tests that integrate then cant access it and youve had to copy the same code into the tests?
maybe its worth exposing a public function on position manager called getPositionLiquidity(tokenId, config) that returns the liquidity? and then tests/integrations can use that?
thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

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

we could also have the library accept the posm address as a param? thats how StateLibrary works

Copy link
Member Author

Choose a reason for hiding this comment

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

lmk what you prefer

Copy link
Contributor

Choose a reason for hiding this comment

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

mmm im not sure i like that given its to be used internally? like we dont use the StateLibrary internally in PM? but i dont feel strongly


import {PositionConfig} from "./PositionConfig.sol";

/// @notice A library for reading posm liquidity balances from core, wraps core's StateLibrary
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// @notice A library for reading posm liquidity balances from core, wraps core's StateLibrary
/// @notice A library for reading liquidity balances owned by the current contract from the PoolManager

@snreynolds snreynolds mentioned this pull request Aug 4, 2024
@saucepoint
Copy link
Collaborator

replaced by #270

@saucepoint saucepoint closed this Aug 4, 2024
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