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

Position Manager guide added #835

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open

Conversation

vendrell46
Copy link
Contributor

Position Manager guide added to Uniswap v4 docs

Copy link

vercel bot commented Dec 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 3:29pm

Copy link

vercel bot commented Dec 10, 2024

@vendrell46 is attempting to deploy a commit to the Uniswap Team on Vercel.

A member of the Team first needs to authorize it.

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.

  1. lets do a pass on indentation
  2. lets remove CLEAR_OR_TAKE examples in decrease / fee collection; doesnt make sense to use this delta resolving for those actions

Comment on lines 78 to 84
```solidity
// Common liquidity operations
uint8 constant MINT_POSITION = 1; // Creates negative deltas (tokens needed for position)
uint8 constant INCREASE_LIQUIDITY = 2; // Creates negative deltas (tokens to add)
uint8 constant DECREASE_LIQUIDITY = 3; // Creates positive deltas (tokens to receive)
uint8 constant BURN_POSITION = 4; // Creates positive deltas (tokens to receive)
```
Copy link
Collaborator

Choose a reason for hiding this comment

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

these command numbers were changed, i would check Actions.sol on github

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated as per Actions.sol

Comment on lines 96 to 100
// Common delta-resolving operations
uint8 constant SETTLE_PAIR = 10; // For negative deltas: Pay tokens to the pool
uint8 constant TAKE_PAIR = 11; // For positive deltas: Receive tokens from the pool
uint8 constant CLOSE_CURRENCY = 12; // Handles either direction based on final delta
uint8 constant CLEAR_OR_TAKE = 13; // For small amounts: Take if worth it, else ignore
Copy link
Collaborator

Choose a reason for hiding this comment

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

would verify these are still true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated as per Actions.sol

docs/contracts/v4/guides/11-position-manager.mdx Outdated Show resolved Hide resolved
docs/contracts/v4/guides/11-position-manager.mdx Outdated Show resolved Hide resolved
Comment on lines 199 to 219
```solidity
bytes[] memory params = new bytes[](2);

// Parameters for MINT_POSITION
params[0] = abi.encode(
poolKey, // Which pool to mint in
tickLower, // Position's lower price bound
tickUpper, // Position's upper price bound
liquidity, // Amount of liquidity to mint
amount0Max, // Maximum amount of token0 to use
amount1Max, // Maximum amount of token1 to use
recipient, // Who receives the NFT
"" // No hook data needed
);

// Parameters for SETTLE_PAIR - specify tokens to provide
params[1] = abi.encode(
poolKey.currency0, // First token to settle
poolKey.currency1 // Second token to settle
);
```
Copy link
Collaborator

Choose a reason for hiding this comment

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

indentation looks weird no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed. Fixed

With everything prepared, we can execute our batch operation:

```solidity
// Execute all operations atomically
Copy link
Collaborator

Choose a reason for hiding this comment

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

indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

abi.encode(actions, params),
block.timestamp + 60
);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

extraneous character?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed for clarity


This is valuable for:

- Fee collection with minimum amounts
Copy link
Collaborator

Choose a reason for hiding this comment

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

lets remove this, doesnt seem right to me that you would just "collect fees" to forfeit immediately?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

docs/contracts/v4/guides/11-position-manager.mdx Outdated Show resolved Hide resolved
docs/contracts/v4/guides/11-position-manager.mdx Outdated Show resolved Hide resolved
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.

small nits again

docs/contracts/v4/guides/11-position-manager.mdx Outdated Show resolved Hide resolved
docs/contracts/v4/guides/11-position-manager.mdx Outdated Show resolved Hide resolved
docs/contracts/v4/guides/11-position-manager.mdx Outdated Show resolved Hide resolved
docs/contracts/v4/guides/11-position-manager.mdx Outdated Show resolved Hide resolved
docs/contracts/v4/guides/11-position-manager.mdx Outdated Show resolved Hide resolved
docs/contracts/v4/guides/11-position-manager.mdx Outdated Show resolved Hide resolved
docs/contracts/v4/guides/11-position-manager.mdx Outdated Show resolved Hide resolved
docs/contracts/v4/guides/11-position-manager.mdx Outdated Show resolved Hide resolved
docs/contracts/v4/guides/11-position-manager.mdx Outdated Show resolved Hide resolved
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.

2 participants