-
Notifications
You must be signed in to change notification settings - Fork 545
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@vendrell46 is attempting to deploy a commit to the Uniswap Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- lets do a pass on indentation
- lets remove CLEAR_OR_TAKE examples in decrease / fee collection; doesnt make sense to use this delta resolving for those actions
```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) | ||
``` |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
// 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
```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 | ||
); | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation looks weird no?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
There was a problem hiding this comment.
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 | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extraneous character?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
Co-authored-by: saucepoint <[email protected]>
Co-authored-by: saucepoint <[email protected]>
Co-authored-by: saucepoint <[email protected]>
Co-authored-by: saucepoint <[email protected]>
Co-authored-by: saucepoint <[email protected]>
Co-authored-by: saucepoint <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nits again
Co-authored-by: saucepoint <[email protected]>
Co-authored-by: saucepoint <[email protected]>
Co-authored-by: saucepoint <[email protected]>
Co-authored-by: saucepoint <[email protected]>
Co-authored-by: saucepoint <[email protected]>
Co-authored-by: saucepoint <[email protected]>
Co-authored-by: saucepoint <[email protected]>
Co-authored-by: saucepoint <[email protected]>
Co-authored-by: saucepoint <[email protected]>
Position Manager guide added to Uniswap v4 docs