Skip to content

Conversation

@mkflow27
Copy link
Collaborator

@mkflow27 mkflow27 commented Dec 4, 2025

  • Handle maxAdjustableAmount = 0 explicitly: Rejects single-sided unbalanced joins at the SDK level with a clear SDKError, since the router’s proportional-add+swap design cannot drive the adjustable leg to exactly zero in general.

  • GivenOut (EXACT_OUT correction swap): Adds a helper that scales the BPT target up from the proportional join when needed so that the proportional exact token amount exceeds the user’s exactAmount by at least a fee‑adjusted minSwapAmount, enabling a robust EXACT_OUT correction swap within the adjustable budget.

  • GivenIn (EXACT_IN correction swap, baseline): Adds a helper that starts from the proportional join and, if necessary, scales the reference down so that (1) the correction swap delta satisfies the fee‑adjusted minSwapAmount constraint and (2) the proportional adjustable amount is within maxAdjustableAmount, thus staying close to proportional while respecting constraints.

  • GivenIn (EXACT_IN with minimized adjustable): Adds an aggressive helper and routing flag (minimizeAdjustableAmount) that binary‑searches over smaller internal references/BPT targets to minimize the adjustable token in, while still enforcing Vault min‑trade constraints, the user’s maxAdjustableAmount, and a constant‑price underflow guard to avoid router underflows in the adjustable leg (the underflow guard is not working properly yet).

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