-
Notifications
You must be signed in to change notification settings - Fork 488
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 from amount support #384
base: main
Are you sure you want to change the base?
Conversation
src/PositionManager.sol
Outdated
PoolKey calldata poolKey, | ||
int24 tickLower, | ||
int24 tickUpper, | ||
uint128 amount0, |
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.
now that i think about it im wondering if theres ever a time that amount0
and amount1
would ever not just be OPEN_DELTA? I dont really see a usecase aside from that?
so could even potentially just remove those parameters and just always look up open deltas and then add that much liquidity?
|
||
uint256 constant SETTLE_TAKE_PAIR = 0x18; | ||
uint256 constant CLOSE_CURRENCY = 0x19; | ||
uint256 constant CLEAR_OR_TAKE = 0x20; |
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.
Just curious, why the aversion to hex digits abcdef
? 0x18 + 0x2 = 0x1a
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.
Just a mistake I think
import {SafeCast} from "@uniswap/v4-core/src/libraries/SafeCast.sol"; | ||
|
||
/// @notice Provides functions for computing liquidity amounts from token amounts and prices | ||
library LiquidityAmounts { |
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.
diffed with v3 lib, can wrap the functions in unchecked blocks; subtractions guaranteed to not overflow
_getFullCredit(poolKey.currency1) | ||
); | ||
|
||
_mint(poolKey, tickLower, tickUpper, uint256(liquidity), amount0Max, amount1Max, owner, hookData); |
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.
redundant uint256
casting
_mint(poolKey, tickLower, tickUpper, uint256(liquidity), amount0Max, amount1Max, owner, hookData); | |
_mint(poolKey, tickLower, tickUpper, liquidity, amount0Max, amount1Max, owner, hookData); |
Related Issue
Which issue does this pull request resolve?
Description of changes