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 from amount support #384

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

add from amount support #384

wants to merge 9 commits into from

Conversation

snreynolds
Copy link
Member

Related Issue

Which issue does this pull request resolve?

Description of changes

PoolKey calldata poolKey,
int24 tickLower,
int24 tickUpper,
uint128 amount0,
Copy link
Contributor

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?

src/libraries/Actions.sol Show resolved Hide resolved
src/PositionManager.sol Show resolved Hide resolved

uint256 constant SETTLE_TAKE_PAIR = 0x18;
uint256 constant CLOSE_CURRENCY = 0x19;
uint256 constant CLEAR_OR_TAKE = 0x20;

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

Copy link
Member Author

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 {

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);

Choose a reason for hiding this comment

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

redundant uint256 casting

Suggested change
_mint(poolKey, tickLower, tickUpper, uint256(liquidity), amount0Max, amount1Max, owner, hookData);
_mint(poolKey, tickLower, tickUpper, liquidity, amount0Max, amount1Max, owner, hookData);

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.

4 participants