Skip to content

Conversation

@Brenzee
Copy link
Contributor

@Brenzee Brenzee commented Dec 23, 2025

No description provided.

Copy link
Contributor

@vnavascues vnavascues left a comment

Choose a reason for hiding this comment

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

Let me know if you agree with the suggestions (besides custom errors :D)

})
);

if (zeroForOne) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If the if...else (or ?) is used to init param1 and param2, the duplicated code present in if (zeroForOne) {...} else {...} can be removed.

UNIVERSAL_ROUTER.execute{ value: msg.value }(commands, inputs, deadline);

address tokenOut = Currency.unwrap(zeroForOne ? poolKey.currency1 : poolKey.currency0);
amountOut = IERC20(tokenOut).balanceOf(address(this));
Copy link
Contributor

Choose a reason for hiding this comment

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

Imho we need to do the balance diff here:

  • tokenOutBalancePre
  • Currency.unwrap
  • tokenOutBalancePost
  • amountOut = tokenOutBalancePost - tokenOutBalancePre

}

function approveToken(address token, uint256 amount) private {
IERC20(token).approve(address(PERMIT2), amount);
Copy link
Contributor

Choose a reason for hiding this comment

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

Better off using SafeERC20 & forceApprove (e.g., handle well USDT) around, no?

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